SAP CRM – Event Handler
The event handler is a standard tool in the processing of a business transaction, for communication between the different objects that influence each other. It is used to call function modules, named callbacks that are accessed when triggering an event at a certain time.Lots of SAP standard functionalities are implemented using SAP CRM event handler.
Use transaction code: CRMV_EVENT to view or create event handler.
For example, if there is a requirement that the program needs to populate a zfield in structure orderadm_i after calculating the price using IPC.
Step 1. We can define an event as showed in below image.
Object: PRIDOC,Event: AFTET_CHANGE means if the pricing document has been changed, the callback function module will be called automatically.
The callback function module needs to be added in table CRMC_FUNC_ASSIGN. There is no maintenance view for this table, but you can directly add a new entry in SE16.
Step 2. Define the call back function module.
The function module interface is fixed and slight different according to the call back setting in event handler definition. You can copy the interface of standard function module which has the same technical setting.
Step 3. Test your custom event handler
Set a session break point in your event handler function. When changing the order product, quantity, If the price document changed, the function module should be called accordingly.