This page was created to clarify the application logic of the contract distribution on connected system side.
This page is a part of a Troubleshooting Guide of central contract distribution, which is relevant, if the distributed contract is not created correctly, even if the Request XML sent with correct data. In case the XML hasn't been already checked, refer to Wiki page Central Contract Distribution - Troubleshooting Guide.
To debug the contract creation in connected system, first it is necessary to download the relevant XML. You can find it in SRT_MONI or SXMB_MONI. The receiver interface is PurchaseContractDistributionReplicationRequest_In ().
When you open the XML, expand Inbound Message, then Payloads and open MainDocument. Then click the Download Window 2 icon and save the XML.
- Set breakpoint in Method IF_MMPUR_HUB_CCTR_REPLI_IN~PROCESS of class CL_MMPUR_HUB_CCTR_REPLI_IN.
- Execute SPROXY_START.
- Fill ABAP Name II_PUR_CCTR_REPLICATION_IN (for R/3-based connected system) / II_PUR_CCTR_REPLI_INBOUND (for S/4-based connected system).
- Press F8, when the popup appears, press F8 again.
- Load the previously saved XML file (F5 shortcut)
- Press F8.
Outline Agreement creation/change
The breakpoint stops in Method IF_MMPUR_HUB_CCTR_REPLI_IN~PROCESS, where system determines, whether the Creation or Change scenario needs to be performed based on the Action Code of the XML (01 - Create, 02 - Change). Even if the Action Code is 01, system verifies if the contract was already created, and if yes, it triggers the Change scenario instead.
Each scenario follows similar logic. For this example the Create scenario is explained further. In Method IF_MMPUR_HUB_CCTR_REPLI_IN~CREATE system maps the XML value into the relevant application structures (BAPI parameters). In INPUT_MAPPING Method system also calls BAdI MMPUR_REPLI_IN_EXT_MAP, which can be used to implement custom map logic.
After the mapping, system calls the BAPI. In Create scenario BAPI_CONTRACT_CREATE or BAPI_SAG_CREATE.
If BAPI finished successfully, system calls Update FMs MMPUR_HUB_UPDATE_EKKO and MMPUR_HUB_UPDATE_EKPO to update fields EXTERNALREFERENCEID, EXTERNALSYSTEM and EXT_REV_TMSTMP to store the central contract number, central system and timestamp of distribution.
Trigger Confirmation XML
Afterwards, system calls Method CONFIRMATION_OUT to trigger the Confirmation XML to the HUB system about the successful creation or errors.
In Method CONFIRMATION_OUT system maps the basic data of the created Outline Agreements and the messages that the BAPI returned into internal table LT_CCTR_CONF, then it calls Method IF_MMPUR_HUB_CCTR_CONF_OUT~EXECUTE.
In EXECUTE, system maps the content of table LT_CCTR_CONF into XML structures.
Finally, it triggers the XML.
SAP Community Wiki - Central Contract Distribution - Troubleshooting Guide
SAP Community Wiki - Confirmation XML processing after Central Contract distribution - Debugging Guide