Tuesday, March 03, 2009

Sending an IDoc to your system via loop back logical system

Why would you need to have a loopback system when you can just post an IDoc using the functional module IDOC_WRITE_AND_START_INBOUND. Because we want to use BAPI to post this IDoc. The transaction BDBG creates a function module for Outbound ALE for sending IDoc against a BAPI structure (it also creates the relevant IDoc messages). If you want to use this function module (naming convention is something like ZZ_ALE*) then you need to have some sort of loopback mechanism. In the parameters of this ALE FM you just give the receivers details. It will automatically fill your own system details as the sender and sets the direction as outbound for the IDoc it creates. Now you want this IDoc to return back to your system to be processed by the BAPI that you have created. The following list the steps to create a logical system that is pointing to itself. There is however a drawback to this approach. You will get two IDocs, one going out and one coming in.

Create loop back RFC destination called INTERNAL via the transaction SM59. It has to be of type Logical Connection (L). It will refer to entry NONE which is an automatically created entry referencing itself.




Create a logical system INTERNAL via transaction BD54

Create a port for this logical system via transaction WE20


Go to transaction BD64 to create model for this loop back scenario using
your required message type



Generate profile for this model via transaction BD82. This will create
outbound message profile


 



Manually add inbound profile for the message type



That’s it.

Reference

No comments: