‎2007 Sep 24 10:43 AM
HI can anyone help in giving me step by step process of Background scheduling using bapi.
My requirement is to give the user 2 radio buttons one is for background processing and the other for foreground processing.
Can anyone help me how to do the background process with sample prog, it will be very helpful if u give a step by step explanation.
I also need to knw ow to chk those in sm37 and how to run the process frm there.
Kindly help me.
its very urgent.
Thanks
Naveen
‎2007 Sep 24 10:53 AM
HI,
You need to creatre the 2 Radiobuttons, is the Foreground is clicked then no need to wrtie the code for the background scheduling, if the Background radiobuton is checked then you need to write the below code
*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
Call the function module JOB_SUBMIT to submit a Backgroud job
"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.
‎2007 Dec 20 6:11 AM