2007 Nov 01 8:25 AM
hi abapers,
i have simple code:
report ytest.
write:/ 'hello sap'.
ca anyone pls give me the full code how to schedule this<b> program in background
for a specific time not immediately and to display it though spool.
all things is to be done programitically (t cde sm36 sm37 not to be used)</b>
regards
pankaj
hi abapers,
i have simple code:
report ytest.
write:/ 'hello sap'.
ca anyone pls give me the full code how to schedule this<b> program in background
for a specific time not immediately and to display it though spool.
all things is to be done programitically (t cde sm36 sm37 not to be used)</b>
regards
pankaj
2007 Nov 01 8:30 AM
Pankaj,
Use the following Function modules to schedule a job programtically.
job_open
job_submit
job_close
K.Kiran.
2007 Nov 01 8:30 AM
refer this and set ur parameters accordingly...
JOB_OPEN->For opening a job in the background
JOB_SUBMIT->For submitting the job
JOB_CLOSE->For closing the job.
Take a look at the example code for these functions.
http://www.sap-basis-abap.com/sapac018.htm
*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.
Regards
vasu
2007 Nov 01 8:45 AM
hi vasu sir,
why u have checked startimmedieate parameter check in fm job_close.
and sir what to do if program has sel screen like this:
REPORT YTIME .
tables: makt.
data: begin of itab occurs 0,
matnr like makt-matnr,
maktx like makt-maktx,
end of itab.
select-options: s_mat for makt-matnr.
select matnr maktx from makt into table itab where matnr in s_mat.
sort itab by matnr.
loop at itab.
write:/ itab-matnr, 45 itab-maktx.
endloop.
sir iwant this code to run every night at 1 am.
how to achive this . how will i attach variant pls help.
regards
pankaj
2007 Nov 01 8:48 AM
Pankaj,
Give the program name in SE38 click on the program in menu bar,click execute,and click background,create a varinat and schedule the job.
K.Kiran.
2007 Nov 01 8:51 AM
hi kiran sir,
i want to do all things programitically.
thaks
pankaj
2008 Jun 10 11:25 AM
hi kiran,
if u have found the solution please reply back. even i am facing the same problem.
Thanks in advance.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |