Create new alert type in table /sapapo/atype
Use BAdI /SAPAPO/AM_ALERTLIST
Implement Method READ_CUSTDEF_PP_ALERTS
DATA:
ls_atype TYPE /sapapo/satypes,
ls_alert TYPE /sapapo/alert_str,
ls_a TYPE /sapapo/requirements_alertstr, " /sapapo/lc_mat_order_alertstr.
" check if alert type should be considered
READ TABLE t_atypes INTO ls_atype WITH TABLE KEY
aot = mc_aot_req_receipt_alert
at_id = mc_my_new_alerttype.
CHECK sy-subrc = 0.
FIELD-SYMBOLS:
<ls_alert_general> TYPE c,
<ls_alert_order> TYPE c.
" generate alert
ls_a-aot = mc_aot_req_receipt_alert. " /SAPAPO/C_AOTYPE Object Type of Alert
ls_a-at_id = mc_my_new_alerttype. " /SAPAPO/C_ATYPE Type of Alert
" ls_a-status_icon = 'W'.
" ls_a-priority = '2'. " Priority of Alert - warning
" ls_a-prioicon = ''. " Priority - Icon
" ls_a-colcode = ''. " Line Color in ALV
ls_a-description = 'my alert'. " Text for Alert
ls_a-key_fig = ls_io-real_quantity.
CONDENSE ls_a-key_fig.
ls_a-aid_int = cl_system_uuid=>create_uuid_c22_static( ).
ls_a-aid = ls_a-aid_int. " Alert ID
ls_a-vfrom = vfrom.
ls_a-vto = vto.
ls_a-uname_from = sy-uname.
ls_a-sec_attr = 'X'.
ls_a-plver = plver.
ls_a-pegid = ls_io-pegid.
ls_a-matid = ls_matloc-matid.
ls_a-locid = ls_matloc-locid.
ls_a-ordertxt = ls_atpcat-atptext40.
ls_a-orderid = ls_io-orderid.
ls_a-position_no = ls_io-position_no.
ls_a-line_no = ls_io-line_no.
ls_a-is_input_node = ls_io-is_input_node.
ls_a-orderpriority = ls_io-priority.
ls_a-orderisplanned = 'X'.
ls_a-atpcat = ls_io-category.
ls_a-actid = ls_io-actid.
ls_a-matnr = ls_matloc-matnr.
ls_a-maktx = ls_mattxt-maktx.
ls_a-locno = ls_matloc-locno.
ls_a-loctx = ls_loct-descr40.
<ls_alert_general> = <ls_alert_order>.
INSERT ls_alert INTO TABLE t_alerts.