In the previous parts we learned how to create a custom IDoc and set up the source system to send an outbound IDoc. In this part we will learn how to configure the receiving SAP R/3 system to be able to receive and post the inbound IDoc.
Inbound IDoc Posting Function Module
In the receiving system, create a function module Z_IDOC_INPUT_ZRZSO_MT using SE37. Below, I have described the logic for the same.
Add Include MBDCONWF. This include contains predefined ALE constants.
Loop at EDIDC table
- Check if the message type is ZRZORDER. Otherwise raise WRONG_FUNCTION_CALLED exception
- Loop at EDIDD table
- Append data from the segments to appropriate internal tables
- For example: append data from ZRZSEG1 segment to the internal table of type ZCUSTOMERS
- Update the DDic tables from internal tables
- Depending on the result of the update, fill the IDoc status record (type BDIDOCSTAT) and append it to the corresponding table.
- Status 53 => Success
- Status 51 => Error
You can download the sample ABAP code for the above function module here.
Inbound Settings
- Define Logical Systems – Transaction SALE (Please refer to Outbound Settings discussed in previous part)
- Assign Client to Logical System – Transaction SALE (Please refer to Outbound Settings discussed in previous part)
- Maintain RFC Destinations – Transaction SM59 (Please refer to Outbound Settings discussed in previous part)
- Define Ports – Transaction WE21 (Please refer to Outbound Settings discussed in previous part)
- Generate/Create Partner Profile – Transactions BD82/WE20 (Please refer to Outbound Settings discussed in previous part)
- Assign Function Module to Logical message – Transaction WE57
- Create a new entry
- Specify name of the Function Module as Z_IDOC_INPUT_ZRZSO_MT
- Also, specify Type as F, Basic IDoc type as ZRZORDER, Message type as ZRZSO_MT and Direction as 2 (Inbound)
- Save the entry
- Define Input method for Inbound Function Module – Transaction BD51
- Create a new entry
- Provide Function Module name as Z_IDOC_INPUT_ZRZSO_MT
- Specify the Input method as 2
- Save the entry
- Create a Process Code – Transaction WE42
- Create a new Process Code ZPCRZ
- Select Processing with ALE Service
- Choose Processing type as Processing by function module
- Save the entry
- On the next screen, select your function module from the list
- Save the changes
- Now you will be taken to the next screen
- Double-click on Logical message
- In the Assignment to logical message, specify the message type ZRZSO_MT
- Save the changes
Send and receive data
On the sender system, execute the IDoc Generation Program. Check the status of IDoc using transaction WE02.

Check the status of the IDoc in the receiver system using transaction WE02. You can also check the contents of DDic tables to make sure that the records have been created in the receiver system.

Thus to summarize we have learned how to:
- Create a custom IDoc
- Write an Outbound IDoc Generation Program
- Write Inbound Function Module to post Inbound IDoc
- Configure and test ALE scenario to transmit data between systems distributed across the network




After checking out a number of the blog articles on your website, I truly appreciate your
technique of writing a blog. I book-marked it to my bookmark
website list and will be checking back in the near future.
Please check out my web site as well and tell me how you feel.
Hi Riyaz,
I am working on an IDOC for the first time and hence would like you to clarify on one thing.
In this tutorial for inbound IDOC FM, you are not using the FMs to open edit and close the idoc. Can you explain me why and also the what is the importance of those FMs if it is not mandatory to use them.
Hi Riyaz, i had been suddenly assigned some interface related work as other co-workers in europe went on vacation.
i do not have much experience and previous experience on idocs, but thanks to your tutorials i got a brilliant introductory idea and then with some more reading from SAP sources and sites; i got running and delivered the objects.
Thank you very much :) and wish you a very happy new year.
Regards,
Prasenjit Singh Bist
Dear Riyaz,
I am working on a project on SAP Retail. My requirement is In B2B we need create Pur order Idoc (Outbound)Idoc, Pur confirmation (Inbound ) and Inbound delivery Idoc (ASN). I would appreciate if you can share any document on this.
Thanks
Aarif Mohiuddin