IDOC or Intermediate Documents are commonly used in case of data migration between SAP systems or between SAP and legacy system or vice versa.This blog details the steps involved in configuring a new IDOC and also list’s down the various transactions that are used while working with IDOCs.
IDOCs can be classified into two . Inbound IDOCs and Outbound IDOCs.
Inbound IDOC : These are IDOCs which get the data into SAP system from external source i.e PI system or any other external system.
Outbound IDOC: These are IDOCs which are sent out from SAP system to any other system. i.e PI system or any other external system.
Step 1 : We need to check the RFC connections to the target system , it can be PI system or any external system. If it is to a PI system then we need to check the connection under ABAP connections in SM59 transaction and for external system under HTTP Connections to External System.
Step 2: Create a port in transaction WE21 which shows the target system’s RFC destination.
Step 3 : In transaction WE20, create a partner profile and mention the message tpe details .In case of Oubound IDOC’s , mention the message types under Outbound Parameters.In case of Inbound IDOC’s , mention the message types under Inbound Parameters. For outbound parameters ,maintain port and IDOC details, because port describes to which system the IDOC has to flow. Whereas in Inbound IDOC,mention the process code details which determines the inbound function module for processing the data.
Step 4 : Message type SYNCH is the default message type for outbound parameters. Choose a particular message type and maintain the below settings. Under the receiver port mention the port created in transaction WE21. In Output mode, choose Transfer IDOC immediately. In IDOC type mention the IDOC associated with the Message Type.
Step 5: For Inbound IDOCs, mention the process code as APL1 and choose option Trigger Immediately under Processing by Function Module.
Step 6 : In transaction BDFG, we can see which ALE function module we need to enhance for our requirement. In case, we are working with Business Partner we can choose the FM as CRMXIF_PARTNER_SAVE and the Business Object Type as ‘BUS1006’. In IDOCs , SAP by standard provides us to exchange the business partner master data details , BP relationships and BP Hierarchies.
Step 7: In case we are working with Business Transactions we can choose the FM as CRMXIF_ORDER_SAVE and the Business Object Type as ‘BUS20001’.
Step 8 : In our example let us work upon Business Partners. Select the FM name and the Business Object type and click enter. By default all standard messages types would be displayed out.Now to create a new message type , click on Create button as shown below. You will get a popu where in you can enter a Z name.
Step 9 : Once the Z message type is created. Release it as shown.
Step 10 : Select the Z message type and click on the Display button to view the details.
Step 11 : With Z Message Type , Z FM’s for both Inbound and Outbound gets created.
Step 12 : In transaction WE30 we can check the IDOC created.
Step 13 : In transaction WE31 we can check the IDOC segment .
Step 14 : For Inbound IDOCs in transaction code WE42 , select the process code APL1 and click on display . Assign a Z Fm-ZAPPL_IDOC_INPUTI . Create a copy of the standard FM APPL_IDOC_INPUTI into ZAPPL_IDOC_INPUTI .
Step 15 : Under Logical Message , mention the Z message type created.
Step 16 : In transaction WE81 , we can see the message type details.
Step 17 : In transaction WE82 , we can see the message type and basic type details.
Step 18 : For outbound IDOCs in transaction BD64 , create a distribution model. Goto change mode and click on ‘Create Model View‘. Enter a description and Technical name.
Step 19 : Add the message type under the Distribution Model and maintain the sender and receiver system details.
Step 20 : In transaction BD82, generate the partner profile for the newly created distribution model.
Step 21 : In transaction SMOEAC , we create the sites and subscriptions.Site is the destination where the data needs to be sent. Subsricption is to identify what is the object to be exchanged. (In case of BP data it will be All Business Partner MESG).Subscriptions are assigned under Sites. Type would vary based on our need.
Step 22 : In transaction CRMXIF_C1 , we maintain the message type details against the Site name.
Step 23 : We can even restrict an Outbound IDOC flow based on any condition to a particular Site. A times there could be multiple sites in a system , we can control the flow of IDOC here as well.This can be achieved by maintaining an entry in table – SMW3FDCUST, we assign a copy of standard FM – SMW3_OUTBOUNDADP_CALLADAPTERS against BDoc Type BUPA_MAIN, which is used to do any further customizations. We can do the same for other IDOC types.In the Z FM ,input parameter HEADER we get the Site ID details , based on that we can control the changing parameter – RECEPIENTS.
Step 24 : Apart from the above steps we can use Transaction WE02/WE05 to display any IDOC and WE60 for IDOC Documentation.To reprocess any IDOC use transaction WE19 adn inoput teh IDOC number, a new number gets generated.
Step 25 : Any IDOC has 3 records types – Control, Data and Status.Control Records displays the direction of the IDOC, message type/basic type details.
Data record display the data under multiple segments. In Status Record we can check the IDOC status whether it is a success or failure.
Tables for these 3 record types are as below.
Control Record – EDIDC
Data Records – EDIDD
Status Record – EDIDS