Skip to Content
Author's profile photo Chandra Sekhar Varra

Self-loop of Process chain

The purpose of this document is to repeat the same process chain once it gets finished without manual intervention.

We will use Events to trigger process chain and the trigger of event is placed as the last step of process chain.

Implementation steps:

Create an Event in SM64, in my case it is ZTRIGGER.

/wp-content/uploads/2014/04/1_425348.png

 
Next step is to create a program in SE38 to trigger this event.

We have the function module BP_EVENT_RAISE to trigger event but it is Obsolete so we will use Class CL_BATCH_EVENT and Method RAISE as suggested by SAP, in our program.

/wp-content/uploads/2014/04/2_425349.png

CODE:

REPORT  ZRAISE_EVENT.

CALL METHOD CL_BATCH_EVENT=>RAISE

  EXPORTING

    I_EVENTID                      = ‘ZTRIGGER’
*    I_EVENTPARM                    =
*    I_SERVER                       =
*  EXCEPTIONS
*    EXCPT_RAISE_FAILED             = 1
*    EXCPT_SERVER_ACCEPTS_NO_EVENTS = 2
*    EXCPT_RAISE_FORBIDDEN          = 3
*    EXCPT_UNKNOWN_EVENT            = 4
*    EXCPT_NO_AUTHORITY             = 5
*    others                         = 6

        .
IF SYSUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

In the process chain, create a process chain step with Process type “ABAP Program” with the variant as in below screen.

/wp-content/uploads/2014/04/3_425350.png


Include the Program in the last step of process chain as in below screen.

/wp-content/uploads/2014/04/4_425351.png


Final step is change the Start variant scheduling option of process chain using “after event”. The event we use is ZTRIGGER.

/wp-content/uploads/2014/04/6_425352.png

We are done.

Now we will schedule the process chain. How initial run of process chain happen? or if there is a failure in process chain and want to start the chain from beginning.

We have different ways to do that:

  1. In SM64, select the created event ZTRIGGER and hit execute OR
  2. We run the program ZRAISE_EVENT which we had included in process chain to trigger event. OR
  3. In the planning view of process chain, context menu of start, we have option to display job. We can copy the job and schedule with IMMEDIATE option.

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Jalina Vincent
      Jalina Vincent

      Thanks for providing the document. Can you please let me know how to stop the process chain in this case.

      Thanks.

      Author's profile photo Chandra Sekhar Varra
      Chandra Sekhar Varra
      Blog Post Author

      Kill the background Job, else remove the process chain from Schedule.

       

      Thanks