2007 Apr 24 11:01 AM
Hi Experts,
How we will handle return messages in function module.
IF A = 0.
ERROR.
ELSE.
RESULT.
ENDIF.
I REQUIRED ERROR MESSAGE WHEN I WILL EXECUTE MY FM
Hi Experts,
How we will handle return messages in function module.
IF A = 0.
ERROR.
ELSE.
RESULT.
ENDIF.
I REQUIRED ERROR MESSAGE WHEN I WILL EXECUTE MY FM
2007 Apr 24 11:05 AM
after u call the FM , u will get the SY-MSGID , SY-MSGN0 .... with that u can build the error message , chk this
DATA : L_ERR_MSG(500).
CALL FUNCTION 'TB_MESSAGE_BUILD_TEXT'
EXPORTING
LANGU = SY-LANGU
MSGID = P_SY_MSGID
MSGNO = P_SY_MSGNO
MSGV1 = P_SY_MSGV1
MSGV2 = P_SY_MSGV2
MSGV3 = P_SY_MSGV3
MSGV4 = P_SY_MSGV4
IMPORTING
TEXT = P_L_ERR_MSG.
2007 Apr 24 11:05 AM
raise an exception.
Set up exceptions in your FM header to deal with different exceptions.
Then when you encounter the error simply write, Raise (Exception name).
Then you can hande that from the return of the FM.
2007 Apr 24 11:05 AM
Hi,
Use EXCEPTIONS.
Also u can write the error message using Message Statement.
U can do like this :
Define an Exception say : 'DATA_INVALID'.
Now, in the code write :
IF A = 0.
MESSAGE E000(0K) WITH 'Data Invalid' RAISING 'DATA_INVALID'.
ELSE.
RESULT.
ENDIF.
Regards,
Himanshu
2007 Apr 24 11:07 AM
make use of keyword and maintain Execptions in ur FM
RAISE
Regards
Prabhu
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |