Symptom
Purchase Orders are not released after the OPEN BADI is implemented.
The BAdI MM_PUR_S4_PO_OPEN is used to put a purchase order in display mode and make further processing of the purchase order impossible.
The following parameters are provided:
-
ISREADONLY
-
ISVALID
When opening an existing purchase order, the
default value for ISREADONLY = false → The purchase order is valid.
Change value for ISREADONLY = true → The purchase order is in read only mode and cannot be edited.
When opening an existing purchase order, the
default value for ISVALID = abap_true → The purchase order is valid.
Change value for ISVALID = abap_false → The purchase order is not valid. It is impossible to continue processing the document.
Once the BADI is implemented and active the PO can´t be updated by System users on technical Processes like Workflow.
Environment
SAP S/4HANA CLOUD 2108
Reproducing the Issue
Badi mm_pur_s4_po_
Purchase order stays " In approval" , while approver has already released.
Cause
Once the BADI is implemented and active the PO can´t be updated by System users on technical Processes like Workflow.
Resolution
You can activate the BADI specifying the affected single CBusers like in the example below:
*****************
METHOD if_mm_pur_s4_po_open~open.
* If sy-uname eq "CBXXXXXXXXXXX"
* In case you want to switch the purchase order to READ-ONLY mode, parameter ISREADONLY needs to be set.
* isreadonly = abap_true.
* In case you want to hide the purchase order data, parameter ISVALID needs to be cleared:
* isvalid = abap_false.
* ENDIF.
ENDMETHOD.
In case you don´t specify the logic for selected CBusers, you need to exclude the System users like in the example code below:
*****************
METHOD if_mm_pur_s4_po_open~open.
* Be aware to exclude technical processes like Workflow etc. from this setting, otherwise this processes are impacted!
* If sy-uname <> 'Your WFL Usr' AND "Workflow User
* sy-uname <> 'any tec. Usr'. "other technical user which should be excluded
* In case you want to switch the purchase order to READ-ONLY mode, parameter ISREADONLY needs to be set.
* isreadonly = abap_true.
* In case you want to hide the purchase order data, parameter ISVALID needs to be cleared:
* isvalid = abap_false.
* ENDIF.
ENDMETHOD.
Note:
In case you receive the error message: " Access to the field 'SY-UNAME' IS NOT PERMITTED IN THE RESTRICTED LANGUAGE SCOPE"
please use following statement:
Data(lv_name) = cl_abap_context_info=>get_user_technical_name( ).
If LV_NAME <> 'SAP_WFRT'
Keywords
KBA , MM-FIO-PUR-PO , Fiori UI for Purchase Orders , MM-PUR-PO , Purchase Orders , Problem