‎2009 Feb 25 10:12 AM
Hi Experts ,
I have a query , how to add exceptions to a standard function module when there are no exceptions provided by default . Also please let me know by adding exceptions can we just throw a message and will we be able to prevent the program from going into dump.
‎2009 Feb 25 10:22 AM
Hi,
It is not possible to add exceptions to std FM without raising for an OSS message. After getting the key for editing the FM u can add the Exceptions and can give some messages in the program after a sy-subrc check. But this is not recommended as this FM might be used in different programs.
Keerthi.
Edited by: Keerthy K on Feb 25, 2009 11:23 AM
‎2009 Feb 25 10:22 AM
Hi,
It is not possible to add exceptions to std FM without raising for an OSS message. After getting the key for editing the FM u can add the Exceptions and can give some messages in the program after a sy-subrc check. But this is not recommended as this FM might be used in different programs.
Keerthi.
Edited by: Keerthy K on Feb 25, 2009 11:23 AM
‎2009 Feb 25 10:23 AM
Hi,
U can use Return code to avoid Dumb.
use PROCESS_MESS_GET_RETURN_CODE
or Search RETURNCODE* in SE37 find suitable FM to ur requirement
‎2009 Feb 25 10:26 AM
Hi Balaji,
As this is standard function module, I think you can't change its code, which will be required to raise some exceptions.
As for the second question if you use in FM such statement
RAISE exc.
Then after calling this FM you need to handle this exceptions, otherwise system will dump out.
CALL FM '....'
...
EXCEPTIONS
exc = 2.
if sy-subrc <> 2.
MESSAGE .... 'Exception raised'.
endif.
If you want to handle it inside the FM, you need to write like this:
MESSAGE .... RAISING exc.
After this when exception is raised system will end up the FM and the result is stored in sy structure
CALL FM '...'
...
EXCEPTIONS
exc = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Marcin
‎2009 Feb 25 11:10 AM
Hi Naveen ,
I had a look at the function module " PROCESS_MESS_GET_RETURN_CODE " but not sure how to use that to raise an exception , can you please help me with it , do you have any sample code showing the use of this FM .
Thanks
‎2009 Feb 25 12:01 PM
‎2009 Feb 25 12:06 PM
Hi,
You can define your own exceptions and inside the source code.... use RAISE statement to show the message without going into DUMP.
r
‎2009 Apr 27 3:37 PM