Skip to Content

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 1 Hosting System SAP PI SID
Destination Name Any self explanatory Name
Destination Type RFC Destination
Step 2 Target Host Host Name/IP Address
System No. As per ECC system
System ID As per ECC system

Step 3

Authentication Technical User
Language EN
Client As per ECC system
User User in  ECC system
Password Password

RFC Destination Capture.JPG

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

JRA Configuration Capture.JPG

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
SAPRelease 640/700/710
SourceJRA JRA created in Step 2
TargetDestination RFC Destination created in Step1

CC Adapter Module Tab Capture.JPG

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.

Idoc xml Capture.JPG

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

Flat File Capture.JPG

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 –

http://help.sap.com/saphelp_nw73/helpdata/en/74/A45BC07E2043FB9B63295229178903/frameset.htm

http://help.sap.com/saphelp_nwpi711/helpdata/en/74/A45BC07E2043FB9B63295229178903/frameset.htm

Adding IDOCFlatToXmlConvertor in the Module Processor –

http://help.sap.com/saphelp_nw73/helpdata/en/b5/bd93642dd3410f90ebea702399fac4/content.htm

http://help.sap.com/saphelp_nwpi711/helpdata/en/b5/bd93642dd3410f90ebea702399fac4/frameset.htm

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Rafael Vieira

    Nice feature, Samiullah.

    However, I didn’t get why you have said “Module Name as SAP_XI_IDOC/IDOCFlatToXmlConvertor ” instead of using “IDOCXmlToFlatConvertor“.

    In the adapter, however, you’ve used XmlToFlat, which makes more sense if you consider that the result was a flat file.

    (0) 
  2. Ramanji Killani

    Hi Sami,

    I am working with the scenario of converting IDOC Flat file to XML. I have done with the development of custom adapter module. The custom module is giving me the right result. But when I am adding the SAP_XI_IDOC/IDOCFlatToXmlConvertor adapter bean, sender channel is giving me the following error:

    Capture5.JPG

    Could you please suggest me the work around.

    Thanks in Advance,

    Ramanji Killani.

    (0) 

Leave a Reply