cancel
Showing results for 
Search instead for 
Did you mean: 

How to reuse the same freely programmed help for two different fields in same view

0 Kudos

Hi,

I have an requirement to create freely programmed help and reuse the same for six different input fields in the same view.

Here is my code snippet which I have added in event handler method for VH_DATA_SELECTED event.

DATA lo_nd_color_selection TYPE REF TO if_wd_context_node.

  DATA lo_el_color_selection TYPE REF TO if_wd_context_element.

  DATA ls_color_selection TYPE wd_this->element_color_selection.

  DATA lv_color_code TYPE wd_this->element_color_selection-color_code.

*   navigate from <CONTEXT> to <COLOR_SELECTION> via lead selection

  lo_nd_color_selection = wd_context->get_child_node( name = wd_this->wdctx_color_selection ).

*   @TODO handle non existant child

*   IF lo_nd_color_selection IS INITIAL.

*   ENDIF.

*   get element via lead selection

  lo_el_color_selection = lo_nd_color_selection->get_element( ).

*   alternative access  via index

*   lo_el_color_selection = lo_nd_color_selection->get_element( index = 1 ).

*   @TODO handle not set lead selection

  IF lo_el_color_selection IS INITIAL.

  ENDIF.

*   get single attribute

  lo_el_color_selection->get_attribute(

    EXPORTING

      name =  `COLOR_CODE`

    IMPORTING

      value = lv_color_code ).

  DATA lo_nd_color_code TYPE REF TO if_wd_context_node.

  DATA lo_el_color_code TYPE REF TO if_wd_context_element.

  DATA ls_color_code TYPE wd_this->element_color_code.

  DATA lv_ipd_odd TYPE wd_this->element_color_code-ipd_odd.

  DATA lv_field_name TYPE string.

* navigate from <CONTEXT> to <COLOR_CODE> via lead selection

  lo_nd_color_code = wd_context->get_child_node( name = wd_this->wdctx_color_code ).

* @TODO handle non existant child

* IF lo_nd_color_code IS INITIAL.

* ENDIF.

* get element via lead selection

  lo_el_color_code = lo_nd_color_code->get_element( ).

* @TODO handle not set lead selection

  IF lo_el_color_code IS INITIAL.

  ENDIF.

* @TODO fill attribute

* lv_ipd_odd = 1.

  lv_ipd_odd = lv_color_code.

  CASE wd_this->gv_color_ip_id.

    WHEN 'C_IPD_ODD'.

      lv_field_name = 'IPD_ODD'.

    WHEN 'C_IPD_EVEN'.

      lv_field_name = 'IPD_EVEN'.

    WHEN 'C_IPD_DISPLAY_ODD'.

      lv_field_name = 'IPD_DISPLAY_ODD'.

    WHEN 'C_IPD_DISPLAY_EVEN'.

      lv_field_name = 'IPD_DISPLAY_EVEN'.

    WHEN 'C_NPD_ODD'.

      lv_field_name = 'NPD_ODD'.

    WHEN 'C_NPD_EVEN'.

      lv_field_name = 'NPD_EVEN'.

  ENDCASE.

* set single attribute

*  lo_el_color_code->set_attribute(

*    name =  lv_field_name

*    value = lv_ipd_odd ).

so my request is, how to dynamically assign input field id on f4 select, to this component controller attribute(wd_this->gv_color_ip_id).

Thanks in advance.

Chandru.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

I myself found the solution

Note: no need of above code snippet

By adding below code in the close button action of f4 help view, it worked.

lo_listener = wd_comp_controller->value_help_listener.

   lv_attrib_name = lo_listener->f4_attribute_info-name.

   lo_listener->f4_context_element->set_attribute( value = lv_color_code

   name = lv_attrib_name ).