2005 Sep 28 12:54 PM
Hi,
I have a background job with has a start condition after execution of a particular event.
Now i need to copy this background job to another name and execute it. I tried using the function module BP_JOB_COPY, but that copied the background job without the job start conditions. How can i copy the background job along with start conditions.
Thank you in anticipation.
2005 Sep 28 1:09 PM
Hi,
The FM is only for the Copy of the BG job.
The same way BP_JOB_CREATE will create a job and will not specify the job start conditions.
The copy of the job includes job steps and associated attributes such as the user for authorizations and printing/archiving specifications. However, the copy has no start specifications. These you must specify yourself.
User has to manually specify the parameters.
Amit
2005 Sep 28 1:46 PM
Hi Amit,
Could you please let me know how to do this programmatically?
2005 Sep 28 2:16 PM
Hi Nikhil,
the follwoing code schedules 2 jobs from a source job (which is maintaned in the system).
data: s_tbtcjob1 like tbtcjob, "target job #1"
s_tbtcjob2 like tbtcjob. "target job #1"
data: h_1 like tbtco-jobcount, "jobcount"
h_2 like tbtco-jobcount, "jobcount"
h_1s like tbtco-jobname, "jobname source"
h_2s like tbtco-jobname, "jobname source"
h_1t like tbtco-jobname, "jobname target"
h_2t like tbtco-jobname. "jobname target"
selection-screen begin of line.
selection-screen position 2.
parameters ra radiobutton group rad1.
selection-screen comment 4(70) text-001.
selection-screen end of line.
selection-screen begin of block block1 with frame.
parameters: p_a1 like h_1,
p_a1s like h_1s,
p_a1t like h_1t,
p_a2 like h_2,
p_a2s like h_2s,
p_a2t like h_2t.
selection-screen end of block block1.
start-of-selection.
perform create_jobs using p_a1 p_a1s p_a1t p_a2 p_a2s p_a2t.
*---------------------------------------------------------------------*
* FORM CREATE_JOBS *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form create_jobs using h_1 h_1s h_1t h_2 h_2s h_2t.
call function 'BP_JOB_COPY'
exporting
dialog = 'N'
source_jobcount = h_1
source_jobname = h_1s
target_jobname = h_1t
importing
new_jobhead = s_tbtcjob1
exceptions
cant_create_new_job = 1
cant_enq_job = 2
cant_read_sourcedata = 3
invalid_opcode = 4
jobname_missing = 5
job_copy_canceled = 6
no_copy_privilege_given = 7
no_plan_privilege_given = 8
others = 9.
call function 'BP_JOB_COPY'
exporting
dialog = 'N'
source_jobcount = h_2
source_jobname = h_2s
target_jobname = h_2t
importing
new_jobhead = s_tbtcjob2
exceptions
cant_create_new_job = 1
cant_enq_job = 2
cant_read_sourcedata = 3
invalid_opcode = 4
jobname_missing = 5
job_copy_canceled = 6
no_copy_privilege_given = 7
no_plan_privilege_given = 8
others = 9.
call function 'JOB_CLOSE'
exporting
jobcount = s_tbtcjob2-jobcount
jobname = s_tbtcjob2-jobname
pred_jobcount = s_tbtcjob1-jobcount
pred_jobname = s_tbtcjob1-jobname
targetsystem = '<<SYSTEM IN CASE OF MULTIPLE SERVERS>>'
exceptions
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
others = 8.
call function 'JOB_CLOSE'
exporting
jobcount = s_tbtcjob1-jobcount
jobname = s_tbtcjob1-jobname
strtimmed = 'X'
targetsystem = '<<SYSTEM IN CASE OF MULTIPLE SERVERS>>'
exceptions
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
others = 8.
endform.
2005 Sep 28 2:40 PM
Hi,
As mentioned earlier, I am able to copy the job using the function module BP_JOB_COPY, but i was not able to copy the start conditions. How to copy the start conditions of one job to another?