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 electronic documents from one computer system to another (i.e.) from 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 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 validated against EDI standards in SAP PI and the validated EDI ANSI X12 document is transferred to trading partner using Receiver File Adapter.

 

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.

 

·         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.

·         Create two Message Interfaces (Async Outbound and Async Inbound).            

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

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

  • 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...

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image