Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Explicitly change the Batch Job status programatically

Former Member
0 Kudos

Hi All,

I am runnign one program from batch mode. Eve if i have error in my program in aby step like 'Delivery does not exist' or 'Shipment does not exist', my program is executed in batch mode with status as 'Finished' - but no spool number is generated. And i am showing all these error in Application Log(SLG1). I want my batch job status to be 'Cancelled' when there is atleast one error.

In online mode , i can come out of the program control incase of error using 'Leave to transaction Zxxxx'. In case of batch mode, i want to set the batch status to 'cancelled' mode when any error is encountered.

Can some one help me please...

4 REPLIES 4

naimesh_patel
Active Contributor
0 Kudos

You can give one ERROR message at end of you program. This ERROR message will put your Job status as Cancelled.

Check if you have filled any message in the table for Application Log, than give ERROR message like


message e398(00) with 'Some Error occurs. Check application log'.

Regards,

Naimesh Patel

0 Kudos

Hi,

I think this error wont set the status as cancelled - rather it will display that message in the log as 'E' and set the status as 'Finish'.

0 Kudos

How do you process your Application Log?

Regards,

Naimesh Patel

0 Kudos

If you are using the FM APPL_LOG_WRITE_MESSAGES to write your log to your log object, than you can check if the MESSAGES has any message or not. If there are any message, just give the Error MESSAGE to set your background job in cancel mode.

Check out the solution: [Generate Application Log|http://help-abap.blogspot.com/2008/10/generate-application-log.html] on my professional blog.

Specifically, look for the last code snippet.

Regards,

Naimesh Patel

Edited by: Naimesh Patel on Oct 2, 2008 8:43 PM - Added Link