When BTE is being used ?
You have a scenario to trigger a workflow from a business transaction and you reach to conclusion (after viewing event trace in transaction SWEL) that no event is triggered when that transaction is executed. Now how would you trigger a workflow as there is no triggering event? Now the BTE is coming to picture.
As per business requirement, it is required that Journal Entry should only be posted after approval is given. It is required from Audit perspective As per the current functionality there is no approval process for posting of a parked Journal Entry for AP company codes. The desired functionality for the development is a Workflow approval process for Journal Entries Parked and Posted for particular company codes.
The Workflow approval process will be triggered on selecting the Save as Complete button for Parking the Journal Entry using the transaction code FV50 and FV50L. And on selecting the Complete button for FBV1, F-65 and YFIGL_PARK transaction code.
Triggering Point of Workflow
Workflow will be triggered from BTE 2220(YPNP_BTE_00002220). Following are the reason why BTE was chosen to trigger workflow.
a. Workflow must trigger only when “Save as complete” button is pressed.
b. Workflow must trigger only for certain company codes and tcodes.
c. Header and Line item tables must be mapped to workflow.
d. Map preparer, preparer emailid, approver, approver emailed to workflow.
e. To check if change event has occurred.
f. Check if preparer has changed the approver or document amount. If yes then notify to approver that preparer has changed the document. In this case set status of the current workflow to COMPLETE.Trigger new workflow.
g. Check if delegate has been detected by workflow for the approver specified. If yes trigger notification to preparer that delegate has been found and send action mail to
Workflow will be triggered by executing Function module ‘SAP_WAPI_START_WORKFLOW’ start in new task.
Change event will be detected and passed to workflow by FM ‘SWE_EVENT_CREATE_IN_UPD_TASK’.
Steps for configuring the Business Transaction Events:
IMG Menu Path: Financial Accounting ->Financial Accounting Global Settings-> Business Transaction Events-> Environment-> Infosystem (Processes).
When click on Infosystem you will get the following screen OR use T-code BERE.
Execute the search with the defaults and find the correct interface for updating the document from below option.
- Place the cursor on the key 00002220 and click on Sample Function Module
- This navigates you to SE37 – Function Builder. This is the function module (SAMPLE_PROCESS_00002220) we would need to copy into a Z or Y function module for coding
- Click on copy button.
Add the code according to your requirement and activate the Function Module
To assign this function module to the event, we need to create a product. Go back to the first screen and click as shown below
Click new entry and add a new product as below.
Ensure the active check box is checked , then only the BTE will trigger. Now the function module has to added to the event. Do as per the following screenshots.