Has SAP got the functionality to have outbound IDocs automatically be created when specific SAP documents are being...
posted? Example: when an incoming payment to customer account, which has document type DZ and posting key 15, is posted, SAP automatically prepares an outgoing IDoc with the relevant information.
Receiving plus processing an inbound IDoc and creation of an outbound IDoc are two completely asynchronous steps. Please keep in mind how the general IDoc process flow is:
* IDoc is received
* IDoc is processed by the application and the resulting documents are posted
* The application decides whether it is going to send out an outbound IDoc after posting the document
There are three common ways to automatically create an outbound IDoc:
* Creation through NAST message control
If the application supports messaging, it is the preferred solution. In this case the application stores a message to table NAST and triggers the message processing [entry point is RSNAST(einzel_nachricht) and the called routine is RSNASTED(ALE_PROCESSING) or RSNASTED(EDI_PROCESSING)]. The same message is created when you post the message manually through its appropriate transaction. If you want the IDoc to be sent only when the document has been created through an inbound IDoc, you need to implement a condition in message control, that decides when to disable the creation of the NAST entry. A detailed description on this is found in "The R/3 Guide to EDI, ALE, Workflow and Interfaces"
* Creation through workflow
If the application does not support messaging nor change pointers, some more work is required. A possible and proven solution is to create the IDoc through the workflow mechanism. Workflow is supported by all SAP transaction either explicitly or via the workflow exit from the change document (function CHANGEDOCUMENT_CLOSE). Here you have to send out the IDoc when needed. How? One way is to fake the NAST processing by calling a program that does the following steps:
fill NAST with suitable parameters
PERFORM edi_processing IN PROGRAM rsnasted.
If you are dealing with a master data application like transaction MM01 and IDocs MATMAS, there are ready-to-use functions like MASTERIDOC_CREATE_MATMAS that can be called directly without referring back to message control.
* Creation through change pointers
In the case of master data you could also use the ALE mechanism that is triggered through change pointers. See transaction SALE and change pointers for more. However, this solutions has not proven to be very flexible in practice. I suggest avoiding change pointers and to use workflow instead.
Dig Deeper on SAP integration
Related Q&A from Axel Angeli
An SAP user is having difficulty with PERNR iDoc while transporting data from SAP to an external system. Continue Reading
An SAP user wants to know how to upload data into SAP R/3 when SAP Scripting is not enabled. Continue Reading
An SAP user is receiving an error message while integrating SAP iDoc PORDCR1 for a purchase order. Continue Reading