Acorel
Gratis demo

Field properties modification using the GET_P

Pieter Rijlaarsdam, 18 augustus 2010
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.
[IMG OF WORKBENCH SELECTING THE CONTEXT NODE].
The GET_P is run several times when adding the field to the screen at runtime.
Examples:
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’.
ENDCASE.

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.
ENDCASE.
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.

Pieter Rijlaarsdam

Read all my blogs

Receive our weekly blog by email?
Subscribe here:

More blogs