There are certain ways that we could use in S4 to trigger an outbound IDocs. For example, using change pointers, Output type determination. The ideal fit needs to be chosen based on the requirement. Moreover, when master data creation or delta changes have to be informed to another system change pointers are the best fit where for transactional data, output determination is widely used.
Nevertheless, what if, there is no standard process code found (WE41 / TMSG1 table) for IDoc basic type/message which is required by business requirment.
In this scenario, we need to send the material document information which was posted (VL32N, MIGO or Inbound IDocs ) in S4 while good receving to external system. For that Basic type MBGMCR04 and MBGMCR were used and output determination couldn’t help this.
A BADI which is triggered for VL32N, MIGO and IDocs had to be chosen. The reason to find out such a BADI is recommended over using completely a custom ABAP program since otherwise custom abap logics should be written to populate IDoc structures and this would make life harder when it comes to UAT and post go live support.
MB_DOCUMENT_BADI should be implemnted and method MB_DOCUMENT_UPDATE shoud be used. Function module MASTER_IDOC_DISTRIBUTE was leveraged to create the outbound IDoc.
up until this point everything sounds good in terms of sending IDoc to externl party. But for the S4 business user, there is no any link to the IDoc triggered for the interface via material document by SAP Training. So it is crucial to maintain the relationship for a better user experince. This blog post will discuss in detail how to update the IDoc number triggered to see in the relationship browser of material document as well.