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: 

Running program in the background

Former Member
0 Kudos

Hi everybody!

I need to run program in the background.

So I need only to change the sy-batch status to 'X'?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Yes when sy-batch = 'X' the program is executed in the background.

Regards,

Sameena

6 REPLIES 6

Former Member
0 Kudos

Hi,

Yes when sy-batch = 'X' the program is executed in the background.

Regards,

Sameena

vinod_gunaware2
Active Contributor
0 Kudos

U can create variant to ur selection screen and

SE38->Program->excute->backgound

or u can do it by sy-batch = 'X'

and also check other parameter of <b>syst</b> structure

regards

vinod

Former Member
0 Kudos

Hi,

You usually run a report program by pressing F9 on the selection screen and then it will be scheduled.

Other wise you can schedule the job using SM36.

The system variable sy-batch will be set to X, when the program runs in background. But by setting the variable, the program will NOT be executed in background.

Regards,

Ravi

Note : Please mark the helpful answers

Former Member
0 Kudos

Hi,

Yes ur correct.

rgds,

Latheesh

Former Member
0 Kudos

Hi LOS,

If you want to schedule the program in background mode

programitically then ned to do dome steps and submit

the program in background. If you are manually running

it in bj then some of the statements need to be

executed in bj tehn put SY-BATCH = 'X'. Then in

Backgroung mode only it will consider those statements.

Thanks&Regards,

Siri.

Former Member
0 Kudos

HI,

if your program is runninn in the Background then the System field SY-BATCH will become 'X' otherwise it will have space ......

it will not execute the job in the background if you put SY-BATCH = 'X'

you need to use: Job_open , Job_submit and job_close function modules

example:

*Submit report as job(i.e. in background)

data: jobname like tbtcjob-jobname value

' TRANSFER TRANSLATION'.

data: jobcount like tbtcjob-jobcount,

host like msxxlist-host.

data: begin of starttime.

include structure tbtcstrt.

data: end of starttime.

data: starttimeimmediate like btch0000-char1.

  • Job open

call function 'JOB_OPEN'

exporting

delanfrep = ' '

jobgroup = ' '

jobname = jobname

sdlstrtdt = sy-datum

sdlstrttm = sy-uzeit

importing

jobcount = jobcount

exceptions

cant_create_job = 01

invalid_job_data = 02

jobname_missing = 03.

if sy-subrc ne 0.

"error processing

endif.

  • Insert process into job

SUBMIT zreport and return

with p_param1 = 'value'

with p_param2 = 'value'

user sy-uname

via job jobname

number jobcount.

if sy-subrc > 0.

"error processing

endif.

  • Close job

starttime-sdlstrtdt = sy-datum + 1.

starttime-sdlstrttm = '220000'.

call function 'JOB_CLOSE'

exporting

event_id = starttime-eventid

event_param = starttime-eventparm

event_periodic = starttime-periodic

jobcount = jobcount

jobname = jobname

laststrtdt = starttime-laststrtdt

laststrttm = starttime-laststrttm

prddays = 1

prdhours = 0

prdmins = 0

prdmonths = 0

prdweeks = 0

sdlstrtdt = starttime-sdlstrtdt

sdlstrttm = starttime-sdlstrttm

strtimmed = starttimeimmediate

targetsystem = host

exceptions

cant_start_immediate = 01

invalid_startdate = 02

jobname_missing = 03

job_close_failed = 04

job_nosteps = 05

job_notex = 06

lock_failed = 07

others = 99.

if sy-subrc eq 0.

"error processing

endif.

Thanks

Sudheer