Purpose This SAP-internal transaction enables you to register callbacks(function modules) for standard events in table CRMC_EVENT_CALL. When anevent is triggered by an object, theevent handler> does thefollowing:
- Searches in system table CRMC_EVENT_CALL to find the callbacks that are
registered for this event.
- Executes the corresponding function modules for event handling at the
defined time and with the defined priority. The event handler is called when business transactions are edited orsaved, but not when they are displayed. Note: Customers can register their own events in Customizing tableCRMV_EVENT_CUST, in Customizing for Customer Relationship Management > under Transactions -> Basic Settings ->Edit Event Handler Table>>. If entriesexist in both the system table and the Customizing table, the entries inboth tables are analyzed and sorted according to the priority and nameof the function module.Determining Events for Callback Registration To help you determine for which event and for which execution time toregister, you can use the event trace. This provides detailedinformation about event processing for you own user or for other users.You use the event trace as follows: For your own user, set the value X> for the user parameterCRM_EVENT_TRACE>. You do this under System -> User Profile -> Own Data> on theParameters >tab page. Call transaction CRMD_EVENT_TRACE>, enter auser and the maximum number of records, and execute. The trace report shows events, objects, callbacks, and execution times.You can refresh the trace report during transaction processing. By analyzing the events that have been set, and the execution times thathave been reached, you can decide which combination of event, object,and execution time is best for you.Registration of Callbacks for Events This section contains an explanation of the fields of tableCRMC_EVENT_CALL. The entities that can be entered in these fields aredefined in this transaction (CRMV_EVENT) in the Definitions> groupbox (see "Definition of Entities Relevant for Event Handler" below). With the exception of the CHANGED_AT and CHANGED_BY fields, these arethe same fields that are available to customers in the Customizingactivity mentioned above. Transaction Category (SUB_TYPE)> A business transaction category>. Thiscan be the general SAP CRM transaction category BUS20001 (to make theentry generally available) or a more specific transaction category (forexample, BUS2000114, which only applies to leasing scenarios). Note: An entry in table CRMC_EVENT_CALL that applies to a leadingtransaction category automatically applies to all secondary transactioncategories. Execution Time (EXE_TIME)> The point during the processing of a transaction when you want yourcallback to run. Various execution times are set during businesstransaction processing, as follows:
- End of Header Processing>, End of Item Processing>, End
of Document Processing>, End of All Documents>, and End of> are set during editing of a transaction.
- Before Saving> and Save Document> are only called when a
transaction is saved.
- Initialize Document >is called during the initialization of the
business transaction.
- End of Deletion>, Save Header>, and Save Item> are
currently not used. When an event for which you have registered for is published, you mayrequire an immediate reaction or you may want to wait until a laterpoint in time. For example, if partner data is changed, pricing dataneeds to be checked immediately. Determination of organizational units,however, can wait until the end of header processing before reacting tothe change. If an execution time is set (in system table CRMC_EVENT_EXTI) thatallows earlier execution times to be processed concurrently, thecallbacks for earlier execution time are also processed. Note: If you register a callback for the execution time Immediately > (001) the callback is executed immediately after the event has beentriggered. Only use the execution time Immediately> ifabsolutely necessary> as it reduces system performance due to the factthat several events can trigger the same callback. Do not use theexecution time >Immediately>> (001) if you registerfor the event SAVE>. Callback Processing Priority (PRIO)> The priority of a callback. Acts as an additional sort criterion todetermine when callbacks are carried out. Object (OBJ_NAME)> The object (for example, partner, organizational data) that triggeredthe event. Objects are the building blocks of transaction categories and item object types>. Event (EVENT)> The event for which you want to register a callback. The following eventcategories exist: Event Category,,When Triggered Init>,,When the transaction is initialized Check>,,Before an action is performed for a certain object(change, create, delete, save, create_with_ref) Change>,,After an action has been performed for a certain object Delete>,,When the transaction or objects are deleted Save>,,When the transaction is saved Some events do not have a category. These events are triggered for veryspecific reasons. Note: The events that are triggered depend on the objects involved, forexample, events with the appendix WITH_REFERENCE are only triggered byheaders and items when they are copied or a follow-up is created. Attribute (ATTRI1)> The attribute is used as a filter to restrict the number of functionmodules called. If you always need to react to a particular event, thenyou should set ATTRI1 to SPACE >or <*>>. Depending on theobject, you may not always need to react to an event being published.You can assign an attribute to the callback so that it only reacts whenthis attribute is set. Example: This attribute is used by the status, partner, and appointmentsets. The partner set uses this attribute to communicate for whichparticular partner an event has been published (0001 for contact person,and so on). The status set communicates the status change via thisattribute. The appointment set communicates the date field being changedvia this attribute. If you set SPACE >or <*>> for one ofthese sets, then your callback will react to every event published bythis set. Callback Function (FUNC_NAM)> The name of the callback (it should begin with CRM and end in EC). Theobject function is used to group certain callbacks in order to easilydetermine which callbacks are available for a certain transaction type.Before you can enter a callback in this view, it has to be assigned toan object function in the Definitions> group box. Perform Callback if Event for Header GUID is Published (ONLY_HDR)> This flag determines whether the callback should be carried out atheader level. Perform Callback if Event for Item GUID Is Published (ONLY_ITM)> This flag determines whether the callback should be carried out at itemlevel. Do Not Process Function if Event Error Occurs (ERROR_CHECK)> Set this flag if you do not want your callback to run if, for somereason, the object raises an error. For example, if the user enters thewrong product, then you may not want your callback to be processed. The flag is passed to the event handler. Which errors set the flag(=TRUE) depends on the object in question. Frequency of Callback Call (CB_FREQ)> Parameter setting for the callback. Note: >This setting is very important since it determines howoften the callback will be put into the planning table for eachexecution time. The setting does not impact the frequency if the callback is registeredfor execution time Immediately> (001) since in this case callbacksare not planned for later execution. The following values are supported:
- Call to Header/Item, with Object, Event, Attr., Old/New Data>
(SPACE) The callback is carried out for headers and items. The callback isprovided with the object name, the event, and old and new data (the oldand new versions of the work area structure). The structure that ispassed is defined in table CRMC_EVENT_STRUC. If old and new data arerequired and you want the callback to run immediately once an event ispublished (execution time Immediately> (001)), you must use thissetting and not setting K (see below). With this setting your callback will be planned in every time the eventis triggered in order to provide the callback with each old and new dataentry.
- Call to Header/Item with Object, Event, Attr. W/Out Old/New> (A)
The same procedure takes place as with setting SPACE, but without oldand new data. If a callback is registered with this setting, each time the respectiveevent is triggered a check determines whether this callback has alreadybeen registered for the combination of GUID (of header or item), object,and attribute. If no entry with this combination is found, the entry isplanned in again.
- Call to Header/Item, W/Out Object, Event, Attr.,Old/New Data> (B)
The callback can be carried out for header and items. Object, event, andold and new data are not provided. If a callback is registered with this setting, each time the respectiveevent is triggered a check determines whether this callback has alreadybeen registered for the relevant GUID (of header or item). The callbackis only planned in again if the event is triggered by a different headeror item.
- Call Just Once Per Transaction> (C)
The same procedure takes place as with setting B, but the callback iscarried out only once per transaction. Note: This is the only settingthat you should use with the execution time Save> (080). If a callback is registered with this setting a check only takes placeto determine whether this callback has been planned in once (for headeror item). However if there a several registrations for the same callbackfor different execution times, the callback is planned in once perexecution time.
- Call to Hdr/Item with Object/Event/attr.+ Compressed Old/New> (K)
The callback can be carried out for headers and items. The callback isprovided with the object name, the event, and cumulated old and newdata. Therefore, if an event is published more than once, you receivethe old data from the initial call, and the new data from the finalcall. All changes in between are irrelevant. Normally, you need to setSPACE if you want to react immediately and K if you want to react later.However, for specific partner data, (for example, if you are registeredfor a change to a specific partner function (field attri1 = 0001 orsimilar) and not for general partner changes (field attri1 = <*> ) youneed to use SPACE, since partner data cannot be cumulated. If a callback is registered with this setting, each time the respectiveevent is triggered a check determines whether this callback has alreadybeen registered for the combination of GUID (of header or item), object,and attribute. If no entry with this combination is found, the entry isplanned in again. However, the old and new data is stored every time sothat the compressed old and new data values can be provided later. Changed On (CHANGED_AT)> Date of change to data record Changed By (CHANGED_BY)> User who made the change ONLY_ONE_CALL> This flag is no longer relevant.Definition of Entities Relevant for the Event Handler In the Definitions> group box you can define the following:
- Events:> The events that can be published in the event handler
- Objects:> The objects that are used to design a transaction
category or item object type
- Object/Event Structure:> A structure must exist for an object to
be able to pass information when publishing an event (for example, newquantities in an order or changed partner data). You need to enter thestructure so that the event handler can format the data.
- Object Functions: >Object functions are functions carried out by
an object or set. They are used to group sets of callbacks so that theycan be planned or excluded when an event is published.
- Object/Object Function:> Assignment of object functions objects.
- Object Function/Callback:> Assignment of callbacks to object
functions.
- Times:> The execution times that can be set during the various
processing stages of a transaction.Determination of Callbacks During Processing Each time an event is triggered, all possible callbacks have to bedetermined for each transaction type and item object type. The eventhandler selects callbacks on header and item level depending on whichlevel the event has been triggered. The selection on header level isperformed by function module CRM_EVENT_FILTER_PROC_TYPE_OW. The selectio n on item level is also performed by this function module if the itemobject type is not yet known. If the item object type is known, theselection on item level is performed by moduleCRM_EVENT_FILTER_ITEM_TYPE_OW. After all possible callbacks have been determined, the callbacks for thetriggered event are evaluated. In detail, the event handler procedes as follows to determine callbacks(note that steps 3 and 4 are interchangeable): Determines the transaction category and secondary transaction categoryfor the transaction type (tables CRMC_PROC_TYPE and CRMC_PR_ASSIGN). Sets callbacks for these transaction categories (tables CRMC_EVENT_CALLand CRMC_EVEN_CUST). For header level or item level without >item object type known: Selects objects for the transaction type (table CRMC_OBJECT_ASSI). Selects all item types for the transaction type (table CRMC_IT_ASSIGN). Selects all objects for all item object types (table CRMC_OBJ_ASSI_I). For item level with >item object type known, selects object foritem object type (table CRMC_OBJ_ASSI_I). Adds generic objects, such as ACTION or ORDER. Determines object functions for objects (table CRMC_OBJECT_FUNC). Removes object functions according to Customizing settings. For example, if a user status profile is specified in Customizing, theobject function CRM_USER_STATUS is added. Selects callbacks from preselection for remaining object functions(table CRMC_FUNC_ASSIGN).Checks You can display the callbacks that are scheduled for a certaintransaction type or item category (by clicking Determine Callbacksfor Trans.Type/Item Category>). If a callback is not displayed in theresult list, it cannot be executed. If you want to display callbacks foran item category, you need to also enter a transaction type as someCustomizing at header level has an effect on the item level. This check is particularly useful to see if any unnecessary callbackshave been assigned to the transaction type or item category. If this isthe case, then you should adjust the callback registration accordingly.
|