Adding Functions To Events Using CRMV
Adding Functions To Events Using CRMV
In the top there is a 'Read This Information' button, which actually contains
valuable information.
In the next block, called Assignments, you can see 5 fields, where the last
field is the Callback field. This field contains the functionmodule to be called,
and the 4 fields above are the determination fields. So logically explained, if
the situation occurs where the 4 fields are true, the funtion in the callback
field is called.
In the next block, called Definitions, you can find the customizing of the
Events, Objects etc which are used for the determination. Under normal
circumstances, there is no need to adjust anything here, except in the
Object Function / Callback option. Here, you are able to add a custom Zfunction, which you can then use in the Assignments. I will show this later.
The last block called 'Checks' is a report that tells you which functions will be
called for a specific transaction type or item type. This basically is a report
that helps you determine which functions are raised.
Instead of adding entries to CRMV_EVENT as described here, it's probably
better to add the callback function in transaction SM30 -->
CRMV_EVENT_CUST, or via the IMG (SPRO-->CRM-->Transactions-->Basic
Settings-->Edit Event Handler Table). The result will be the same, but this is
probably a more upgrade-proof solution.
Example
Let's say you want a certain field to be occupied with a certain value based
on certain values in the transaction. You could then build a function where
you first do a CRM_ORDER_READ (reads from the buffer, so pretty quick),
followed by your logic and a CRM_ORDER_MAINTAIN to update the
document. It is not recommended to add a commit in a function that is
called by an event. Add this function to the object on event '78 Before
Saving'.
The Attribute field