Application Development and Automation 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: 
Read only

cancleling a background job through ABAP code

Former Member
0 Likes
605

hi

in my report i have a condition like this

if s_erdat > sy-datum.

xxxxxxxx

xxxxxxxxxxx

xxxxxxxxx

xxxxxxxx

endif.

if my selection screen date is grater than the system date i dont need to run the report at all

when i am running this report in back ground and i have given the erdat date greater than the system date my job status is finished.

but i dont want the job to be finished i want the job to be cancled. in this case how i need to modify the code

hi

in my report i have a condition like this

if s_erdat > sy-datum.

xxxxxxxx

xxxxxxxxxxx

xxxxxxxxx

xxxxxxxx

endif.

if my selection screen date is grater than the system date i dont need to run the report at all

when i am running this report in back ground and i have given the erdat date greater than the system date my job status is finished.

but i dont want the job to be finished i want the job to be cancled. in this case how i need to modify the code

4 REPLIES 4
Read only

former_member156446
Active Contributor
0 Likes
570
if s_erdat > sy-datum.
xxxxxxxx
xxxxxxxxxxx
xxxxxxxxx
xxxxxxxx
else.
message e001 text-001. "date is lower than the current date.
endif.

if you raise a error message background job will be cancelled with the text 001 in job spool..

Edited by: Jackandjay on Apr 22, 2008 12:57 AM

Read only

Former Member
0 Likes
570

Hi,

The background job will show the status as finished because although ur output has not been generated ur report has been run .

since ur date condition is in the code the code is run so u cannot get a cancelled status.

Regards,

Mrunal

Read only

Former Member
0 Likes
570

Hi

Put ELSE befor endif in ur coding.

i think this will solve ur problem.

Reward me point

By

Pari

Read only

Former Member
0 Likes
570

Hello Ram-

If you dont want the background job to be created when s_date > sy-datum.

If s_date > sy-datum.

sy-batch EQ space. ***Hard code batch job to space.

<<<<<<

endif.

Cheers,

~Srini...