Beruflich Dokumente
Kultur Dokumente
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.
Create Source Message type (MT_Source) for the above Data Type created.
Create Target Message type (MT_Target) for the above Data Type created.
Create
two
Message
Interfaces
(Async
Inbound).
Create Message Mapping (MM_String_2_XML) using source and target message types.
Outbound
and
Async
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...
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.
Class and
choose
archive
program
name IA_ValidateEDI.Add
Message
Mapping
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*0520000301*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
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
SE01 (Number
of
included
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.
Specify mandatory processing parameters and also specify Content Conversion parameters as shown below
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