Generate LOIPRO IDOCs at the time of creating a Production order.
We have a Standard Transaction code POIM to transfer the information of a production order.
But we need to send the Order information at the time of creation of the Order in COR1 transaction.
Hence we are going for an enhancement option where the standard program to trigger the IDOC is called.
We are using the following BADI implementation to trigger the IDOC.
BADI: WORKORDER_UPDATE
METHOD: BEFORE_UPDATE
In this method, we get all the process order details which is enough to run the Standard program
“RCCLORD” which triggers the IDOCs.
But the program will be executed unsuccessfully because the Production order details will not be updated in the database when we execute the Program in the Enhancement BADI, but this is the IDEAL place to trigger the IDOCs.
Hence we need to write a RFC function module which should be executed in back ground task as separate unit destination “NONE”.
CALL FUNCTION
'CUSTOM FUNCTION MODULE’
IN BACKGROUND TASK AS SEPARATE UNIT DESTINATION 'NONE'.
Pass the required values from the method to the Function module.
This RFC FM will trigger in a background task once the Production order is created successfully in S4 system. Hence the data will be available in the database and the program to trigger IDOCs will execute successfully.
Create an Order in COR1 transaction,
Release the order and save it.
GO TO COR2 transaction and check the latest order, the order ends with
XXX02981.
Once the Order is saved GO TO WE02 and the outbound IDOC for LOIPRO has triggered, pick the latest IDOC.
In the data records we can find the IDOC details of latest Order number.
Hence IDOC is automatically triggered when an Order is created in COR1 transaction.