Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

schedule a job by passing variant parameter

Former Member
0 Kudos

Hi,

We are trying to copy a job with it's all properties to another Job. In this process, 2nd job is schedule as per the following statement.

details:

called Prog name : Z_program1

variant : Zvaraint1

statement used here is " submit Z_program1 using selection-set Zvariant1 and return" something similar to that. However after execution, we have noticed that 2nd job got created with different variant name like "&0000000014" . Although we submitted variant name as "Zvariant1" from above statement, why it was taken a different variant name during 2nd job creation? can any one help me out here. How to pass the original variant to 2nd Job?

P.S, I don't want to use variant table.

Thanks

2 REPLIES 2

Sandra_Rossi
Active Contributor

SAP calls &0000000000000-&9999999999999 variants "temporary" or "internal".

Every time you use SUBMIT VIA JOB..., SAP creates an internal variant. This is explained in [ABAP documentation - SUBMIT - Job options|http://help.sap.com/abapdocu_70/en/ABAPSUBMIT_VIA_JOB.htm] :

> When the program is scheduled in the background task, the selections specified by the user or in the additions for filling the selection screen are stored in an internal variant...

Of course, it might be an issue if your program tests SY-SLSET variable, or have a program which analyzes the jobs based on the variant names (table TBTCP)

But I wondered why the variant is passed to the job step correctly when we submit a job manually.

By debug, I saw that SAP calls JOB_SUBMIT function module instead of SUBMIT ... VIA JOB ...

It seems it builds directly the steps of the job, with the right variant.

So, just replace SUBMIT ... with CALL FUNCTION 'JOB_SUBMIT' ... (and keep JOB_OPEN and JOB_CLOSE)

0 Kudos

Thanks Sandra for your suggestion,

Will try and action this thread appropriately.