Customer Relationship Management Blogs by Members
Find insights on SAP CRM and other customer relationship management products and topics in blog posts from community members and share your own perspective.
Showing results for 
Search instead for 
Did you mean: 
Active Contributor
0 Kudos

For those interested in linking custom tables to the BOL model BT(Business Transactions), here's an update. This is a follow up of the already published wiki Extend BOL model BT with custom tabe type relationship . As of now, the steps involved in the wiki involves enhancing some standard classes. The good news is that this can be entirely avoided. For those who are feeling adventurous here's the way to do it. The basics remain the same and can be read up in the wiki. I will list down the differences.

For implementing the handler classes, try to follow the BOL object runtime classes  "CL_CRM_STATUSSET_RUN_BTIL" for the header set (static read only relation) and "CL_CRM_STATUS_RUN_BTIL" for the actual item type relations. You should think of your own way of supplying the API data. The API data for the standard CRM objects is supplied by the ORDER READ function modules. You should replace it with your own methodology and take care to supply data according to the scenario. For example, you should be able to determine whether it is necessary to read(initial read) from database or from  the buffer(under processing).

Next you should register certain function modules to be called during the course of standard ORDER events for various scenarios. Here's another good thing. If your extensions are valid only for a particular business object type, do this. Specify your own ORDER object in CRMC_ONJECTS. Next, specify this as a sub-object of a business object type by maintaining entry in "CRMV_OBJECT_ASSI". Next, when you are maintaining BOL objects in the IMG activity "Extend Model for Business Transactions with New Nodes", use this value under column "Object Type".

Now you should register your callback function modules to be called during the CRM ORDER events. To find the appropriate places where you need to insert your own FMs, analyze the order of events for different scenarios. Set user parameter "CRM_EVENT_TRACE" to "X". Do some order processing stuff and look what events were fired in transaction "CRMD_EVENT_TRACE". This will give you a general idea. In general, you will need to register events for initialization, save, delete and copy. First maintain the callback FMs in CRMV_FUNC_ASSIGN. Then, create entries in the event handler table. This activity is available in IMG activity "Transactions->Basic Functions->Edit Event Handler Table". This is for customer specific entries. To see the standard event handler entries, use transaction "CRMV_EVENT". Though you can maintain entries here, I'm not sure if this is recommended.

Be sure to use your custom CRM object type for the init and save events. This way, the initialization will be triggered when the order being initialized is of the relevant business object type. For the save to be triggered, you must register for saving when you detect a change scenario in your API. Use the FM CRM_EVENT_PUBLISH_OW to publish the change. This will register your custom CRM objects for save. You can probably put this in the maintain method of your "runtime" class.

*     event AFTER_CHANGE
          iv_obj_name   = 'ZCUST_I'
          iv_guid_hi    = lv_header_guid
          iv_kind_hi    = 'A'"gc_object_kind-orderadm_h
          iv_event      = gc_event-after_change.

This will trigger the callback FM registered for the save event(of your custom order object) when the order is saved.

The deletion should probably depend on the general order(BUS2001), event "After Delete". For copy and follow-up events, check out the "After Create with Reference" events.

That's it for now. I will update the wiki some time soon, hopefully with some more details. Hope you have fun exploring 🙂