Sending a IDOC to the same client in a SAP system
Sometimes we have a requirement to send the IDOC to the same client of a SAP system. This is mainly required in testing, when the destination system or any client has not set up yet and available to use.That means, e.g. if an outbound IDOC is generated from client 270 of sap server ID1, then the inbound IDOC will be coming to the same client 270 of server ID1. To achieve this, no change is required in the program for sending IDOC and receiving IDOC but we need to implement some configuration steps which I am showing below –
Step 1-Create logical system for sender and receiver
Login to client ID1/270 and execute transaction code SALE and the following screen is displayed. Please choose “Define Logical System” as shown below –
Most of the time, the logical system for a particular client is already configured by BASIS, i.e. if the client is ID1/270, then a logical system named ID1CLNT270 will be there automatically. We will use this logical system as sender. Please create a new logical system called ID1270RCV that will be used as receiver.
Step 2- Create port
Execute transaction code WE21 and create a new port as transactional RFC like below. Beside please input RFC destination as the system ID which is ID1 in this case. In every system normally a RFC destination with the name of system ID is available under connection type 3(ABAP connection). And actually this is the trick behind to achieve this requirement as this RFC destination is actually is pointing to the same system/client.
Step 3- Create partner profile
Execute transaction code WE20 and create the following partners of type LS (logical system).
- Create partner ID1270RCV as a receiver. Please note here the name chosen is same as the logical system name.
Enter the port created in step2 in the outbound message configuration.
2. As we are going to receive the IDOC in the same client, so we need to create another partner ID1CLNT270 which was the sender. The process to create this will be same and here we need to enter details for the inbound message configuration. This can be done later after defining process code.
Step 4-Create distribution model
Execute transaction BD64 and go to change mode. Then create a new model view and give the sender, receiver and message type. Here I have created a model view ZACCDOC for that.
After that we need to do the necessary configuration for inbound IDOC. In short, we need to perform the following steps. I am not going into this in detail as this is normal steps that are followed in any inbound IDOC configuration.
And we are done! Once the program to trigger the outbound IDOC is executed, automatically the inbound IDOC gets created in the same client that gets the immediate next IDOC number. Here in the following screen, after the outbound IDOC 1023 is generated the inbound IDOC 1024 has been created.