Skip to Content
0
Former Member
May 12, 2010 at 01:24 PM

Add step to a job chain dynamilcally

52 Views

Hi everybody,

Below is the code to schedule different variants of a program through single script. This code schedules a job for N number of variants of the program but in PARALLEL job chain. I want to schedule job for each variant SEQUENTIALLY. For this purpose I want to add a STEP dynamically in the code so that the job is scheduled in SEQUENCE for each variant.

Current job chain is: PROG 1, VARIANT1

PROG 1, VARIANT2

PROG 1, VARIANT3

I need to execute the job chain as: PROG 1, VARIANT1 -> PROG 1, VARIANT2 -> PROG 1, VARIANT3

The each variant must be scheduled one after another.

Here is the coding-

declare
  cursor c_var
  is
   select ABAP_PROGRAM_NAME,
	  ABAP_VARIANT_NAME
    from  RSI_ABAP_PROGRAM_VARIANTS
    where ABAP_PROGRAM_NAME = 'RM06EV47'
      and ABAP_VARIANT_NAME like '%JEN%';

begin
  for r_var in c_var
  loop
    jcs.parameter('RSI.Z_RSI_ABAP_RUN', 'ABAP_VARIANT_NAME', r_var.abap_variant_name);
    jcs_out.put_line ('ABAP_VARIANT_NAME~~' || r_var.abap_variant_name);
    jcs.submit( name => 'RSI.Z_RSI_ABAP_RUN' );
  end loop;

-- Commits submitted job
  COMMIT;
  jcs.wait();

end;

How can I add a step in this coding?

Any other approach is also welcome!!

Thanks & regards,

Jenisha