This page is created to clarify the application logic that updates the Info Record during SRM Contract distribution.
This Debugging Guide can help understanding how the PIR is updated via XML when the Contract is distributed from SRM to ECC, and what is the logic behind it. This page can be useful for identifying the root cause of an undesired behavior of system.
On SRM side to trigger an Info Record update, user needs to set value Info Record update on tab Distribution during Contract creation. Here user can choose whether the plant-dependent conditions or the plant-independent conditions should be updated.
To debug the XML process, you need to reprocess the XML.
Do not reprocess the XML in production environment. Document used with this procedure can become inconsistent.
To know how you can do this, please refer to the following Wiki page: Debugging guide for XML processing.
According to the above Wiki page, you have loaded the XML in SPROXY. At this point, check if the XML has Action Code 01 (meaning it should create a new contract). If yes, it is necessary to verify, if the ECC Contract has been already created, when the XML was initially processed by the system. You can do this, by searching in table BBP_CTR_ITEM_MAP with OBJECT_ID = the SRM Contract number that you can find in the XML. If you can find an entry, you will need to overwrite the Contract number in XML tag <ID> to a number that doesn't exist in the table. (This is necessary, because system checks if the Contract has been already created and if yes, it will call different logic).
If you overwrote the Contract number or the Contract hasn't been yet created, set a breakpoint in Method PREPARE_POST of class CL_MMPUR_OUT_INFO_RECORD.
When you execute the XML processing, the breakpoint will stop.
Firstly, system checks, if the document has Transport Control Indicator, or has CPD vendor, because in that can the Info Record update is not called.
Then system loops at the items, where the Info Record update (SPINF) was set.
In the loop, system calls Method PROCESS_EINA, which updates the corresponding Info Record fields.
In this Method, system calls FILL_EINA.
In this Method you can find the logic for updating the relevant EINA fields. There are two different cases, one when no info record exists and one for updating the exiting one. In the screenshot below, you can find, which fields are updated for existing Info Record.
If you return to Method PREPARE_POST, system triggers the update for table EINA as well. The main logic is the same as for table EINA. First, system calls Method PROCESS_EINE.
Then system calls FILL_EINE.
In FILL_EINE there are again two cases for the creation or update logic. On the screenshot below, you can find the EINE fields that are updated.
Returning Method PREPARE_POST, system starts the condition update process. As the condition update only occurs during Contract distribution from SRM or eSourcing side, system verify if switch LOG_MM_P2PSE_1 is active and if header field STATU has value ‘K’. This IF statement makes it sure that system doesn’t update the info record condition in case the contract is created via BAPI_CONTRACT_CREATE.
In Method CREATE_INFO_REC_COND_API, system determines the relevant condition table (e.g.: A017 for plant-dependent, A018 for plant-independent) using FM ME_DETERMINE_KOTABNR.
Then system reads the buffered conditions in table MT_CONDITION_DATA. Here check, if the condition values are correct. If the value is not correct, you can start a new debugging in Method PUSH_DATA of class CL_API_MASTER_CONDITION_MM. This Method is responsible to populate table MT_CONDITION_DATA and it is called when the items are processed by Method IS_VALID of Include LMEOUTP41.
If the values are correct, you can follow the program into Method PROCESS_CONDITION.
This Method is used for general condition update process, which is already documented in the following Wiki page: Condition update process - Debugging Guide (ME816). You can continue the debugging guide from line In method PROCESS_CONDITION…
Community Wiki - Condition update process - Debugging Guide (ME816)
Related SAP Notes/KBAs
KBA: 2708109 Info record from contract created with BAPI does not contain conditions