Examples: Dynamically defining and updating SAP jobs

This section describes some usage examples of this feature:
Job definition and run scenario using the -flag type=exec parameter

The following example creates and runs a 3-step job. The first step runs the ABAP MYPROG1 using variant VAR01 and associated variant parameter. Step 2 has a step user defined. Step 3 uses the same ABAP as step 1 with no associated variant.

The only requirement is that the elements referred to are known in the SAP system (user, program). If the variant does not exist, there should be a set of values to define the content of the variant for its creation (pairs of –vparN -vselN parameters for the parameters and selections of the ABAP program).

-job TESTJOB01 –c A
-s1 type=A –s1 program=MYPROG1 
–v1 VAR01 –vpar1 TESTNAME=TST
-s2 report=SPOOLX1 –s2 user=PRTUSER
–s3 type=A –s3 program=MYPROG1 –flag type=exec

The job returns job ID 12345678

Job copy and overwrite the job created in the previous step
The following job statement references the job created in the previous example. A new copy of the job is made and the parameters specified in the invocation are used to update the definition. In this case the variant for step 1 is modified and a new external program step (Step 4) is added.
-job TESTJOB01 –i 12345678 
–s1 variant=VAR01A 
–vpar1 TESTNAME=TST2
–s4 type=X -s4 report=niping –s4 parameter=-t 
-flag type=exec
Copy and overwrite a job referencing an existing job template
The following example shows a job creation referencing a job template (previously created without using this feature). A template job called TEMPLAJOB already exists on the SAP system with an ID of 56780123. It is a single ABAP step job to which we now add some print parameters.
-job TEMPLAJOB
–I 56780123 -s1 pr_immed 
-flag type=exec
A temporary variant is created using the information indicated in the expression
The following is the syntax to be used:
-vpar1 <parameter_name>=<parameter_value> ... 
-vsel1 <selection_option_name> 
... -vtemp1
The following example shows how you can submit a job that creates a temporary variant that is assigned to step number 1, and assigns a value to a variant parameter for step number 1:
-job TESTJOB01 -C A -flag type=exec -user R3USER 
-s1 type=A -s1 program=MYPROG1 
-vtemp1 -vpar1 TESTNAME=TST
The following example shows how you can submit a job that creates a temporary variant that is assigned to step number 1, assigns a value to a variant parameter for step number 1, and assigns a value to a variant selection option (date) for step number 1:
-job TESTJOB01 -C A -flag type=exec -user R3USER 
-s1 type=A -s1 program=MYPROG1 
-vtemp1 -vpar1 FILENAME=FLN 
-vsel1 date=E#BT#20110101#20110412
Assign a temporary variant to the specified step number
The following is the syntax to be used:
-v1 <temporary_variant_name> -vtemp1
The following is an example of how you can submit a job to assign a temporary variant, which has already been created (as in the previous example), and assign a value to step number 1:
-job TESTJOB01 -C A -flag type=exec -user R3USER 
-s1 type=A -s1 program=MYPROG1 
-vtemp1 -v1 &000000000001
The value for a temporary variant that already exists is substituted with the value indicated in the expression
The following is the syntax to be used:
-v1 <temporary_variant_name> -vpar1 <parameter_name>=<parameter_value> ... 
-vsel1 <selection_option_name> ... -vtemp1
The following is an example of how you can submit a job that substitutes the value of a temporary variant, which must already exist, with a new value. The temporary variant must exist, otherwise, the expression returns an error.
-job TESTJOB01 -C A -flag type=exec -user R3USER 
-s1 type=A -s1 program=MYPROG1 
-vtemp1 -v1 &000000000001 -vpar1 TESTNAME=TST2