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


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.  

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*20090609*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 EDI Document.

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

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

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 sender Communication Channel.

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


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


Now create Receiver Determination as shown below:  









Create Interface Determination as shown below:  


Now create Sender Agreement as shown below  


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


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


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


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