Cost Free EDI Integration with Message Transformation Bean.
EDI integration is always expensive as it involves complex data mapping and secured communication. There are several EDI standards (EDIFACT, RossetaNet, X12 ..etc) using by different industries. PI can’t handle all kinds of EDI standards by its standard (SAP provided) adapters. Third party PI adapters (Seeburger ...etc) are available in the market to ready to use but involves additional cost as it is not part of standard SAP product. This blog will show a way to implement EDI with standard SAP PI (without third party adapters).
Most widely used EDI standards are RosettaNet and EDIFACT. RosettaNet adapter is part of standard PI product which can handle Rosetta Net standard transactions. PI does not have any standard adapter to process EDIFACT transactions (810, 800 …etc). These standard transactions are stored in complex structures in the TEXT file format. PI file adapter can convert text file to PI XML format but it is not capable of handling this kind of complexity. In order to handle complex conversions SAP provided additional adapter modules called Message Transformation Bean.
StructXML2Plain: It converts PI XML format to plain TEXT format which can be used for outgoing EDI transactions.
StructXML2Plain is used when each row of output file has different structure.
SimpleXML2Plain: It is also used for converting PI XML to plain text format.
SimpleXML2Plain is used when all rows of output file has same structure.
Example of using Message Transformation Bean in Outbound Scenario:
StructXML2Plain: For converting complex xml to Plain.
Processing sequence:
Processing sequence in the module is very important. ‘localejbs/AF_Modules/MessageTransformBean’ should be called first and then ‘CallSapAdapter’.
1. localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean Key
2. CallSapAdapter Local Enterprise Bean 0
Module Configuration:
We need to pass the parameters and related values in configuration.
Most important parameters are:
1. ‘Transform.Class’ and value is ‘com.sap.aii.messaging.adapter.Conversion’.
2. ‘Transform.ContentType’ and value is ‘text/xml;charset=utf-8’.
3. ‘xml.conversionType’: Specify the conversionType here (structXML2Plain, structPlain2XML, simpleXML2Plain, simplePlain2XML ).
4. ‘xml.recordsetStructure’: Here we need to specify structure of EDIFACT structure e.g: ISA,GS,ST,BGN,DTP,N1,INS,REF,DTP,NM1,PER,N3,N4,DMG,HD,DTP,SE,GE,IEA
Remaining parameters are same like File Content Conversion parameters.
e.g: xml.segmentname.fieldSeparator
Xml.addHeaderLine
Module Key Parameter Name Parameter Value
Key Transform.Class com.sap.aii.messaging.adapter.Conversion
Key Transform.ContentType text/xml;charset=utf-8
Key xml.BGN.fieldSeparator *
Key xml.DMG.fieldSeparator *
Key xml.DTP.fieldSeparator *
Key xml.DTP.fieldSeparator *
Key xml.GE.fieldSeparator *
Key xml.GS.fieldSeparator *
Key xml.HD.fieldSeparator *
Key xml.IEA.fieldSeparator *
Key xml.INS.fieldSeparator *
Key xml.ISA.fieldSeparator *
Key xml.N1.fieldSeparator *
Key xml.N3.fieldSeparator *
Key xml.N4.fieldSeparator *
Key xml.NM1.fieldSeparator *
Key xml.PER.fieldSeparator *
Key xml.REF.fieldSeparator *
Key xml.SE.fieldSeparator *
Key xml.ST.fieldSeparator *
Key xml.addHeaderLine 0
Key xml.conversionType StructXML2Plain
Key xml.recordsetStructure ISA,GS,ST,BGN,DTP,N1,INS,REF,DTP,NM1,PER,N3,N4,DMG,HD,DTP,SE,GE,IEA
StructPlain2XML: This Message Transformation Bean converts plain text file into PI XML format.EDIFACT transaction structure needs to map to the PI XML structure which can be done via configuration.
StructPlain2XML is used when each row in input file has different structure.
SimplePlain2XML: This Bean also converts plain text file to PI XML format.
SimplePlain2XML is used when all the rows in input file has same structure.
Example of using Message Transformation Bean in Inbound Scenario:
Configuration for StructPlain2XML is very similar to StructXML2Plain except that conversionType and some parameters differ.
conversionType here will be StructPlain2XML in case of complex structures and SimplePlain2XML in case of simple structures.