cancel
Showing results for 
Search instead for 
Did you mean: 

search help on fields in web dynpro

Former Member
0 Kudos

hi all

The issue is can the search help populate fields on the web dynpro other then the field to which the search help is tied to.

i have a field for code and the search help is tied to that when selected it returns value for code but i need the description of that value to returned to another field.

Thanks

MAtt

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Matt,

If you are using OVS search help, then you can tie the description to another attaribute in the OVS search help event handler. If you are using standard search help then you have to explicitly write code to select the description and tie to the respective attribute.

Best Regards.

Answers (1)

Answers (1)

gopi_narendra
Active Contributor
0 Kudos

Hi Matt

There are 2 ways of acheiving this.

1. Create a data dictionary search help, by creating a view the required master data table and its text table

2. Create a OVS SearchHelp in the Webdynpro component. For this you have to use the WDR_OVS Component in your main component.

You can make use of this code for creating a OVS Search Help in Webdynpro Component.

DATA : lt_seth TYPE STANDARD TABLE OF setheader INITIAL SIZE 0,
         ls_seth TYPE setheader.
  DATA : lt_setheadert TYPE STANDARD TABLE OF setheadert INITIAL SIZE 0,
         ls_setheadert TYPE setheadert.

  DATA : lt_setlist TYPE STANDARD TABLE OF setlist INITIAL SIZE 0,
         ls_setlist TYPE setlist.
  DATA : lt_sethier TYPE STANDARD TABLE OF sethier INITIAL SIZE 0,
         ls_sethier TYPE sethier.

* declare data structures for the fields to be displayed and
* for the table columns of the selection list, if necessary
  TYPES:
    BEGIN OF lty_stru_input,
      cc_grp      TYPE rksb1-ksgru,
      cc_grp_text TYPE setheadert-descript,
    END OF lty_stru_input.
  TYPES:
    BEGIN OF lty_stru_list,
      cc_grp      TYPE rksb1-ksgru,
      cc_grp_text TYPE setheadert-descript,
    END OF lty_stru_list.

  DATA: ls_search_input  TYPE lty_stru_input,
        lt_select_list   TYPE STANDARD TABLE OF lty_stru_list,
        ls_text          TYPE wdr_name_value,
        lt_label_texts   TYPE wdr_name_value_list,
        lt_column_texts  TYPE wdr_name_value_list,
        lv_window_title  TYPE string,
        lv_group_header  TYPE string,
        lv_table_header  TYPE string.

  DATA : lr_kostl TYPE RANGE OF kostl,
         lwa_kostl LIKE LINE OF lr_kostl,
         lr_ltext TYPE RANGE OF ltext,
         lwa_ltext LIKE LINE OF lr_ltext.

  FIELD-SYMBOLS: <ls_query_params> TYPE lty_stru_input,
                 <ls_selection>    TYPE lty_stru_list.

  CASE ovs_callback_object->phase_indicator.

    WHEN if_wd_ovs=>co_phase_0.  "configuration phase, may be omitted
*   in this phase you have the possibility to define the texts,
*   if you do not want to use the defaults (DDIC-texts)

      ls_text-name = `CC_GRP`.
      ls_text-value = `Cost Center Group`.
      INSERT ls_text INTO TABLE lt_label_texts.

      lv_window_title = 'Cost Center Group Search Help'.
      lv_table_header = 'Values Found'.

      ovs_callback_object->set_configuration(
                label_texts  = lt_label_texts
                column_texts = lt_column_texts
                group_header = lv_group_header
                window_title = lv_window_title
                table_header = lv_table_header
                col_count    = 2
                row_count    = 20 ).


    WHEN if_wd_ovs=>co_phase_1.  "set search structure and defaults
*   In this phase you can set the structure and default values
*   of the search structure. If this phase is omitted, the search
*   fields will not be displayed, but the selection table is
*   displayed directly.
*   Read values of the original context (not necessary, but you
*   may set these as the defaults). A reference to the context
*   element is available in the callback object.

      ovs_callback_object->context_element->get_static_attributes(
          IMPORTING static_attributes = ls_search_input ).
