Read results of overall check

Use the following APIs to read entries from the Compliance Monitor.

Business objectRead whole entryCheck if status is open
Accounting document/AEB/CMP_PB_GET_AD_MON_ENTRY
Applicant/AEB/CMP_PB_GET_AP_MON_ENTRY/AEB/CMP_PB_IS_AP_OPEN
Bank/AEB/CMP_PB_GET_BNK_MON_ENTRY/AEB/CMP_PB_IS_BNK_OPEN
Business partner/AEB/CMP_PB_GET_BP_MON_ENTRY/AEB/CMP_PB_IS_BP_OPEN
Customer/AEB/CMP_PB_GET_CUS_MON_ENTRY/AEB/CMP_PB_IS_CUS_OPEN
Delivery/AEB/CMP_PB_GET_DLV_MON_ENTRY/AEB/CMP_PB_IS_DLV_OPEN
Employee/AEB/CMP_PB_GET_EM_MON_ENTRY/AEB/CMP_PB_IS_EM_OPEN
Material document/AEB/CMP_PB_GET_MD_MON_ENTRY/AEB/CMP_PB_IS_MD_OPEN
Purchase document/AEB/CMP_PB_GET_PD_MON_ENTRY/AEB/CMP_PB_IS_PD_OPEN
Payment/AEB/CMP_PB_GET_PIP_MON_ENTRY
Sales document/AEB/CMP_PB_GET_SDOC_MON_ENTRY/AEB/CMP_PB_IS_SDOC_OPEN
Service notification/AEB/CMP_PB_GET_SN_MON_ENTRY/AEB/CMP_PB_IS_SN_OPEN
Service order/AEB/CMP_PB_GET_SO_MON_ENTRY/AEB/CMP_PB_IS_SO_OPEN
Vendor/AEB/CMP_PB_GET_VDR_MON_ENTRY/AEB/CMP_PB_IS_VDR_OPEN
CRM business transaction/AEB/CMP_PB_GET_CBT_MON_ENTRY
CRM business partner/AEB/CMP_PB_GET_CBP_MON_ENTRY

Implementing blocks for purchase document checks

The SAP business object "purchase document" don't have blocking reasons or a dedicated extension for 3rd party applications to set such a block.
Hereby we have some examples to implement a similar blocking behavior.

  1. Via Messages (NACE)

Create a new program which you can configurate in NACE.
In this program check the AEB monitor entry with the AEB function: /AEB/CMP_PB_GET_PD_MON_ENTRY.
If "HAS_SCR_HIT", "HAS_SCR_ERR", "HAS_EC_HIT" or "HAS_EC_ERR" is set (X) or "STATUS_ID" = "J" (Prohibited) then the order needs to be blocked.

Now create a new message type with the transaction NACE for purchase document messages.

In order to automatically release a blocked order, use the AEB Badi "/AEB/CMP_MONITOR_11 – PURCHASE_DOCUMENT_DEBLOCKED" for your coding to unblock the order.

  1. Prevent release of the order via ME29

Code sample for BadI "ME_PROCESS_PO_CUST => Methode CHECK"

DATA:
  lcl_mepoheader  TYPE mepoheader,
  lcl_mon_entries TYPE /aeb/cmp_pb_entry_dos,
  lcl_mon_entry   TYPE /aeb/cmp_pb_entry_do,
  lcl_ekko        TYPE ekko.

IF sy-tcode <> 'ME29N'.
  RETURN.
ENDIF.

* ---------------------------------------------------
* Check AEB compliance screening status
* ---------------------------------------------------

* Determine current status (monitor entries) from AEB
lcl_mepoheader = im_header->get_data( ).
SELECT SINGLE * FROM ekko INTO lcl_ekko WHERE ebeln = lcl_mepoheader-ebeln.
CALL FUNCTION '/AEB/CMP_PB_GET_PD_MON_ENTRY'
  EXPORTING
    im_ekko            = lcl_ekko
  IMPORTING
    ex_monitor_entries = lcl_mon_entries
  EXCEPTIONS
    OTHERS             = 1.

IF sy-subrc <> 0.
  MESSAGE ID 'ZM' TYPE 'E' NUMBER '136'.
  RETURN.
ENDIF.

* There can be several entries for one document
LOOP AT lcl_mon_entries INTO lcl_mon_entry.
*   First check if the entry is still valid
  IF lcl_mon_entry-is_deleted = 'X' .
    CONTINUE.
  ENDIF.
*   Check and react if the status is "Critical
  IF lcl_mon_entry-has_scr_hit = 'X'.
    MESSAGE ID 'ZM' TYPE 'E' NUMBER 'XXX'.
*   Check and react if the status is "Error"
  ELSEIF lcl_mon_entry-has_scr_err = 'X'.
    MESSAGE ID 'ZM' TYPE 'E' NUMBER 'XXX'.
*   Check and react if the status is "Prohibited"
  ELSEIF lcl_mon_entry-status_id = 'J'.
    MESSAGE ID 'ZM' TYPE 'E' NUMBER 'XXX'.
  ENDIF.
ENDLOOP.
* ---------------------------------------------------
* End of AEB Check
* ---------------------------------------------------

What's Next