
To monitor the POs that become inconsistent, we can have a report that looks for four types of inconsistencies, such as,
We can use FM BBP_PD_PO_GETLIST to get the list of POs that are changed today, it will include the POs that are created today as well since the newly created POs have changed date as today's date only.
Case 1: Change lock
When a newly created PO is changed, a change lock is set to the original (active) version of PO until the change version is closed. Once change version is closed, original version will take the changes from change version and lock will be cleared.
Sometimes, change lock will not be cleared from original version, hence purchaser will no longer be able to change the PO as system pops up message "Action not possible because change versions exist" when purchaser clicks EDIT button.
We will have to use FM BBP_PDHGP_DB_DIRECT_UPDATE to clear the lock from active version of PO.
Case 2: Ordered in SRM but did not replicate to SAP ECC
Sometimes newly created PO in SRM in Ordered status does not replicate to SAP due to various reasons and when we try to make some dummy change in order to replicate it, we get the following pop up.
System status ITRE is active
This is due to status 'I1080’ is being active, we will have to push the PO via FM BBP_PD_PO_TRANSFER_EXEC, after which PO would have been replicated to SAP ECC.
Case 3: Error in process
We can find the POs that went error in process on a particular date by executing FM BBP_PD_PO_GETLIST by inputting change date as that date and check which POs have status 'I1132' active.
Case 4: Workflow lock
When an approver actions the approval workitem of a PO, a workflow lock entry is created in BBP_WFLOCK table which does not get cleared. Hence, the PO cannot be processed anymore as the system will pop up below message.
Document still being processed in background. Try again later.
We will have to clear the lock by executing standard report BBP_DEL_WFLOCK with PO GUID.
If we execute this report for current date, it will fetch the POs with aforesaid issues and it clears change lock and displays the PO numbers under the respective issues. We will have to take action.
****************************************************************
REPORT zsrm_process_po.
DATA: ls_pdlist TYPE bbp_pds_pdlist,
hs_pdlist TYPE bbp_pds_version_list_internal,
ls_status TYPE bbp_pds_status,
ls_wflock TYPE bbp_wflock,
ls_header TYPE bbp_pds_po_header_d,
lt_pdlist TYPE TABLE OF bbp_pds_pdlist,
ht_pdlist TYPE TABLE OF bbp_pds_version_list_internal,
lt_messages TYPE TABLE OF bbp_pds_messages,
lt_status TYPE TABLE OF bbp_pds_status,
lt_wflock TYPE TABLE OF bbp_wflock,
lt_header TYPE TABLE OF bbp_pds_po_header_d.
DATA lv_guid LIKE crmd_orderadm_h-guid.
PARAMETERS date TYPE dats.
CALL FUNCTION 'BBP_PD_PO_GETLIST'
EXPORTING
i_change_date = date
i_change_lock = 'X'
TABLES
e_pdlist = lt_pdlist
e_messages = lt_messages
e_status = lt_status.
WRITE 'POs with change lock'.
LOOP AT lt_pdlist INTO ls_pdlist.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_object_id = ls_pdlist-object_id
IMPORTING
e_header = ls_header.
IF ls_header-change_lock EQ 'X'.
CALL FUNCTION 'BBP_PROCDOC_VERSION_GETLIST'
EXPORTING
iv_header_guid = ls_pdlist-guid
iv_read_all_change_versions = 'X'
TABLES
et_pdlist = ht_pdlist.
SORT ht_pdlist BY version_no DESCENDING.
DELETE ADJACENT DUPLICATES FROM ht_pdlist COMPARING version_type.
LOOP AT ht_pdlist INTO hs_pdlist WHERE version_type EQ 'C'.
IF hs_pdlist-doc_closed EQ 'X'.
WRITE:/ ls_pdlist-object_id.
CALL FUNCTION 'BBP_PDHGP_DB_DIRECT_UPDATE'
EXPORTING
iv_guid = ls_pdlist-guid
iv_change_lock = 'N'.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
CLEAR: lt_pdlist, lt_messages, lt_status.
CALL FUNCTION 'BBP_PD_PO_GETLIST'
EXPORTING
i_change_date = date
TABLES
e_pdlist = lt_pdlist
e_messages = lt_messages
e_status = lt_status.
IF sy-subrc IS INITIAL.
WRITE:/ 'POs with ITRE status active'.
LOOP AT lt_pdlist INTO ls_pdlist.
READ TABLE lt_status INTO ls_status WITH KEY p_guid = ls_pdlist-guid stat = 'I1080' inact = ' '.
IF sy-subrc IS INITIAL.
WRITE:/ ls_pdlist-object_id.
ENDIF.
ENDLOOP.
WRITE /'POs error in process'.
LOOP AT lt_pdlist INTO ls_pdlist.
READ TABLE lt_status INTO ls_status WITH KEY p_guid = ls_pdlist-guid stat = 'I1132' inact = ' '.
IF sy-subrc IS INITIAL.
WRITE:/ ls_pdlist-object_id.
ENDIF.
ENDLOOP.
ENDIF.
SELECT * FROM bbp_wflock INTO TABLE lt_wflock WHERE obj_type EQ 'BUS2201' AND lock_cdate EQ date.
IF sy-subrc IS INITIAL.
WRITE:/ 'POs with workflow lock'.
LOOP AT lt_wflock INTO ls_wflock.
lv_guid = ls_wflock-obj_guid.
CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
EXPORTING
i_guid = lv_guid
IMPORTING
e_header = ls_header.
IF sy-subrc IS INITIAL.
WRITE:/ ls_header-object_id.
ENDIF.
ENDLOOP.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.