METHOD if_ex_alert_modify_text~modify_long_text.
CONSTANTS: lc_text_type TYPE so_obj_tp VALUE 'HTM'.
DATA: lr_swf_cnt_container TYPE REF TO if_swf_cnt_container,
lv_ns TYPE /aif/ns,
lv_ifname TYPE /aif/ifname,
lv_ifversion TYPE /aif/ifversion,
lv_nsrecipient TYPE /aif/ns,
lv_recipient TYPE /aif/alrt_rec,
lt_messages TYPE TABLE OF bapiret2,
lv_messages_nr TYPE sytabix,
lv_msgguid TYPE sxmsguid,
lv_date(10) TYPE c,
lv_time(10) TYPE c.
* Set Time/Date Format
CONCATENATE sy-uzeit+0(2) sy-uzeit+2(2) sy-uzeit+4(2) INTO lv_time SEPARATED BY ':'.
WRITE sy-datum TO lv_date MM/DD/YYYY.
* Change Mail Format to HTML
cp_text_type = lc_text_type.
* Assign alert data
DATA(lr_alert) = NEW cl_alert( ).
lr_alert ?= io_alert.
* Get Alert Container
TRY.
CALL METHOD lr_alert->get_ifcontainer
RECEIVING
result = lr_swf_cnt_container.
CALL METHOD lr_alert->get_creatime
RECEIVING
result = DATA(lv_creatime).
CALL METHOD lr_alert->get_logical_system
RECEIVING
result = DATA(lv_logical_system).
CATCH cx_os_object_not_found.
ENDTRY.
* Get Elements
TRY.
CALL METHOD lr_swf_cnt_container->if_swf_ifs_parameter_container~get
EXPORTING
name = 'NS'
IMPORTING
value = lv_ns.
CALL METHOD lr_swf_cnt_container->if_swf_ifs_parameter_container~get
EXPORTING
name = 'IFNAME'
IMPORTING
value = lv_ifname.
CALL METHOD lr_swf_cnt_container->if_swf_ifs_parameter_container~get
EXPORTING
name = 'IFVERSION'
IMPORTING
value = lv_ifversion.
CALL METHOD lr_swf_cnt_container->if_swf_ifs_parameter_container~get
EXPORTING
name = 'NSRECIPIENT'
IMPORTING
value = lv_nsrecipient.
CALL METHOD lr_swf_cnt_container->if_swf_ifs_parameter_container~get
EXPORTING
name = 'RECIPIENT'
IMPORTING
value = lv_recipient.
CALL METHOD lr_swf_cnt_container->if_swf_ifs_parameter_container~get
EXPORTING
name = 'MESSAGES'
IMPORTING
value = lt_messages.
CALL METHOD lr_swf_cnt_container->if_swf_ifs_parameter_container~get
EXPORTING
name = 'MESSAGES_NR'
IMPORTING
value = lv_messages_nr.
CALL METHOD lr_swf_cnt_container->if_swf_ifs_parameter_container~get
EXPORTING
name = 'MSGGUID'
IMPORTING
value = lv_msgguid.
CATCH cx_swf_cnt_elem_not_found.
CATCH cx_swf_cnt_elem_type_conflict.
CATCH cx_swf_cnt_unit_type_conflict.
CATCH cx_swf_cnt_container.
ENDTRY.
* Build Mailtext
CLEAR ct_long_text.
APPEND VALUE #( line = '<p style="color:red;font-weight:bold;">Attention!<br />An error occured during message processing.</p>' ) TO ct_long_text.
APPEND VALUE #( line = '<p style="font-weight:bold;">Following, you will find all necessary information.</p>' ) TO ct_long_text.
APPEND VALUE #( line = '<ul style="list-style-type: disc;">' ) TO ct_long_text.
APPEND VALUE #( line = '<li>Namespace: ' && lv_ns && '</li>' ) TO ct_long_text.
APPEND VALUE #( line = '<li>Interface: ' && lv_ifname && '</li>' ) TO ct_long_text.
APPEND VALUE #( line = '<li>Interface Version: ' && lv_ifversion && '</li>' ) TO ct_long_text.
APPEND VALUE #( line = '<li>Alert Recipient: ' && lv_nsrecipient && '/' && lv_recipient && '</li>' ) TO ct_long_text.
APPEND VALUE #( line = '<li>User: ' && sy-uname && '</li>' ) TO ct_long_text.
APPEND VALUE #( line = '<li>Date: ' && lv_date && '</li>' ) TO ct_long_text.
APPEND VALUE #( line = '<li>Time: ' && lv_time && '</li>' ) TO ct_long_text.
APPEND VALUE #( line = '<li>Message GUID: ' && lv_msgguid && '</li>' ) TO ct_long_text.
APPEND VALUE #( line = '</ul>' ) TO ct_long_text.
APPEND VALUE #( line = '<p style="font-weight:bold;">Log Messages:</p>' ) TO ct_long_text.
APPEND VALUE #( line = '<p>----------------------------------------------------------------------------------------------------</p>' ) TO ct_long_text.
LOOP AT lt_messages INTO DATA(lv_message).
APPEND VALUE #( line = '<span>' && lv_message-message && '</span><br />' ) TO ct_long_text.
ENDLOOP.
APPEND VALUE #( line = '<p>----------------------------------------------------------------------------------------------------</p>' ) TO ct_long_text.
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 | |
4 |