Wednesday, August 18, 2010

Field properties modification using the GET_P

In the CRM webclient, the properties of a field can be changed.
The change can vary from changing the field type, for instance changing a dropdown listbox to an ordinary input field or a checkbox or a radiobutton, to changing the tooltip text, to implementing navigation to another screen when clicking on the field.
The changes are done in the GET_P of an attribute of the context node.

1. Determine the component and view to be changed.
In the CRM webclient navigate to the search screen to be adjusted, click in a field and press . Note the component and the viewname.

2. Enhance the component and view
First enhance the component and enhance the view. How to enhance a component and a view can be found here.

3. Redefine the method DO_INIT_CONTEXT.
Redefine the DO_INIT_CONTEXT Remember to always call the super class. How to redefine a method can be found here.


The GET_P is run several times when adding the field to the screen at runtime.
Changing a field to a hyperlink:
The following example changes the field to a hyperlink, which when clicked upon, will navigate to a different screen

CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
      rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
    WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
      rv_value = 'NAVIGATE_TO_TARGET'.

Of course, you will also need to implement the event EH_ONNAVIGATE_TO_TARGET. 

Changing a field to a checkbox and adding a tooltip.
CASE iv_property.
  WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
      rv_value = cl_bsp_dlc_view_descriptor=>field_type_checkbox.
  WHEN if_bsp_wd_model_setter_getter=>fp_tooltip.
      rv_value = text-001.
Additional comments.
One of the importing parameters of the get_p is the field IV_DISPLAY_MODE. This field can be checked to see whether the field is in change or in display mode. You can implement different properties to the field in change and in display mode.
Another of the importing parameters is the IV_INDEX. This can be used to determine in which line you are in the table.


  1. Pieter I am using the get p to set tool tip text for my fields. The thing is we use two languages in our system German DE and English EN. I use transaction sotr_edit to add Aliases to enter a context in English and one for German. If I log into the system in English I see my tool tips. But if I log in in German language then the tooltips just display the standard sap tooltips of the field, which is simply the value of the field. I posted this issue on sap sdn forums here
    Http:// but no answers...

  2. Sorry here is the correct link:

  3. @Pieter - Do you have any idea why this is happening. This seems to still be an issue for me. Logically it makes sense. I create a tool tip SOTR_EDIT and I've added a context (a transaltion to the german lanugage" I wrote up the get_p method and it works if I log in the US Language I see the tool tip. But when I log in the DE (German) language then the tooltip is the standard SAP tooltip...

  4. Nevermind peter about the get_p I just got it!
    1) Go to transaction SOTR_EDIT
    2) Create a new SOTR_EDIT like so:
    3) Make sure to enter in language EN ENGLISH
    4) Object Type is WAPP
    5) Enter the text and save it
    6) Go to the edit menu->context->create
    7) A popup will come up (make sure you DO NOT PUT ANYTHING IN FOR COUNTRY / INDUSTRY)
    8) Keep the popup empty and click the green check mark
    9) Now it will redisplay your otr, just change the language to DE and translate the text, in the text field take the value that is in there which is in English and translate it to DE.
    10) Click the save button

    Then just write get_p.

  5. Great! I would have guessed on SE63, but if this works that's great! Thanks for sharing :-)

  6. Hi Peter,

    How can we hightlight the input field with red color similar to mandatory field?


  7. I am afraid it is currently not yet possible to have fields become mandatory dynamically. At lease not that I know of... If you do find out, I would be very interested!


  8. Hi Peter,

    I would not actually need to make the field mandatory but just to look like a mandatory by setting red color to it. Any ideas how to set field properties, i know we can hightlight the field using fp_focus but that comes in blue color which is not what i really need. Any ideas plz?


  9. I am afraid I don't know. Sorry. I guess this change would include a change of the stylesheet as well. By the way, the way fields are shown depends on the skin the user has chosen (and thus the stylesheet).

  10. Hi Peter,

    Is there anyway to change the field to hyperlink without using get_p method.

    There is a hyperlink in UI but no get_p mehtod is defined for the same field.I tried debuggin but unable to locate. Plz help!


  11. There is a search page in which clicking on search button will list all the product with product ID, description etc.

    The product description is a hyperlink but in the component view no get_p method is defined for the description field.

    any idea??

  12. What is the component/node/attribute? I can have a look.

  13. u wont b able to look at those component...
    company policy...but will appreciate if you can help me with any pointers.. :)

    is der anyway to change a field to hyperlink without using get_p method??

  14. Ow, I don't mean to look in your system, but take a look in my own system.
    In general, the mapping of a URL is done in the navigation bar profile in the Generic OP Mapping.
    If you change this, you change the behaviour of links. Be aware though that it is called GENERIC for a reason. Changing this might influence other links as well.
    You might by the way still be able to implement a get_p, even though the workbench doesn't allow you to. In some cases if you implement it in SE80, it is still called.

    Hope this helps. If you give me the component name etc I can take a look for you.

  15. Hi Pieter,

    plz hav a look...
    CRM UI->Goto Master Data->Listings->Search
    in the result hyperlink is on listing (description) but in crmcmp_lst component no get_p method is defined.

    Also, in the result Listing ID is from crmcmp_lstsrch component and listing is from crmcmp_lst component.

    Component : 1)CRMCMP_LST/CondRecEditListView

    Thanks in advance!

  16. Hi,

    I would need to make a field invisible based on the value of another field. How could I do this? Thank you.

  17. Hi,
    without get p method can we used get v method in piclist? If yes then how?

  18. You can adjust the available values in the GET_V, but if the field is not a ddlb yet, you can arrange this by changing the GET_P for the field.

  19. hi,
    any body could please explain how to fields display dynamically on web page.

  20. Hi,
    Can anyone support me why i can not see the fp_bgcolor so i can change the background color of one cell or row in tree view.



  21. Hi
    This blog talks about dynamically didsplaying fields.
    and SAP note 1937399 has a good example of changing the background colour of cells baed on the content.