Wednesday, July 25, 2012

Adding a date type to the item overview page

One of the selling points of SAP CRM is its configurable UI. You can easily adjust a screen to you business requirements and create different screens for different business roles. Nothing new so far, but have all been there, the business requests to show that one field that is not available in the standard.
For this blog this field is a specific date type, contract start date, which needs to be visible on item overview. This field is only available in the assigment block Dates.




The following steps need to be executed in the Component Workbench.
  • Find the correct component by using F2 in the CRM UI.
  • Enhance the Component ( For our example BT140I_SRVP).
  • Enhance the view ( For our example BT140I_SRVP/Details) by right clicking on the view and selecting enhance.
  • Create a new context node by right clicking on the folder context nodes.
    • Name: Sonething with Cont Start
    • Link the BOL Entity BTDate
  • In the Define Dependency screen fill
  • The link to BTADMINI for item (or BTADMINH for header)
  • In the BOL Relation field select the relation to the desired date type (Contract start) 

Completing the wizard will create a context node for your component. This new context node is however not linked directly to the correct super class. To change the Super Class of the created Context Node dubbel click on the name of the implementation class (like ZL_BT140I_S_DETAILS_CN01) of your newly created context node.
Go to Tab Properties, fill in a desciption since this is a mandatory field
Select Change Inheritance and fill in CL_CRM_UIU_BT_DATE_CN as super class.
Now that we have added a new super class we have inherited new methods and attributes this makes the already existing attribute Base_Entity_Name double. Remove the attribute and then check for errors and release the component.
We need to modify the ON_NEW_FOCUS method to below code.
  method ON_NEW_FOCUS.
  data: lv_collection type ref to if_bol_bo_col.
  lv_collection =  cl_crm_uiu_bt_date_tools=>on_new_focus( iv_focus_bo  = focus_bo
  iv_level     = 'I'
  iv_date_type = 'CONTSTART'
  iv_category  = 'T' ).
  me->collection_wrapper->set_collection( lv_collection ).

Pass the' I 'for Item, 'H' for Header
Pass the Date Type defined in the date profile
Pass the category as T for Dates.

Now we need to add the newly created context node as a field to the configuration of the component.
You can find the new context node in the available fields section.
The field that you need to select to display a date is `Current date´.







The Result

By redoing the above for the contract end date we have added to date fields that are now visible on the item overview. This same procedure can be used for other relationships of an item.



  1. Hi,

    Can you pls. provide the step by step using AET?


  2. Violet,

    There is an article on AET on this blog.

    If you have further questions, feel free to ask.

  3. The article is very nice, i have a small question. how did you know about the class CL_CRM_UIU_BT_DATE_CN and how did you make that as super class. I face a problem wherein i dont know the exact super class to be used like you have done here. Is there a guide on such classes and which has to be used when or atleast where i know what all standard classes are there like this one which you have used here.

  4. Dear anonymous,

    In this case, we copied this from one of the standard fields from the context node.
    I am not aware of any documentation on these classes in particular.
    If you happen to find some though, feel free to comment again :-)


  5. Hello,
    Do you know if there is a way to do something similar to link a field that is not part of a BOL Entity BTDate such as the Opportunity Closing Date (EXPECT_END) with the Dates assignment block?

    1. I ended up creating an explicit setter for EXPECT_END and updated a specific date type.