SAP CRM WEB UI Framework version CRM2007 and CRM7.0
We may sometime come across a requirement of creating new table views in CRM web UI. This article explains how to create custom table view and integrate it with existing entity like Activity, Campaign etc. in CRM.
For Bol/Genil part, please refer to my previous blog on simple object : Simple Object Creation - Bol/Genil Part
If you have successfully tested simple object in genil_bol_browser, then this wiki provide detail step of creating a table view based on that simple object.
Company: Robert Bosch, India
Created on: 15.12.2010
Sumit has around 5 years experience in CRM domain and have worked extensively on SAP CRM 2007 and 7.0. His areas of experties include SAP CRM 2007 & CRM7.0 WEB UI Customizations and developments using BOL-GENIL programming, ABAP, OOABAP & BSP programming.
Consider a scenario if we need to add Order details in campaign overview page( Campaign(1...n)Order ), to realize this requirement custom order table view is needed which will be integrated in campaign ov_page.
1. Let's Start with creating new view "OrderDetail" under "CPG_MAIN" bsp component.
2. Specify Context node name "Order" and Bol entity as the simple object created from the previous blog "zorderso".
3. Click next till last step, in the last screen select view type as "table view", tick the configurable and change/display check boxes.
4. Declare these attributes in the attribute section of the OrderDetail view's implementation class.
5. Modify the code of "OrderDetail.htm" page code with the below code..
6. Click on Configuration tab of "OrderDetail" view move required field to be shown on the right side under displayed field.
7. Define three buttons Create,Delete,Edit List in do_prepare_output method of the implementation class.
Create three event's "CREATE","DELETE","EDIT" in "OrderDetail" view via wizard.
As there is no direct bol relation between the simple object table node and campaign, to form relationship guid of the campaign is stored in ref_guid field of simple object..this campaign guid(ref_guid) is again used in on_new_focus to retrieve the related order's of a campaign.
8. Create On_new_focus method in the "Order" context node, specify it as a event handler for collection wrapper new_focus event.
Copy event parameter.
Set handler in Connect nodes method of the CTXT class.
As Save event is handled in different view, order data has to be bind to custom/component controller to access it in other views.
Create "Order" context node in custom/component controller and perform the binding as shown below. For this scenario "Order" context node is bound to campaign component controller "Order" context node, in CRM 7.0 it can be done through wizard via creating binding option.
Redefine eh_onsave event of the save method in "CPG_MAIN/OPOverview" component/view.
Add the following code in on_new_focus method, here logic is to retrieve the order entities collection related to campaign only if parent entity "campaign" changes..
9 . Add the OrderDetail view to runtime repository..
10. Expose "OrderDetail" view on Campaign Overview page, maintain view title and save.
Now run the application campaign overview will have order details table view as an assignment block.