In this article we will discuss on how to trigger the process chain through events with the help of RDA.
We have a scenario where we have to trigger a process chain through events and that event will be called in the end routine of transformation. DTP will be triggered by RDA which will execute the end routine in the transformation and hence the process chain.
How to Achieve:
We will create the event in transaction SM64 and this event will be added in the Process chain. RDA Data Source will be assigned with transaction RSRDA. In the end routine, between DSO and Data Source, BP_EVENT_RAISE Function Module will be called by RDA which triggers the event which in turn triggers the process chain.
Go to transaction SM64 and click on create button to create event. Give event name and description as required.
Goto transaction RSRDA and click on create Daemon. Give the description as needed and click save.
Right click on the data Source you want and give Daemon ID created in 1st step.
Once above step is done, Data Source will be available under Daemon created, as shown below.
Right click on the Data Source selected and select Assign DTP.
Check the checkbox, as shown below, to assign DTP.
The DTP and Info Package get assigned, as shown below. Period can be changed by right clicking on Data Source and selecting assign daemon.
Go to end routine of the transformation of DSO and DTP and put below code.
In the above select statement, give the Process Chain ID you want to trigger. The above code selects Process Chain ID and its Status from the table RSPCLOGCHAIN. It checks the status of the chain is A (Active) i.e. if it’s running or not. If the Status is not ‘A’ then it will raise the FM BP_EVENT_RAISE which will trigger the event ‘ZTEST_EVENT’ which we have created and if the Status is ‘A’ it will sleep for 10 seconds.
Table RSPCLOGCHAIN contains the various Process chain parameters like Process chain ID, Log ID, Variant Name, Status, Timestamp etc.
Select the Process Chain which needs to be triggered. Right click on the Process Chain and select Maintain Variant.
Now, select Direct Scheduling and click on Change Selections.
Select After Event and give event name. Also check the Periodic Job checkbox.
Goto RSRDA transaction, right click on the Data Source and select Start Upload.
Once this is done it will trigger the DTP and End routine will be triggered. The BP_EVENT_RAISE FM will be triggered in the end routine which will start the process chain.