Skip to Content
I came across a very interesting requirement to make the column title dynamic. It was a big challenge for me as I had not seen this in any of the SAP standard views( Though some people told me that in CRM UI if you configure the ECC Sales transaction product proposal, there you will get the dynamic column).

My requirment was to create a new columns in the Item view of Interaction center and populate it with the quantity of the product ordered in the past. The column title should be filled with the order date. Here I am not going in details about the product proposal rather I will just explain how we can change the column title with current date.

Step1: Use the Enhancement workbench tr. BSP_WD_CMPWB, Enhance your component and create a new value attribute.

image

Step2: Once you complete the Wizard, your newly created attribute should show in the Attribute list as shown below.

image

Step3: Now double click on the GET_M_ method of the attribute, System generated code will look some thing like this.

image

Step4: Comment out the system generated code and insert following code

DATA: p_flddescr TYPE dfies.

CALL FUNCTION ‘DDIF_FIELDINFO_GET’

    EXPORTING
      tabname        = ‘ZCRMT_PROD_PROP_HIST_QTY01’
      langu          = ‘E’
      all_types      = ‘X’
    IMPORTING
      dfies_wa       = p_flddescr
    EXCEPTIONS
      not_found      = 1
      internal_error = 2
      OTHERS         = 3.

    p_flddescr-reptext   = sy-datum.
    p_flddescr-scrtext_s = sy-datum.
    p_flddescr-scrtext_m = sy-datum.
    p_flddescr-scrtext_l = sy-datum.

CREATE OBJECT metadata
    TYPE
      cl_bsp_metadata_simple
    EXPORTING
      info  = p_flddescr.

 

image

Step5: Redefine the method GET_TABLE_LINE_SAMPLE of your context node and add all the attributes you have added in the context node as shown below.

image

image

Step6: make the field available in your view by changing the configuration of the view. When the field will display in the IC Web screen it will look something like this.

image

You can see the dynamic column title .

One thing I observed that the dynamic colunm title was loading up for the first time but after that it was keeping the value in the buffer and was not refreshing so every time I was loading the page I was getting the same date value for the column title. I found the reason after some debugging and I had to refresh the buffer for my custom variable every time by enhancing the standard class CL_BSP_DLC_VIEW_DESCRIPTOR.

image

Once I refreshed the the buffed for my custom fields every thing works fine as expected. 

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Former Member
    Thanks you so much for u r blogs.

    Well I read few of u r blogs on creating component and views, navigating.

    It is very helpfull to me.

    Once again Thank you so much

    (0) 
  2. Former Member

    Hi Vikash Krishna,

    Thank you very much.

    It was very helpful !

    but I have got question about the article:

    What does it mean is step 6: “make the field available in your view by changing the configuration of the view”.

    We should change the attributes of the cellerator tag? or doing something else?

    Thank you very much,

    Mapatz.

    (0) 

Leave a Reply