I could see that there are lot many Wikis on ALE Idocs and their configuration. Now, I thought of explaining the way of handling the acknowledgements forthe custom generated Idocs.
Note: I took an example custom Idoc which has already been developed to explain the concept of handling Acknowledgements. I am providing the necessary details here before proceeding to the actual concept
Sender System : BANGSEND
Recieving System : HYDRECIEVE
Message Type : ZEMP84364_MNT_RPT
Basic Type : ZEMP84364_MNT_RPT01
Functionality of the Idoc : Transfers the records created with the help of a report program and updates the database table of the target system.
For this scenaio, now we are going to see how we can handle the acknowledgement.
ALE Configuration for Idoc Acknowledgement:
Sender creates an Outbound Idoc and this particular Idoc is received by the receiver as an Inbound Idoc and receiver system processes the Idoc, it updates the database tables. Now, Sender system would never know what happened to the document that it has passed to the receiver. So, to make sure that the receiver had posted the application document in the necessary database tables, we would need an Acknowledgement.
ALEAUD is a standard message type through which we can achieve this functionality. Now, we need to update the settings for ALEAUD message type in both sender and receiver systems.
Add ALEAUD message type in the outbound parameters for the partner BANGSEND. Now, this particular Ack Idoc would behave as an outbound Idoc from the receiver system of the actual Idoc to the sender system of the actual Idoc.
The settings after adding the ALEAUD Idoc in the outbound parameters in the above screen is shown below.
This is the place where we are using the port that we have created in the receiver system.
Note: Select the Output mode as Transfer Idoc immediately (Though it is optional, you can collect all the Idocs and process them using a job). Save the screen.
Now, make similar settings in the sender system. As, HYDRECIEVE is the partner for the BANGSEND system, you would receive the Acknowledgement Idoc as inbound in the BANGSEND system. So, add the ALEAUD message type in the Inbound parameters of the partner HYDRECIEVE as shown below.
The actual process code settings that we need to do after adding the message type ALEAUD in the inbound parameters is shown below
Since you are using the standard message type, no need to write a function module to process these Ack Idocs. Even the process code that we are using is a standard one.
Now, you need to create Distribution model in the receiver system for these ALEAUD Idocs
Below screen shows that, HYDRECIEVE system is going send ALEAUD Idocs to the BANGSEND system with the distribution model name MODEL_ACKS which we have not yet created.
Save the screen now which is very important
To generate partner profiles, go to the menu Environment and click on Generate Partner Profiles and execute the below screen.
After executing the above screen you would see that the partner profiles created. Items marked in the green color are the ones which are created automatically.
A standard message type SYNCH always gets generated and you can check the same in the partner profiles.
Now, once you are done with the above you need to distribute the distribution model with the partner system by clicking on the menu Edit -> Model View -> Distribute
Click on Ok and the distribution model is shared with the partner system as shown in the next screen.
Click on OK.
Testing the Idoc by running the Application Program:
Go to the Sender system, execute the Application Program (ABAP Program) and enter the selection screen the details as shown below.
Now execute the above screen and you would see the output saying the Idoc number generated as shown below
Now, Go to WE05 transaction and see the above Idoc.
In the above screen the very last one is the Idoc that has been created now. Let us open the Idoc and verify the contents as shown below.
In the above screen, the final status of the Idoc is 03. It means that, the Idoc has gone to the destination system. But, we do not know whether the Idoc has been processed there or not. Now, let us go to the target system and check whether this particular Idoc has been converted in to an Inbound Idoc to get posted in the target database.
Execute WE05 transaction in the target system and see the Idoc. Based on the time, the last Idoc that has been processed should be the Idoc that has been created. The Idoc is selected for the reference.
Let us open the Idoc and see whether the contents of the Outbound Idoc of Sender are same as the contents of the Inbound Idoc in the target system.
You can see that content of the Idoc is same and as the status of the Idoc is in 53, we can confirm that the Idoc has been posted in the target database.
Let us verify that by opening the database table in the target system.
We can see that the record has been updated in the target database.
This ends the Idoc posting.
But, in the view of Sender as the Outbound Idoc is in 03 status, Sender would never know what happened to the Idoc in the target system.
So, in production environment generally a job is set to run periodically which has the program RBDSATATE with the variant SAP_AUDIT_SEND to send the audit data back to the Sender from the target system.
In our case, let us run the job manually to send the Audit data back to the sender system
The job has finished and the spool shows that there is an Idoc with the message type ALEAUD that has been generated as shown below.
Now, go to the Sender system and check the status of the Idoc it should have been changed to 41(Final Status of any Outbound Idoc) as the Idoc has been posted successfully here in the target system.Go to sender system and open WE05 transaction.
In the above screen, you can clearly see that all the Idocs have been changed to the status 41. You can see the same for our Idoc in the below screen.
This ends the way of handling Idoc Acknowledgements.