*     pass the values to the OVS component
      ovs_callback_object->set_input_structure(
          input = ls_search_input ).


    WHEN if_wd_ovs=>co_phase_2.
*   If phase 1 is implemented, use the field input for the
*   selection of the table.
*   If phase 1 is omitted, use values from your own context.

      IF ovs_callback_object->query_parameters IS NOT BOUND.
******** TODO exception handling
      ENDIF.
      ASSIGN ovs_callback_object->query_parameters->*
                              TO <ls_query_params>.
      IF NOT <ls_query_params> IS ASSIGNED.
******** TODO exception handling
      ENDIF.

      CLEAR:
        lwa_kostl,
        lwa_ltext.

      REFRESH:
        lr_kostl[],
        lr_ltext[].

      IF <ls_query_params>-cc_grp IS NOT INITIAL.
        IF <ls_query_params>-cc_grp CA '*'.
          lwa_kostl-sign = 'I'.
          lwa_kostl-option = 'CP'.
          lwa_kostl-low = <ls_query_params>-cc_grp.
          APPEND lwa_kostl TO lr_kostl[].
        ELSE.
          lwa_kostl-sign = 'I'.
          lwa_kostl-option = 'EQ'.
          lwa_kostl-low = <ls_query_params>-cc_grp.
          APPEND lwa_kostl TO lr_kostl[].
        ENDIF.
      ENDIF.

      IF <ls_query_params>-cc_grp_text IS NOT INITIAL.
        IF <ls_query_params>-cc_grp_text CA '*'.
          lwa_ltext-sign = 'I'.
          lwa_ltext-option = 'CP'.
          lwa_ltext-low = <ls_query_params>-cc_grp_text.
          APPEND lwa_ltext TO lr_ltext[].
        ELSE.
          lwa_ltext-sign = 'I'.
          lwa_ltext-option = 'EQ'.
          lwa_ltext-low = <ls_query_params>-cc_grp_text.
          APPEND lwa_ltext TO lr_ltext[].
        ENDIF.
      ENDIF.

*** GET THE LIST OF COST CENTER GROUPS
      CALL FUNCTION 'G_SET_LIST_SELECT'
        EXPORTING
          client        = sy-mandt
          setclass      = '0101'
          shortname     = '1000'
          kokrs         = wd_this->kokrs
        TABLES
          matching_sets = lt_setlist.
      LOOP AT lt_setlist INTO ls_setlist.
        CALL FUNCTION 'G_SET_TREE_IMPORT'
          EXPORTING
            client        = sy-mandt
            langu         = sy-langu
            setid         = ls_setlist-setname
          TABLES
            set_hierarchy = lt_sethier.
        LOOP AT lt_sethier  INTO ls_sethier
                           WHERE shortname IN lr_kostl[]
                             AND descript IN lr_ltext[].
          ls_search_input-cc_grp = ls_sethier-shortname.
          ls_search_input-cc_grp_text = ls_sethier-descript.
          APPEND ls_search_input TO lt_select_list.
          CLEAR : ls_sethier.
        ENDLOOP.
        CLEAR : ls_setlist.
      ENDLOOP.
      SORT lt_select_list BY cc_grp.

      ovs_callback_object->set_output_table( output = lt_select_list ).

    WHEN if_wd_ovs=>co_phase_3.
*   apply result

      IF ovs_callback_object->selection IS NOT BOUND.
******** TODO exception handling
      ENDIF.

      ASSIGN ovs_callback_object->selection->* TO <ls_selection>.
      IF <ls_selection> IS ASSIGNED.
        ovs_callback_object->context_element->set_attribute(
                               name  = `CC_GRP`
                               value = <ls_selection>-cc_grp ).
        ovs_callback_object->context_element->set_attribute(
                               name  = `CC_GRP_TEXT`
                               value = <ls_selection>-cc_grp_text ).
      ENDIF.
  ENDCASE.

Regards

Gopi