Kolkata
At times the business requirement demands that if the user changes some data from a standard SAP transaction, the same will be noted down in some form and subsequently a daily batch job will pick up that information and will send to another system. One way to achieve this type of requirement is to have the business events set up for this standard transaction in question (provided that transaction calls the business events in it). There are a number of business events declared in a SAP system that may be of use. The transaction is BF34 where we need to configure the business events.
Step-1
In the BF34 transaction, SAP provides the opportunity to configure the Business events and the corresponding function modules:
There is a F4 drop down help available for these business events as shown below:
One can easily choose the business events from this drop down box.
For every event number one corresponding function module exists.
Step-2
The function module SAMPLE_INTERFACE_00001340 is a function module template that needs to be copied as a Z-function module and then altered so that the desired functionality can be achieved. Please see the following screenshots for details:
The existing template:
Please note that this function module contains all the details about the relevant data as importing parameters. The example above is relevant to the event no. 00001340, which is ‘Customer Master data: Final checks’. All data corresponding to this transaction is available within this function module. The idea is to create a custom function module by copying this template function module and then add additional code in that to get the desired functionality.
A real life scenario:
A typical case can be monitoring the customer hierarchy (tcodeVDH1N) for any create/change/delete in the hierarchy relationship. This is important when the client decides that he/she will use non-SAP software (e.g. I-MANY) to monitor the rebate amount distribution. This is a primary requirement for the I-MANY software that the customer hierarchy relationship is in sync with SAP.
The business events for the customer hierarchy create/change/delete are as below: -
These events are configured in the BF34 transaction as below: -
Using transaction BF24 we can create the “Product” as shown below:
The requirement was to write down the create/change/delete information for the customer hierarchy in three different custom tables with the Higher-level customer number and the validity start, end dates. The Z_CS_LOG_CH_CREATE,Z_CS_LOG_CH_CHANGE, Z_CS_LOG_CH_DELETE function modules accomplishes the same.
How does this work?
In the standard SAP transaction VDH1N, the standard code issues outbound function calls as below: -
For the creationà the outbound call is made for the business event 00504004
For the change à the outbound call is made for the business event 00504005
For the deletionà the outbound call is made for the business event 00504006
These events have been set up in the configuration as shown above. So, whenever there is a change in the customer hierarchy by the standard SAP transaction, the same is being logged by these custom function modules via the business events.
There is a separate program, which is scheduled to run once daily, which picks up the information for the day it is running, from these custom tables and sends Idocs to the non-SAP system.
No comments:
Post a Comment