(is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

15
Step by Step Guide to Validate EDI ANSI X12 Document using Java Mapping By Kubra Fatima, Yash Technologies Electronic Data Interchange (EDI) refers to the structured transmission of data be tween organizations by el ectronic means. It is used to transfer electronic documents from one computer system to another (i.e.) f rom one trading partner to another trading partner. SAP relies on Partners (Ex: Seeburger) to provide EDI Adapters for Exchange Infrastructure. This Adapter is used to perform conversion between EDI and XML format. Now, we would look at how to read EDI ANSI X12 document in SAP PI 7.0 without using any partner adapter. Pre-Requisites:   Basic knowledge of XI and how it works.  Basic know ledge of Java and how to do Java Mapping i n XI.  Basic knowledge of ANSI X12 standards for EDI. Scenario:  EDI ANSI X12 document is read as flat/text file using Sender File Adapter. To send correct EDI Document to the trading partner, the document is validated against EDI standards in SAP PI and the validated EDI ANSI X12 document is transferred to trading partner using Receiver File Adapter.

Transcript of (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 1/16

Step by Step Guide to Validate EDI ANSI X12 Document using Java Mapping

By Kubra Fatima, Yash Technologies

Electronic Data Interchange (EDI) refers to the structured transmission of data between organizations by electronic means. It is used to transfer electronicdocuments from one computer system to another (i.e.) f rom one trading partner to another trading partner.

SAP relies on Partners (Ex: Seeburger) to provide EDI Adapters for Exchange Infrastructure. This Adapter is used to perform conversion between EDI and XMLformat.

Now, we would look at how to read EDI ANSI X12 document in SAP PI 7.0 without using any partner adapter.

Pre-Requisites: 

  Basic knowledge of XI and how it works.

  Basic knowledge of Java and how to do Java Mapping in XI.

  Basic knowledge of ANSI X12 standards for EDI.

Scenario: 

EDI ANSI X12 document is read as flat/text file using Sender File Adapter. To send correct EDI Document to the trading partner, the document is validatedagainst EDI standards in SAP PI and the validated EDI ANSI X12 document is transferred to trading partner using Receiver File Adapter.

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 2/16

Validation Conditions: 

  Check if in-between one ISA segment to IEA segment, no other ISA, IEA segments exists, else raise an exception.

  Check if in-between one GS segment to GE segment, no other GS, GE segments exists, else raise an exception. 

  Check if in-between one ST segment to SE segment, no other ST, SE segments exists, else raise an exception.

  Check if total number of segments from ST to SE is equal to the value in SE01 (Number of included segments) else raise an exception.

  Check if the Interchange control number specified in ISA13 equal to the Interchange control number specified in IEA02, else raise an exception.  Check if the group control number specified in GS06 equal to the Group control number specified in GE02, else raise an exception.

  Check if the Transaction Set control number specified in ST02 equal to the Transaction Set control number specified in SE02, else raise an exception.

  Check if in the ISA segment, data elements ISA05, ISA06, ISA07, ISA08 are empty, raise corresponding exceptions.

Step-By-Step approach for validating above conditions in a scenario: 

1. System Landscape Directory (SLD) 

  Create the Product. 

  Create the Software Component for the newly created Product. 

  Define Technical Systems. 

  Define Business Systems (BS_FILE_SENDER & BS_FILE_RECEIVER) and assign the related integration Server for the Business Systems.

2. Integration Repository (IR) 

  Import the Software Component into IR.

  Create the Name Space.

  Create the Source Data Type.

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 3/16

 

  Create Source Message type (MT_Source) for the above Data Type created.

  Create the Target Data Type.

  Create Target Message type (MT_Target) for the above Data Type created.

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 4/16

  Create two Message Interfaces (Async Outbound and Async

Inbound).

  Create Message Mapping (MM_String_2_XML) using source and target message types.

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 5/16

 

The UDF String2XML is used to split the data according to the segment terminator (In my case, it is “~”). 

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 6/16

  Create the Java mapping program and JAR or ZIP file of it.

Create a java class ValidateX12EDIDocument using the source code available here. 

Click here to continue...

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 7/16

Step by Step Guide to Validate EDI ANSI X12 Document using Java Mapping

...Previous 

Create a mapping object of type Imported Archive . To import the archive, choose Import Archive.

Now select the jar / zip file you have created for your mapping program and save it.

Create Interface Mappings (IM_EDI), select Outbound Message Interface as Source Interface and Inbound Message Interface as target interface.

  Now select Mapping Program Type as Java Class and choose archive program name IA_ValidateEDI. Add Message Mapping

MM _String_2_XML below java class as shown below.

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 8/16

 

Test Interface Mapping .Give the input to the Data field as given below

ISA*00* *00* *ZZ*SFNO *ZZ*WABASHVPNT*090506*1401*U*00401*000000080*0*P*

~GS*PS*SNFO*WABASHVPNT*20090330*0808*000000123*X*004010~ST*856*000000005~BSN*00*MBOL70008*20090506*160109*0004~DTM*011*200906

09*110000*LT~DTM*067*20090609*150000*LT~HL*1**S~TD1*PCS*750.000****G*440*LB*44*CI~TD5*B*2*RDWY*LT*ROADWAY EXPRESS

INC~TD3*TL**EQID70002~REF*SI*TH70002~REF*MB*MBOL70008~REF*CN*CPRO70002~N1*SF*ALCOA/FORGING DIVISION*93*0000500003~N3*1600

HARVARD AVENUE~N4*CLEVELAND*OH*44105*US~N1*ST*WNC Manufacturing*93*0000022270~N3*3233

Kossuth~N4*Lafayette*IN*47905*US~HL*2*1*O~PRF*4500083878~N1*VN*ALCOA/FORGING DIVISION*93*0000500003~HL*3*2*I~LIN**IN*05200003-

01*CH*USA~TD1*PCK*16~TD1*PCS*750.000***DEFAULT CREATION*G*160*LB*16*CI~REF*IX*00010~REF*DK*5255~CTT*7~SE*28*000000005~GE*1

*000000123~IEA*1*000000080~ 

Message Mapping MM_String_2_XML is used to split the validated EDI Document. A RECORD is created in the target structure for each segment in the EDIDocument.

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 9/16

 

If the total number of segments from ST to SE is not equal to the number  in SE01 (Number of included

segments) it  raises MISMATCH_TOTAL_NUMBET_OF_SEGMENT _SPECIFIED_IN_SE_DATA_SEGMENT exception.

Similarly it throws corresponding Exception if the Validation conditions mentioned above are not met.

3. Integration Directory 

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 10/16

We are now going to create A2A scenario manually.

Create a scenario & name it then save it.

Once the Scenario is created & saved, it is displayed in Left panel

 Add Business Systems to your Scenario (BS_FILE_SENDER and BS_FILE_RECEIVER).

  Create a sender communication channel CCT_FILE_SEND_EDIValidation_YH1309 under Business System BS_FILE_SENDER and configure as below

Change the Target Directory, File Name Scheme and FTP Connection parameters with your required parameters.

Specify mandatory processsing parameters and also specify Content Conversion parameters as shown below

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 11/16

 

The complete EDI ANSI X12 document is read in the Data Field specified in the Source Message Type MT_Source Using File Content Conversion at senderCommunication Channel.

  Create a receiver communication channel CCT_FILE_REC_EDIValidation_YH1309 under Business System BS_FILE_RECEIVER and configure as

below

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 12/16

 

Specify mandatory processing parameters and also specify Content Conversion parameters as shown below

Now create Receiver Determination as shown below:

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 13/16

 

Create Interface Determination as shown below:

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 14/16

Now create Sender Agreement as shown below

Now we have to create the Receiver Agreement as shown below.

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 15/16

 

 Activate all the Objects.

4.Test the Scenario 

Put the Text file which contain EDI ANSI X12 document as a single string on the FTP server. output file will be as follows(only if all the validations are correct).

8/10/2019 (is) Step by Step Guide to Validate EDI ANSI X12 Document Using Java Mapping

http://slidepdf.com/reader/full/is-step-by-step-guide-to-validate-edi-ansi-x12-document-using-java-mapping 16/16

 

If you put a incorrect file on the FTP server (like No of segment from ST to SE is not equal to the value in SE01),then message in the SXMB_MONI is as follows