Enhancing Alerts in Alert Monitor
The first step in enhancing the alerts displayed in Alert Monitor is to understand how Alerts related data is stored in APO. The next step will be to enhance the data using the BADI user-exit enhancement provided by SAP.
Basically there are Database and Dynamic Alerts.
The data for Database Alerts is generated typically by running a macro and the alert information gets stored in a database table /SAPAPO/AM_ALERT.
On the other hand Dynamic Alerts as the name suggest are generated "on the fly" based on standard SAP code and the information gets stored in Structures.
All alerts be it database or dynamic get displayed using either the stand-alone Alert Monitor (transaction code /SAPAPO/AMON1) or application-specific Interactive Transactions with suitable Alert Profile selected under Settings >> (Assign) Alert Profile.
For example in Interactive Demand Planning (transaction /SAPAPO/SDP94) alerts get displayed at the bottom of Interactive Planning Table when the Display/Refresh Alerts button is toggled on. Note for Interactive Demand Planning most alerts are Database Alerts.
Likewise in Product View (transaction code /SAPAPO/RRP3) you assign a suitable PPDS Alert Profile which will display the relevant Dynamic Alerts.
Alerts (identified by Alert IDs data element /SAPAPO/C_ALERT_ID) are grouped into Alert Types (data element /SAPAPO/C_ATYPE) which in turn is aggregated into Alert Object Types (data element /SAPAPO/C_AOTYPE).
Table /SAPAPO/AOTYPES provides a complete list of Alert Object Types which also links the structures containing the alert information.
For example "Order in Past" is Alert Object Type "0055" belonging to Application "PP" i.e. PPDS and the data for alerts is contained in structure "/SAPAPO/ORDER_IN_PAST_ALERTSTR"
Take a look at /SAPAPO/AMON_SETTING transaction where Alert Profile is set up. Here for a particular application (like PPDS) the Alert Types get displayed under which the actual Alerts are grouped.
For example under PPDS Application tab, Alert Types like Requirement/Receipt, Order in Past etc. Alert Object Types are listed. Expanding one of them like the Order in Past lists the different (dynamic) Alert Types possible like Sales Order in Past, Receipt Due Date/Time in Past, Start Date in Past, Opening Date in Past, Sales Scheduling Agreement in Past.
The BADI user-exit is /SAPAPO/AM_ALERTLIST.
The Method MODIFY_ALERTLIST is used to change values in the Alert Structures so that the ultimate alert data displayed is enhanced.
FM /SAPAPO/ATAB_ATYPES_APPL_GET can be used to get the Alert Object Types for a given Application (e.g. PP for PPDS).
From the alert structure the Product (MATID), Location (LOCID) and Planning Version (PLVER) can be read which can be used to build the basis for the logic to enhance the alert data. The Location-Product master details can be fetched using FM /SAPAPO/DM_MATLOC_GET.
Technically the data in the Alert Stucture is extracted using Field Catalog (FM /SAPAPO/ATAB_FIELDCAT_GET) into an internal table for processing.