‎2008 Dec 29 9:06 AM
Hi Experts,
I am using a FM in a User exit. I want to give an error message if the FM gives a sy-subrc NE 0 and then the program should stop working.
I am using tcode COR1 to create a process order.Once the program reaches that FM .if sy-subrc <> 0
then it reaches that message but neither it gives an error message output nor ends the program execution.
Following FM is used inside the User exit.CANCELLED is the exception in that user exit.
WHILE sy-subrc <> 0 .
CALL FUNCTION 'ENQUEUE_EZ_0901_WM_0001'
EXPORTING
mode_z09_2_3_2_1__001 = 'E'
mandt = sy-mandt
nryear = l-nryear
z_nrmonth = l-nrmonth
x_nryear = ' '
x_z_nrmonth = ' '
_scope = '2'
_wait = 'X'
_collect = ' '
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-index > 100 AND sy-subrc <> 0.
MESSAGE e398(00) WITH 'Please run this program again' RAISING cancelled.
EXIT.
ENDIF.
ENDWHILE.
Please guide me.
Regards,
Amit
‎2008 Dec 29 9:15 AM
‎2008 Dec 29 9:12 AM
hi,
after the exit statement try " leave to screen 0" and check wether it helps u to pull ot from the transaction code .
‎2008 Dec 29 9:15 AM
‎2008 Dec 29 9:16 AM
Raise exception with error message, the program automatically stop
Regards
Sasi
‎2008 Dec 29 9:18 AM
Hello Amit,
Please check that the condition that you have given for the message is true when you want to show the message.
i.e. sy-index should be greater than 100 also sy-subrc value should be '0' i.e. FM executed successfully, when both the condition are true then only you will be able to show the message that you want to show.
Try to display the message as Message 'Executed Successfully' type 'I'.
Hope it helps.
Regards,
Jayant.
‎2008 Dec 29 9:22 AM
Hi,
Try removing the raising cancelled and run.
IF sy-index > 100 AND sy-subrc 0.
MESSAGE e398(00) WITH 'Please run this program again'.
Leave list-processing.
ENDIF.
‎2009 Jan 02 8:44 AM