Technical Articles
No workflow in requisitions created with MRP
Hello community SAP.
Purpose of this blog
As you may know, the SAP transactions are not perfect and sometime it has a bug, in this moment we need apply a sap note for fix it.
This blog show us how to fix when no workflow is created for this purchase requisition created in materials planning when we use transaction MD01N – MRP Live in S/4HANA.
My system
My System: S4HANA ON PREMISE 1709 02 (05/2018)
SAP Note relevant
sap note 1976456 – No workflow in requisitions created with MRP
Solutions
If I following the next steps the system working, try in your system.
1.Option
MD03 MRP-Individual Planning-Single Level
MD12 Change Planned Order for mark the check
and run the last transaction.
MD14 Individual Conversion of Plnned Ord.
2.Option
In this process the Workflow is created, but if we want to use the MD01N – MRP Live ? the BADI MD_PURREQ_POST is the solution as said the note.
You can implement it the BADI, paste the folowing code and test it.
===============================================
METHOD if_ex_md_purreq_post~post_after_save.
* * Container Set Element
DEFINE swc_set_element.
CALL FUNCTION ‘SWC_ELEMENT_SET’ ##FM_SUBRC_OK
EXPORTING
element = &2
field = &3
TABLES
container = &1
EXCEPTIONS OTHERS = 1.
END-OF-DEFINITION.
*you can use a break-point here….
IF sy–xprog EQ ‘SAPLPPH_MRP_RUN’. “MD01N – MRP Live
DATA: BEGIN OF st_objkey,
number TYPE eban–banfn,
item TYPE eban–bnfpo,
END OF st_objkey.
DATA: ls_key LIKE st_objkey,
lv_key TYPE sweinstcou–objkey,
container TYPE TABLE OF swcont.
DATA: lt_rel_final TYPE TABLE OF bapirlcorq.
CALL FUNCTION ‘ME_REL_INFO’
EXPORTING
i_frgkz = im_eban–frgkz
i_frggr = im_eban–frggr
i_frgst = im_eban–frgst
i_frgot = ‘1’
i_no_dialog = ‘X’
TABLES
rel_final = lt_rel_final
EXCEPTIONS
not_active = 1
OTHERS = 2.
IF sy–subrc <> 0.
* Implement suitable error handling here
ELSE.
READ TABLE lt_rel_final INTO DATA(ls_rel_final) INDEX 1.
IF ls_rel_final–rel_code1 IS NOT INITIAL.
ls_key–number = im_eban–banfn.
ls_key–item = im_eban–bnfpo.
lv_key = ls_key.
swc_set_element container ‘ReleaseCode’ ls_rel_final–rel_code1.
DATA lv_creator TYPE swhactor.
CONCATENATE ‘US’ sy–uname INTO lv_creator.
CALL FUNCTION ‘SWE_EVENT_CREATE_IN_UPD_TASK’ IN UPDATE TASK
EXPORTING
objtype = ‘BUS2009’
objkey = lv_key
event = ‘RELEASESTEPCREATED’
creator = lv_creator
TABLES
event_container = container[]
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2.
IF sy–subrc <> 0.
ELSE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
===============================================
Conclusion
We have 2 options to fix the bug in the transaction MD01N – MRP Live.
Thanks for reading.
Freddy Valderrama
SAP ABAP/WF/PI/MDG Consultant
Well for the MRP , i used to do it earlier but i am not able to get the myapron code you defined here , it would be good if that well explained to use. Well Cheers
Excellent. thank you so much