2007 Jul 16 9:33 PM
HI,
I am checking one condition inside the loop
like
if v_filedata ne v_lines .... that means here i am comparing the number of records in the file and the number of records read... if those are not equal then i have stop processing by giving some error message i have to come out of the program
can anyone guide me how to do that?
SRI
2007 Jul 16 9:36 PM
if v_filedata ne v_lines.
Message '<your mesage here>' TYPE 'E'.
ENDIF.
Regards,
Sudhir Atluru
2007 Jul 16 10:03 PM
SUDHIR,
does it stop the further processing of the program.....
without any exit statement....
2007 Jul 16 10:06 PM
Sri,
You can use <b>EXIT</b> command to exit from the loop...
Chandra.
2007 Jul 16 10:32 PM
I have to stop the program completly from the further processing......
2007 Jul 17 12:30 AM
Yes issuing an error message will stop further processing of the program. But remember that a message is typically intended for online execution. But if the same program is executed in the background, then the background job will go to a cancelled status when you issue an error message. You will see the message itself in job log. WRITE statements will go to the spool but MESSAGE statements will be seen in job logs.
But in both cases, any further processing will be stopped immediately. If you want to write message to the spool and still achieve the same result, you can always keep a flag to inform that an error occured and check if this flag is set in the rest of the processing.
loop at itab.
if error condition met.
flag = 'E'.
exit.
else.
flag = 'S'.
endif.
endloop.
if flag = 'E'.
write:/ 'Error occured'.
exit.
endif.
2007 Jul 16 9:41 PM
Since you want to use error messages also, I would recommend that you use Exception Objects, which can easily be caught by the calling program.
RAISE EXCEPTION TYPE your_exception_object
EXPORTING
textid =
previous =
msgid =
msgno =
msgty =
msgv1 =
msgv2 =
msgv3 =
msgv4 =
.
Christian
2007 Jul 16 10:38 PM
Hi,
Please use STOP statement to exit/stop the progam.
Regards,
Ferry Lianto