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.
Article snippet courtesy of Riyaz. Read the full article at http://www.riyaz.net/blog/beginners-guide-to-ale-and-idocs-part-iii/








