2009 Apr 17 4:20 AM
Hi Guys,
I would like to know the difference between following statements
RAISE NO_BODY_FOUND
and
MESSAGE e300 RAISING NO_BODY_FOUND.
Is that the first statement produce dump error while the other log an error message ?
Thanks
Senthil
Hi Guys,
I would like to know the difference between following statements
RAISE NO_BODY_FOUND
and
MESSAGE e300 RAISING NO_BODY_FOUND.
Is that the first statement produce dump error while the other log an error message ?
Thanks
Senthil
2009 Apr 17 4:31 AM
RAISE .
Only occurs in function modules and methods. Terminates processing and raises an exception defined in the interface.
[RAISE EXCEPTION ref. In this case, the exception object must already exist and the REF reference variable must point to it.|http://help.sap.com/saphelp_nw04/helpdata/EN/83/636d2012fc11d5991e00508b5d5211/content.htm]
2009 Apr 17 5:49 AM
Hi,
Thanks for the answer.
If I am calling a FM, and don't handle the exception it will through a dump right?
Here is the sample code which is throwing a dump error.
CALL FUNCTION 'Z_HR_SUPERIOR_ROLE'
EXPORTING
otype = 'P'
sobid = v_sobid
IMPORTING
supervisor = v_supervisor.
IF sy-subrc EQ 0.
PERFORM: get_email_addr USING v_supervisor v_sup_addr.
IF v_sup_addr <> space.
CLEAR i_receivers. "WIl03Y
i_receivers-rec_type = 'U'.
i_receivers-receiver = v_sup_addr.
APPEND i_receivers.
ENDIF.
In fact this FM module have the following exceptions
EXCEPTIONS
NOBODY_FOUND
UNKNOWN_DELEGTYPE
NO_ACTIVE_PLVAR
ERROR
When this FM returns exception its dumping.
Thanks
Senthil
2009 Apr 17 6:11 AM
Hi,
you should add the exceptions part else it will dump in case of any exceptions raised by the FM:
CALL FUNCTION 'Z_HR_SUPERIOR_ROLE'
EXPORTING
otype = 'P'
sobid = v_sobid
IMPORTING
supervisor = v_supervisor
EXCEPTIONS
NOBODY_FOUND = 1
UNKNOWN_DELEGTYPE = 2
NO_ACTIVE_PLVAR = 3
ERROR = 4
OTHERS = 5.
if sy-subrc = 0.....
Even if you do not handle the sy-subrc case for the exceptions, it does not matter. But the exceptions declarations need to be there.
Edited by: Dev Parbutteea on Apr 17, 2009 7:12 AM
2009 Apr 17 1:41 PM
you will use the exception like this:
i_receivers-receiver = v_sup_addr.
APPEND i_receivers.
if sy-subrc NE 0.
raise exception <exception name>.
endif.
ENDIF.
2009 Apr 17 4:44 AM
Raise.
Will be used in FM's to cature the error situations. Based on the exception raised, it'll assign teh sy-subrc value.
Other one is a normal error message raising in the programs (direct).
2009 Apr 17 5:19 AM
hi,
RAISE.
is used in Function modules any unexpected results occurred and in methods also used for same purpose .
message as u no it will be used in condition to display the status .
2009 Apr 17 6:34 AM
There are two ABAP statements for raising exceptions. They can only be used in function modules:
RAISE .
and
MESSAGE..... RAISING .
The effect of these statements depends on whether the calling program handles the exception or not. If the name of the exception or OTHERS occurs in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is handled by the calling program.
If the calling program does not handle the exception
The RAISE statement terminates the program and switches to debugging mode.
The MESSAGE ..... RAISING statement display the specified message. How the processing continues depends on the message type.
If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE ..... RAISING statement does not display a message. Instead, it fills the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
An ABAP/4 module lets the system know that an error has occurred by issuing information,error or warning messages. you can also use success messages when a particular action is performed successfully. When the user presses ENTER, the current process is interrupted. The system returns the user to the SAP main menu using Abend message.
Message is displayed using MESSAGE Xnnn, where X is the type of the message and nnn is the number of the message.
You have to declare the Id of the message class in the program using
MESSAGE-ID cc,where cc is the message class.
2009 Apr 17 5:49 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |