SAP MDG- Entity data specific to current Change request.
Table of Contents
- Introduction – The purpose of this document is to explain If the material is processed under 2 change request i.e Parallel Processing, then we need to bifurcate data specific to each CR.
- Overview – In Parallel Process we can have the same material in multiple active CR. For example, a material can be requested for an extension for 2 different Plant in two separate CR. So while processing the first CR one should not execute any action on data which is from the second CR.
- A Material M1 is already extended to 5 Plants and now CR is to extend it on 6th plant, In this case, validation or any action should only happen on the 6th Plant.
- A Material M1 is requested for an extension to Plant P1 in CR1 and also P2 in CR2
Eg : Material is extended to DE plant in CR1(24826) and PH plant in CR2(24830)
On fetching data for validating we will get Plant from both CR.
Let see in the example.
If we process CR 24826 which have only DE Plant
In the backend, we will get the site from Other active CR too.
Checking in debugging mode
So If we get any validation error on site/Plants which is not in the processing CR then it will cause roadblock and CR can’t be processed further.
When we fetch the CR data using ‘IF_USMD_MODEL_EXT->read_entity_data_all’, Post that we need to filter out data from other CR.
To find if Entity data is in processing CR we need to use if_usmd_cr_changelist->is_entity_assigned
Use below Code.:
DATA : l_changelist TYPE REF TO if_usmd_cr_changelist.
l_changelist = cl_usmd_cr_changelist=>get_instance( iv_crequest_id = CR_Number “ (eg: 24826)
iv_model = ‘MM’ ).
Loop for MARC*/MBEW*/MVKE*
If l_changelist->is_entity_assigned( iv_entity_type = “MARC*/MBEW*/MVKE* “
is_entity_key = <fs_entity> ) = abap_false. “ <fs_entity> = workarea of entity
In the below screenshot we can see the final outcome is only Plants/SalesOrg etc which are relevant to processing CR.
Note: Solution has removed sites that are from other CR + Which are already extended in ECC. So the custom solution should work on relevant data.
The above methodology/Code will help you to filter out data from other CR and save from common issue in parallel processing.
No need to do all workaround to get object list of perticuler CR. Use GOV API CL_USMD_GOV_API>READ_ENTITY() or get_crequest_data(). Otherwise use Read API
How System is allowing to create multiple change requests for one Material at the same time?
While creating CR type in MDGIMG there is one column of checkbox 'Parallel Processing'.
When we check the Parallel Processing option then we can create multiple CR for same material.
Hope i answered your query.
Thanks Saurabh for your quick turnaround.
Thnks for such a wonderful post. Would you kindly explain howto find the enhancement in the backend for the code ?