04-27-2006 10:48 AM
Hi everybody!
I need to run program in the background.
So I need only to change the sy-batch status to 'X'?
04-27-2006 10:50 AM
Hi,
Yes when sy-batch = 'X' the program is executed in the background.
Regards,
Sameena
04-27-2006 10:50 AM
Hi,
Yes when sy-batch = 'X' the program is executed in the background.
Regards,
Sameena
04-27-2006 10:53 AM
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
04-27-2006 10:53 AM
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
04-27-2006 10:54 AM
04-27-2006 10:57 AM
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.
04-27-2006 11:01 AM
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