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.
Create an Event in SM64, in my case it is ZTRIGGER.
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.
CALL METHOD CL_BATCH_EVENT=>RAISE
I_EVENTID = ‘ZTRIGGER’
* I_EVENTPARM =
* I_SERVER =
* 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 SY–SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
In the process chain, create a process chain step with Process type “ABAP Program” with the variant as in below screen.
Include the Program in the last step of process chain as in below screen.
Final step is change the Start variant scheduling option of process chain using “after event”. The event we use is ZTRIGGER.
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:
- In SM64, select the created event ZTRIGGER and hit execute OR
- We run the program ZRAISE_EVENT which we had included in process chain to trigger event. OR
- 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.