In most of the cases, we are using keyword Message to display desired message at the message area of status bar. However, in certain scenarios, these message will be overidden by other message at upper level of calling function module.
For instance, Program A calls Function Module B and it calls Function Module C, C raised an important exception but B either override it with other message or suppress the message. Thus, the user lost the important message from Function Module C.
One of the solution this kind of scenario would be displaying the message with pop up function module.
1. Getting the error message after calling function module
- Perform a select statement from table T100
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
DATA: lv_err_msg TYPE STRING.
SELECT SINGLE text FROM t100 INTO lv_err_msg
WHERE sprsl EQ sy-langu
AND arbgb EQ sy-msgid
AND msgnr EQ sy-msgno.
ENDIF.
OR
- Write the error message into a string data object.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
DATA: lv_err_msg TYPE STRING.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 INTO
lv_err_msg.
ENDIF.
2. Display the error message with pop up function module. Our recomendations in this scenario would be:
No comments:
Post a Comment