3 Replies Latest reply: Jan 5, 2010 10:48 AM by Fabien Airiau RSS

Schedule a process chain that loop on itself

Fabien Airiau
Currently Being Moderated

Hi everyone !

 

I have a process chain like this :

 

Start with an event --> ... --> steps --> ... --> In the last step an ABAP program relaunches the process chain but with conditions.

 

This process chain loads data in SAP-BW from csv files. I need this mecanism to load n files at each pass and to restart the chain if there are some other files to load.

 

I have to schedule this process chain daily.

If I schedule it daily as usual I will have an error if the loop takes more than 24h because two chains will be running at the same time.

 

So what can I do ?

 

My ideas are :

- to tell the chain to not start when an occurence of the same chain is already running ?

- to schedule dynamically the chain when at the end of the process chain in the ABAP program?

 

I've tried each of these but I've not been able to make it work...

Does anyone have an idea if either of these is possible ? If so, how ?

If not, any other suggestions ?

 

Thank you, best regards,

Fab

  • Re: Schedule a process chain that loop on itself
    aparna s
    Currently Being Moderated

    Hi

     

    Plz try adding a program in the end of this process chain to raise an event to call this chain back.

    Or if its a daily load then u can also add a check wait event.

     

    regards,

    aparna.

  • Re: Schedule a process chain that loop on itself
    Vikram Srivastava
    Currently Being Moderated

    Hi,

     

    Try this :

     

    
    REPORT  ZPCNEW.
    TABLES : RSPCLOGCHAIN.
    
    DATA : IT_tab TYPE TABLE OF RSPCLOGCHAIN,
           WA_tab TYPE RSPCLOGCHAIN.
    FIELD-SYMBOLS <fs> LIKE LINE OF it_tab.
    
    PARAMETERS :LV_CHAIN type RSPCLOGCHAIN-CHAIN_ID.
    select * from RSPCLOGCHAIN into table it_tab
    where CHAIN_ID  = LV_CHAIN
    and DATUM = sy-datum.
    
    SORT it_tab DESCENDING BY DATUM ZEIT.
    
    Read table it_tab INDEX 1 ASSIGNING <fs>.
    
    IF sy-subrc = 0.
      if <fs>-ZEIT < sy-uzeit.
      Message e000(sabapdocu) with 'Error'.
      else.
      MESSAGE i162(00) WITH 'Successful'.
      endif.
     else.
     MESSAGE i162(00) WITH 'Successful'.
     endif.
    

     

    -Vikram

    • Re: Schedule a process chain that loop on itself
      Fabien Airiau
      Currently Being Moderated

      Hello,

       

      Thank you for the quick answers !

       

      @Aparna : already done, I didn't know the "wait event". I'll read the documentation about that.

       

      @Vikram : that's a good solution. Your code doesn't work if the process chain is not running but have already been running today. But in RSPCLOGCHAIN I found all I need (ANALYZED, ANALYZED_STATUS...) to check if the process chain is running, so that solve my problem !

       

      Thank you both !

       

      Best regards,

      Fabien