Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor

One fine day, one of my friends(who is new to PI) came to me and asked if we can convert any Idoc xml to Idoc flat file in SAP PI. At that time, I was sure that it could be achieved by using ABAP mapping because through ABAP mapping I can access and use the Idoc metadata which is loaded in Idoc cache IDX2. However, I wasn't sure if we have any standard way or I would say better and easy way to do it.

Therefore, I have searched if we can convert Idoc xml to Idoc Flat file or vice-versa in SAP PI without using ABAP mapping. At that time, I came across following two new standard adapter modules available from SAP PI 7.11 that we can use when we work with Idocs. It fulfils above mentioned requirement.

  1. IDOCXmlToFlatConvertor – Converts Idoc xml file to Idoc flat text file
  2. IDOCFlatToXmlConvertor – Converts Idoc flat text file to Idoc xml file

In this blog, I will explain how to use IDOCXmlToFlatConvertor adapter module and what is the pre-requisite setting needs to be done for it.

  1. Create a RFC destination.
  2. Create a JCA Connection Factory in NWA.
  3. Add the Parameters in the Module Configuration of receiver Adapter (here File Adapter).

Create RFC Destination from NWA:

     Create the RFC destination from NWA pointing to the SAP system where Idoc metadata (structure) is available.

     Go to Configuration --> Infrastructure --> Destinations

    1. Create a new destination of type RFC Destination:

          Provide all the required details such as:

Step 1Hosting SystemSAP PI SID
Destination NameAny self explanatory Name
Destination TypeRFC Destination
Step 2Target HostHost Name/IP Address
System No.As per ECC system
System IDAs per ECC system

Step 3

AuthenticationTechnical User
ClientAs per ECC system
UserUser in  ECC system

Create a JCA Connection Factory in NWA:

Go to Configuration Management > Infrastructure > Application Resources.

  • Choose All JCA Resources from the Show field.
  • Under the Resource Name column, choose SAPJavaResourceAdapter15.
  • Under Resource Details, select Dependent JCA Connection Factories and Copy & Add new JCA Connection Factory.
  • Enter the JNDI Name.
  • Select and set the Configuration Properties.

Provide all the required details such as:

SAPClient, User, Password, Language, Server, Port (System No.)

Create a Receiver Channel (File Receiver):

Go to Module Tab of Communication Channel.

     Add Adapter module with following details:

    • Module Name as SAP_XI_IDOC/IDOCFlatToXmlConvertor before the CallSapAdapter Module.
    • Module Type as Module Type as Local Enterprise Bean.
    • Enter the Module Key

     Add Parameters to Module Configuration as follows:

Parameter Name
Parameter Value
SourceJRAJRA created in Step 2
TargetDestinationRFC Destination created in Step1

We have executed scenario where an ORDERS05 Idoc was sent to from ECC to SAP PI. Idoc was converted to Idoc xml by Idoc adapter and sent to IE.

We have received Idoc flat file once Idoc xml is passed through File Receiver Channel that we have configured.

In the same way one can implement IDOCFlatToXmlConvertor adapter module to get Idoc xml from Idoc flat file. Following are SAP help references.

Adding IDOCXmlToFlatConvertor in the Module Processor –

Adding IDOCFlatToXmlConvertor in the Module Processor –

Labels in this area