Skip to Content

multiple idocs to file

Author : Chandana wijetunga

This document covers the basic steps that are to be followed in BPM for collecting multiple IDOCs and sending it in form of flat file.

SCENARIO

For ease of documentation we take following paradigm:
Assume that we have three different type of IDOCs

ISU_UKGAS_NOM1
ISU_UKGAS_NOM2
ISU_UKGAS_NOM3.



Our NOM1 type IDOC has the following structure :

NOM2 type :



NOM3 type :



First of all create the idocs in the R/3(source) system and then import the idoc to the IR(Design)

  • Goto your SWCV,under that u can see imported objects
  • Expand that ,under that click on idocs and select import IDOC
  • U will be opened with a wizard,just press continue and then in the third step select the idocs u want  to import and then cliock finish.

The Step by Step process for collecting the IDocs to be sent to a single file is stated as below:

Step 1:
First of all we have to create Data type for the flat Receiver as shown in figure:



Step 2 :

Then create Message Type for Target Data: MT_NOM

Step 3 :
Create three Message Interface of type Abstract Asynchronous for the IDOCs and two for the File as follows:
MI_ISU_UKGAS_NOM1_ABS (Abstract Asynchronous) (Use MT: ISU_UKGAS_NOM1)
MI_ISU_UKGAS_NOM2_ABS (Abstract Asynchronous) (Use MT: ISU_UKGAS_NOM2)
MI_ISU_UKGAS_NOM3_ABS (Abstract Asynchronous) (Use MT: ISU_UKGAS_NOM3)
MI_NOM_ABS (Abstract Asynchronous) (Use MT: MT_NOM)
MI_NOM_IB (Inbound Asynchronous) (Use MT: MT_NOM)

Step 4:

Create three Message Mapping to convert Outbound type of IDOC into Abstract type so that we can collect it in our BPM. Message Mapping for conversion of three different types of IDOCs to their Abstract type are as follows:
ℹ MM_ISU_UKGAS_NOM1_to_NOM1_ABS
(ii) MM_ISU_UKGAS_NOM2_to_NOM2_ABS
(iii) MM_ISU_UKGAS_NOM3_to_NOM3_ABS

SOURCE

TARGET

ISU_UKGAS_NOM1

MT_NOM

ISU_UKGAS_NOM2

ISU_UKGAS_NOM3

Below mapping is for N:1 transformation. (Here input will be having three different types of Abstract IDOCs and target will be having Abstract Target File type)
(iv) MM_ISU_UKGAS_NOM_to_NOM_ABS

Step 5:

Create the Interface Mapping as follows.

(a) Interface mapping for IDOC outbound to IDOC abstract.
IM_ISU_UKGAS_NOM1_to_NOM1_ABS (Message Mapping ℹ is used here)
IM_ISU_UKGAS_NOM2_to_NOM2_ABS (Message Mapping (ii) is used here)
IM_ISU_UKGAS_NOM3_to_NOM3_ABS (Message Mapping (iii) is used here)
(b) Interface mapping for collected IDOCs of Abstract type to the file of Abstract Asynchronous type.
IM_ISU_UKGAS_NOM_to_NOM_ABS (Message Mapping (iv) is used here)

Step 6 :
Create the Integration Process to Collect IDOCs of different types to one place and after the specified time interval it will be posted to one flat file in some specific format.

Let see the step by step BPM formation for collecting multiple IDOCs:

Step 6.1 :
First of all create Container content as:

CollectNOM1 is used to retrieve Abstract form of IDOC type NOM1.

CollectNOM1list is used to collect the IDOC of type NOM1, and so we have set its Multiline as true.

Same way for IDOCs of type NOM2 and NOM3 we defines the container items as CollectNOM2 and CollectNOM3 respectively.

For collecting them we again define CollectNOM2list and CollectNOM3list of type NOM2 and NOM3 respectively with their Multiline property as true.

Step 6.2 :
As we are going to collect three different types of IDOCs in our BPM, we specify the Correlation as follows:
Let us name it as CorrFileType

In the Correlation editor , we specify Correlation Container, Involved Messages and Properties.

We set the value in Properties as follows:
Specify correlation field in XPath option. E.g here we are selecting the FILE_TYPE as our Correlation field.
Once we select the field we find the XPath Expression at bottom as shown in figure.

Same way select the Correlation Field for all three IDOC types. And after selection of values we can observe our Properties screen as exposed below:

Step 6.3 :
Now it is time to toil with graphical editor. First step is to add Block step to our BPM.


Set Properties of Block step as follows:
Give some Exception name in Exception Property. E.g TimeOut

Step 6.4 :
Add EXCEPTION Step to BPM. We can insert this step by Right clicking on Block and then select the Insert option of menu and then select Exception Branch option of submenu. The menu looks like as shown in figure below:

After adding the Exception Block we have to set its Properties as shown in figure below:
(TimeOut is Exception name which we have given in our Block step)

Step 6.5 :
Add DEADLINE Step in BPM. It can be added by selecting the Deadline branch submenu from the menu option “Insert of Block” .
It will look like as in figure below.


Set Properties of Deadline Step as follows:
We have to specify the DURATION property which depicts the time for which the block processing will be done. (e.g 2 Minutes in our example).



Step 6.6 :

As in our paradigm, three different types of IDOCs going to be collected in BPM, so we add FORK step in our BPM as exposed below:

Set the Properties of Fork step as follows:
As we need to have three different branches in our fork, we set the NECESSARY BRANCH property as 3 as shown in figure below.


Step 6.7 :
We need to collect each type of IDOCs for some time duration (one which we have specified in our deadline step). So we add LOOP step in our fork branch, which enables to collect IDOCs for specified time duration. Our BPM looks like:


Step 6.8 :
To receive IDOCs into BPM we insert RECEIVE step (as shown below). This will receive IDOC of NOM1 type.


We set the Properties of Receive as follows:
Message property defines, what type of data is going to receive by the RECEIVE step. As shown in figure below, we have selected CollectNOM1, as this Receive step will use to collect NOM1 IDOCs. Second property we set here is the correlation; here we give name of correlation (CorrFileType) which we have created in beginning.


Step 6.9 :

Add CONTAINER Operation step in our BPM(as shown in figure below). This Step facilitates collection of IDOCs which the Receive1 step has collected.

Set Properties of CONTAINER as follows:
In Target Property we specify the name where we want to collect our IDOCs.
As shown in figure below we are selecting CollectNOM1List which is of Abstract type and whose Multiline property we have set as true.
Operation Property is used to define the operation we want to perform. Here as we want to append each newly coming IDOC, we are setting its value as APPEND.
Third property which we set here is Expression which will specify the type of IDOC going to be collected by the CONTAINER. Here our container will be collecting the NOM1 type of IDOC so we specify Expression as CollectNOM1 which is again of the Abstract type of IDOC.

Next…

http://scn.sap.com/people/chandana.wijetunga/blog/2012/04/23/step-by-step-multiple-idocs-to-file-2


To report this post you need to login first.

2 Comments

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

Leave a Reply