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









hi, riyaz
thanku for suggistions
Hi Riyaz,
I’m learning ALE/IDOC handling (via PI) and found your detailed documentation very helpful !
… the only thing I stuck now in the middle is in part III…
… … here it’s not clear for me which Server/Port/RFC-Dest./Partner should be configured on inbound system
.. … your info ‘…refer to Outbound Settings … ‘ is not helpful for me because
=> which system is addressed ?
a) could not be the same as out of first system :-(
b) but in inbound system configuring outbound system (root) … what for ? make it sense?
b) if root system has to be configured … do you mean PI (relative) or first system (real root of IDOC) ?
Thanks Rudolf
Hi Riyaz,
I’m learning ALE/IDOC handling (via PI) and found your detailed documentation very helpful !
… the only thing I stuck now in the middle is in part III…
… … here it’s not clear for me which Server/Port/RFC-Dest./Partner should be configured on inbound system
.. … your info ‘…refer to Outbound Settings … ‘ is not helpful for me because
=> which system is addressed
Hi Riyaz,
I follow your instructions as well as “SAP interface programing (Wegelin-Englbrecht)” in order to set up tRFC exchanges between SAP an non-SAP systems. As you can see details below, I have done many settings in order to receive Idoc. Every feed-back is OK, but I do not get applicative data ! Do you know some useful transactions which could help me debugging ? Thanks.
Details :
An SAP-client application has to send Idoc to a C server application with ALE protocol. C-server is built based on rfcsdk library.
SAP settings done :
- structure and datas tables (SE11, SE14, SE16)
- Idoc, header et datas (WE30, WE31)
- message types (WE81, WE82)
- logical systems (SALE), destinations (SM59) and partner type (WE20)
- 2 port types (WE21) : tRFC et file
- partner profile generation : BD82
C-server settings :
- saprfc.ini settings (avec mode trace)
- communication initialisation with RfcAccept()
- transactional callback definition with RfcInstallTransactionControl()
- applicative callback definition for “IDOC_INBOUND_ASYNCHRONOUS” with RfcInstallFunction()
- requests management with RfcDispatch() in an endless while(RFC_OK)
Test steps :
- C-server launching : connection is accepted by SAP-client (every rfcsdk function return RFC_OK), RfcDispatch wait for a request,
- ABAP program launching : ALE_MODEL_INFO_GET finds destination,Idoc generation is done, MASTER_IDOC_DISTRIBUTE is called, feed-back OK,
- Idoc dispatch with RSEOUT00 => many selected Idoc
- Idoc status with WE02 let see status from 30 to 03 for the Idoc and the two defined ports.
Results :
- on SAP-client, a file with Idoc content defined in datas tables is created following port File definition. Applicative data are received.
- C-server, RfcDispatch ends without error and start again, none of the defined callbacks (from RfcInstallTransactionControl and RfcInstallFunction) are called. No applicative data are received.
Question :
- why no callback is called ?
- which transactions could help me to debug ?