Search This Blog

Thursday, December 15, 2011

File to Multiple IDOC Splitting without BPM


File to Multiple IDOC Splitting without BPM

In a very typical business case we need to generate multiple IDoc instances from the same incoming message having multiple IDoc record data set. It will save the processing overhead of executing the scenario for every IDoc record seperatly.Hence mass data processing will be achieved. Moreover it will also save the processing overhead of using BPM. 
As we know that File to Multiple IDOC scenarios can be very easily achieved with BPM.
Here i am describing the steps to achieve the same scenario without BPM, because using BPM in some cases may cause performance issue. 
Step 1:
       Create one custom IDoc in your R3 side or plan to use one standard or existing IDoc in your R3.
For this scenario I have created a custom IDoc CUSTOM_IDOC.ZRECORD 
Step 2:
       Now import that IDoc into Integration Repository under imported objects.
   


 
Step 3:       Now create the Data Type,Message Type and Outbound Message Interface for the source side. 
Data Type:
Message Type:
  
Message Interface:
 

 
Step 4:      Now since our target side is IDOC we will use the XSD from the imported IDOC to create an External Definition for our target side. 
Note:   before importing the XSD into external definition change the maximum occurance of the "IDOC" element in XSD to unbounded. 
Step 5:      Now we need to create the Message Mapping betwwen the source and target structure.
Here the mapping is in such a way so that for every Record in source payload one IDOC is created in target.
   

 
Step 6:       Now create the interface mapping.
Source Interface:   Outbound Message interface(File_Source)
Target Interface:    Actual IDoc Interface(CUSTOM_IDOC.ZRECORD)
 
 
   
Now in Integration Directory we will configure our scenario. 
Step 7:       Create communication channels for File Sender and IDoc Receiver.
 Sender Communication Channel:
   
 
Receiver Communication Channel:
  
Note: in your XI Box create a RFC destination pointing to the R3 instance where you want to post the idocs and a Port for IDoc adapter containing that RFC destination. 
Step 8:       Create collaboration agreement objects for Sender and Receiver communication channels.
Sender Agreement:
   
 
Receiver Agreement:
   


 
Step 9:       create the Logical Routing objects(Interface Determination and Receiver Determination)
Interface Determination:
   
 
Receiver Determination:
   

 
Now let us execute the scenarion. 
Step 10:     place the source payload in the path specified in the sender communication channel(in our case the path is /tmp/SOURCE.XML).
let us consider the following payload is placed in the source path.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:FILE_SOURCE xmlns:ns0="XMLnamespace">
   <Records>
      <EMP_ID>0001</EMP_ID>
      <NAME>Rajnarayan Chaturvedi</NAME>
      <DESIGNATION>C</DESIGNATION>
      <DEPARTMENT>SAP</DEPARTMENT>
      <CONTACT_DETAILS>
         <ADDRESS>Kolkata</ADDRESS>
         <PHONE>6352638843</PHONE>
      </CONTACT_DETAILS>
      <CONTACT_DETAILS>
         <ADDRESS>Kolkata</ADDRESS>
         <PHONE>6283034744</PHONE>
      </CONTACT_DETAILS>
      <CONTACT_DETAILS>
         <ADDRESS>Delhi</ADDRESS>
         <PHONE>7568393633</PHONE>
      </CONTACT_DETAILS>
   </Records>
   <Records>
      <EMP_ID>0002</EMP_ID>
      <NAME>Dilip Agarwal</NAME>
      <DESIGNATION>CA</DESIGNATION>
      <DEPARTMENT>Finance</DEPARTMENT>
      <CONTACT_DETAILS>
         <ADDRESS>Mumbai</ADDRESS>
         <PHONE>8374652134</PHONE>
      </CONTACT_DETAILS>
      <CONTACT_DETAILS>
         <ADDRESS>Delhi</ADDRESS>
         <PHONE>7463534478</PHONE>
      </CONTACT_DETAILS>
      <CONTACT_DETAILS>
         <ADDRESS>Gujrat</ADDRESS>
         <PHONE>8373645465</PHONE>
      </CONTACT_DETAILS>
   </Records>
   <Records>
      <EMP_ID>0003</EMP_ID>
      <NAME>Ram Singh</NAME>
      <DESIGNATION>C</DESIGNATION>
      <DEPARTMENT>SAP</DEPARTMENT>
      <CONTACT_DETAILS>
         <ADDRESS>Kolkata</ADDRESS>
         <PHONE>7363542109</PHONE>
      </CONTACT_DETAILS>
      <CONTACT_DETAILS>
         <ADDRESS>Bangalore</ADDRESS>
         <PHONE>7363542222</PHONE>
      </CONTACT_DETAILS>
      <CONTACT_DETAILS>
         <ADDRESS>Chennai</ADDRESS>
         <PHONE>8476001093</PHONE>
      </CONTACT_DETAILS>
   </Records>
</ns0:FILE_SOURCE>

Start the sender communication channel(if stopped before) from RWB. 
Goto tcode SXMB_MONI in your XI Box for monitoring the processed XML Messages.
   

 
Now login to you R3 system to see the idocs are successfully posted.
  
As you can see 3 IDocs have been created because we have 3 records in our source payload.
Now in the Data Records of each IDoc you can see the values that present under each Record of the source payload.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.