APO Custom Alerts complete solution ( Use case: PPDS Custom Alerts )
The motive of this blog is to define custom defined alert for any APO Application. However, in order to illustrate deeply, created custom alerts for PPDS (APO: Production Planning / Detailed Sch.) Application. The concept is same and is applicable for all other applications, defined in Alert Monitor.
There is literally no documentation in this area and I faced many difficulties to decrypt and understand the technicalities behind the Alert Monitor. All I learnt is by pure debugging and doing backtracking from ABAP CODE to customizing TABLE.
Reason for this Solution:
In SCM APO, Alerts plays a major role, in detecting and resolving problems in the whole supply chain.
Note: In application, APO: Supply & Demand Planning, it is straightforward to configure and develop custom alert. You just have to define new alert in t-code /SAPAPO/ATYPES_SDP and it becomes active in your system. You can use badi /SAPAPO/AM_ALERTLIST to manipulate as per business requirements.
This custom alert will appear in AMON_SETTING as below,
However, in applications like, APO: Production Planning / Detailed Sch., it is not the same way. You cannot create custom alert via T-code /SAPAPO/ATYPES_SDP. The standard SAP provided alert types are very limited, APO Live cache generates the alerts, and literally, you do not have any available badi/exit/enhancement to customize the SAP provided alert types.
I achieved this customizing PP Alerts with help of below technicalities. I segregated the whole document into 4 sections, as below,
- CONFIGURATION PART
- DEVELOMENT PART
- MASTER DATA PART
- OUTPUT PART
1) CONFIGURATION PART:
/SAPAPO/AMOCFG is the main t-code to define custom alert for all applications (not only for PPDS but also for other application like ATP,TLB, VMI etc.) in SCM APO.
Here is the hierarchy of events, that you have to define, in order to create custom alert,
Step 1: define “Alert Object Types” in custom number range > 8000.
Here, choose meaningful description, as this will be shown in Alert Monitor. Choose Application, structure, Table type, Message Class as per the format of the Alert message that you would like to see.
Step 2: define “Alert Types” for above ALERT OBJECT TYPE. This is kind of a sub-category for Alert object type.
Choose “Alert Obj. Type” and double click on “Alert Types”.
Step 3: define “Technical Fields”, which covers all fields that should be part of your alert information.
Step 4: define “Special Treatment for Time-Dependent Fields”, for time related fields.
Step 5: define “Double-Click Function”. I have not configured this, but you can give a try.
Step 6: define “Dependent Alert Attribute Services “for your newly created Alert Obj. Type.
There are available standard SAP delivered Alert Attribute services, which can be used to retrieve relevant information.
Step 7: assign your Alert Obj. Type to different views in “Assign Alert Object Type to View”.
Step 8 (optional): create a complete new “Alert Engine Structures” for your custom alert, if you cannot make use of any standard Alert Engine Structures.
Each Structure is a group of parameters. You can create new parameters in next step, if you cannot make use of any standard parameters.
Step 9 (optional): create new parameters under node “Parameter Definition”
This defines the type (char, key fig, time / Unit), data type of the parameter and info-object.
2) MASTER DATA PART:
Once you complete above configuration part, in T-code /SAPAPO/AMON1, you will find CUSTOM ALERT TYPE visible, which can be set to “ACTIVE” for a particular Alert Profile.
3) DEVELOPMENT PART:
There is a badi /SAPAPO/AM_ALERT_PP available, however, even though have an active badi implementation, this implementation will not trigger/work. I debugged little bit and found that unless you define new custom alerts (alert type > 8000) in t-code /SAPAPO/AMOCFG (maintain config. Data as detailed in above steps).
Please find below code snippet that calls BADI only if there is a custom alert.
Challenging part is handling INFO – Field in alert structure. This is a generic field for all alert structures of all APO applications. It is of type 1024 characters. How do we handle this? How can we read / write data into this INFO field?
What we have to do is, point source structure (component wise structure) and target structure(with INFO structure) to fields symbols of type C.
Reading INFO field:
To read data from the INFO field, pass the field symbol of target structure to field symbol of source structure. Now, in your source structure, you can access all details of INFO field.
Writing into INFO field:
To write data into INFO field, fill the source structure components with values, assign the source structure to a field symbol of type C and pass it field symbol, pointing to target structure. This way, you can push values to INFO field of alert structure.
We know the application and structure from /SAPAPO/AMO_CFG tcode, declare the source structure and do the following,
Declare 2 field symbols of type C , one for INFO structrue, other for structure with components,
ASSIGN COMPONENT 0 OF STRUCTURE es_alert TO <alert_str> CASTING. ( field symbol of type c)
ASSIGN COMPONENT 0 OF STRUCTURE l_requirements_wa TO <requirements_str> CASTING. è (field symbols of type c)
You can access all fields(components) with structure l_requirements_wa.
Finally pass <requirements_str> to <alert_str>, so that it will be transformed to INFO field of ALERT Structure.
4) OUTPUT PART:
Once you complete configuration, master data & development, you will find custom alerts ( in above case, PP Custom alerts ) just like standard alerts, in all applications like Product View (/SAPAPO/RRP3) , Alert Monitor (/SAPAPO/AMON1) and Planning board (/SAPAPO/CDPS0) etc. In case of planning board, Alerts will make the order to blink, just like standard alerts.
That’s the beauty of all this work !!!
Sneak preview of Alert Monitor, with Custom ALERTS.