07-14-2008 11:48 AM
Hi Experts,
Can a transaction be called in background dynamically using ABAP program without BDC???
Regards,
Mansi.
07-14-2008 12:17 PM
Hello SAPUSER,
Try this code..
REPORT yh_sample.
PARAMETERS TCODE TYPE TCODE.
sy-batch = 'X'.
call transaction TCODE .
schedule this program in background using SM36 and give the variants.
Hope this helps you.
Indu.
07-16-2008 5:39 AM
I cannot schedule the program in background since the program name wil change depending on the input from user.
So is it possible to call a program in background dynamically ??
07-16-2008 5:51 AM
u can create job dynamically through programming..Try this sample code..
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 << Here it is a static call but u can make it dynamic
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,
JOy.
07-16-2008 5:53 AM
Hello sapuser,
Maybe you can try this for your requirement..
Try using the CALL FUNCTION <funct> IN BACKGROUND TASK.
This flags the function module funct to be run asynchronously. That is, it is not executed at once. Instead, the data passed using EXPORTING or TABLES is placed in a database table and the next COMMIT WORK executes it in another work process.
Hope it might help you
Regards
Indu.
07-14-2008 12:19 PM
Hello Mansi,
If it helps, I do that with SUBMIT statement (if applyable). But there, I don't call the transaction, but instead I call the program behind it.
Kind regards.
Bruno
Edited by: Bruno Garcia on Jul 14, 2008 11:19 AM
07-16-2008 5:55 AM
hi
good
I dont think you can call a Transaction Code in background without using the BDC.
Thanks
mrutyun^