Event Based Process Chain Using ABAP Program BTC_EVENT_RAISE
There may be a requirement where you may need to schedule a process chain after an event is being triggered.
In this Example I have a process chain A runs weekly, when completed should trigger an event which will result in execution of Process chain B.
Steps to be followed is as follows :
Step 1) Creating an Event –> Go to Transaction code SM62 –> Select BckProcEvnts tab –> Create an event.
In the snapshot above we can see I have created an Event ‘ZTEST’.
Step 2) Creating variant for Program ”BTC_EVENT_RAISE”
Go to se38 –> Enter Program name ‘BTC_EVENT_RAISE’—> Select Variant radio Button –> Click Display
Enter a name for Variant and click ‘Create’.
In the following screen, enter the event name which you have created in SM62 (in Step 1). In my case I had created ‘ZTEST’ Event.
Click on Attributes , enter description for variant and click on ‘Save’
Step 3) Go to Process Chain A
At the end of your Process chain, insert process type ‘ABAP Program’.
In the next Screen insert the ABAP Program ‘BTC_EVENT_RAISE’.
Enter the variant created in Step 2.
Your Process chain A will look like this
Schedule process chain A as per your requirement .Example I scheduled it weekly, (on Sunday, Morning 6 AM)
Step 4 ) Go to your RSPC and open Process chain B
Go to Start Variant –> Change selections –> After Event –> Enter the Event Name created in Step 1.
Check box ‘Periodic job’
Now , every Sunday 6 am Process chain A gets executed. As soon as the ABAP Program is completed in the last step of Process chain A, event ZTEST is gets triggered and as a result of that Process chain B starts.
So you get the desired result as per event based scenario.