Skip to end of metadata
Go to start of metadata

To create a dynamic value help on the Web UI in CRM 2007, we need to do the following steps:

1. Add the field to the view where it is to be displayed as a value help. In our example we would make a field 'CATEGORY1' dependent on the value of field 'MAINCATEGORY'.

2. Go to the GET_V method of the field (CATEGORY1). Write the following code:

CREATE OBJECT rv_valuehelp_descriptor
iv_outbound_plug = 'F4_CATEGORY1'. "#EC NOTEXT

3. Create an Outbound plug namely F4_CATEGORY1. Write the following code in it:

lr_entity_header ?= typed_context->search->collection_wrapper->get_current( ).
CATCH cx_sy_move_cast_error.
CHECK lr_entity_header IS BOUND.
CALL METHOD lr_entity_header->get_property_as_value
iv_attr_name = 'MAINCATEGORY'
ev_result = lv_maincat.
wa_catalog = 'A1'.
append wa_catalog to lt_catalog.
clear wa_catalog.
ls_col_def-columnname = 'CODEGRUPPE'.
ls_col_def-title = 'Category 1'.
APPEND ls_col_def TO lt_col_def.
CLEAR ls_col_def.
ls_col_def-columnname = 'KURZTEXT'.
ls_col_def-title = 'Description'.
APPEND ls_col_def TO lt_col_def.
CLEAR: gt_category1[].
SELECT codegruppe kurztext FROM qpgt INTO CORRESPONDING FIELDS OF TABLE gt_category1
WHERE katalogart = lt_catalog-catalog AND sprache = 'E'.
FREE gr_category1_f4.
gr_category1_f4 = comp_controller->window_manager->create_decision_popup(
iv_title = 'Category 1'
iv_description = 'Category 1'
iv_visible_row_count = 10
iv_display_table = gt_category1
iv_visible_columns = lt_col_def ).
gr_category1_f4->set_on_close_event( iv_event_name = 'CATEGORY1_F4_SELECTED'
iv_view = me ).
gr_category1_f4->open( ).

4. Create an Event 'CATEGORY1_F4_SELECTED' and write the following code in the same: 

 DATA: ls_category1  TYPE QPGT. 
  lr_outputnode ?= gr_category1_f4->get_context_node( 'OUTPUTNODE' ).
  lv_row_index = lr_outputnode->get_selectedrowindex( ).
  lv_event_name = lr_outputnode->get_event_name( ).
  gr_category1_f4->close( ).
  IF lv_event_name = 'OK'.
    lr_entity ?= me->typed_context->search->collection_wrapper->get_current( ).
    READ TABLE gt_category1 INTO ls_category1 INDEX lv_row_index.
    lr_header ?= me->typed_context->search.
    lr_header->gs_category1_f4 = ls_category1.
    lv_value = ls_category1-codegruppe.
    lr_entity->set_property_as_string( iv_attr_name = 'CATEGORY1'
                                       iv_value = lv_value ).

5. Create the following attributes in the Context node class (ZL_<comp>_CN00):

GS_CATEGORY1_F4        Instance               Public                    Type      QPGT

6.  Create the following attributes in the implementation class (ZL_<comp>_IMPL):

GR_CATEGORY1_F4        Instance               Private                  Type ref to          IF_BSP_WD_POPUP
GT_CATEGORY1                               Instance               Public                    Direct type Entry               
    GT_CATEGORY1  type table of QPGT.

7. Note to change the outbound plug to Public type.

8. Save and activate all the concerned classes and methods.

9. Run the Web UI to check the functionality.

  • No labels


  1. Hi Soumya,

    I was trying to implement this code but am stuck at step 4.

    Could you please mention type of variable "lr_outputnode " ?

    As this variable is type casted from context node CL_BSP_WD_CONTEXT_NODE and it has methods : get_selectedrowindex( ) & get_event_name( ), I am unable to find out the correct class for that.

    Could you please explain the same?

    Best Regards,


  2.  lr_outputnode  TYPE REF TO cl_bspwdcmp_bspwdcomponen_cn01.