There are some cases in which data needs to be loaded after a user has performed some sort of action. For example, you may have a process chain that loads data from a flat file that a user updates. The process chain needs to be executed after the user updates the flat file. This method of process chain execution will allow the user to kick off the process chain directly instead of contacting the BW consultant to execute it.
The process that we use in order to make this work is simple. A process chain can be started by an event. So we create an event and schedule the process chain to start after this event. Then we create a program that raises this event and we link it to a transaction. All the user then does isexecute the transaction which in turn raises the event that kicks off the process chain. Here are the steps:
1. Go to SM64 and then click on the create icon on the BckProcEvnts tab. You will then see the following screen:
2. Type in an event name (without spaces) and a description and click on Save.
3. Next, open your process chain and change the start variant and change the scheduling options selections. Enter the name of your newly created event in the after event box and select “Periodic Job” if applicable.
4. After saving the variant and the chain, activate and schedule it. Your chain has now been linked to the event. You can test this by raising the event in SM64. Select the event and click on the “Trigger…” icon. Your process chain should then run.
5. Next you need to create your program. Go to SE38 and create a program with the following code.
REPORT YourReportName MESSAGE-ID bt.
DATA: event LIKE tbtco-eventid VALUE 'YourEventName'.
* Raise event
CALL FUNCTION 'BP_EVENT_RAISE'
EXPORTING
eventid = event
EXCEPTIONS
bad_eventid = 1
eventid_does_not_exist = 2
eventid_missing = 3
raise_failed = 4
OTHERS = 5.
CASE sy-subrc.
WHEN 0.
MESSAGE i250 WITH event. "successful
WHEN 2.
MESSAGE i042 WITH event. "does not exist
WHEN 4.
MESSAGE i249 WITH event. "failed
ENDCASE.
CALL TRANSACTION 'RSPCM'.
6. At the end of the code above transaction RSPCM is called. This provides the user with the ability to monitor the run of the chain. Only once the chain has run successfully should the user run his report in BW. You can test this program by executing it in SE38. The event will be raised and you should then be able to monitor the running of the process chain in RSPCM.
7. The final piece that puts all of this together is linking the program to a transaction. We do this in transaction SE93
8. Enter a transaction code (must start with Z or Y) and click on create.
9. Give your transaction a description and press enter.
10. Enter your program name and Save. Test this by running the transaction.
No comments:
Post a Comment