cancel
Showing results for 
Search instead for 
Did you mean: 

Passing value from an input field to OVS search help

Former Member
0 Kudos

Hi Experts..

  I have created an webdynpro component. Which has one input field and an OVS search help is attached to it. I have a requirement like, when the user enters keyword or a part of keyword with wild characters and clicks on F4, it should display the value entered in the input field in the search criteria.

When we enters any value into this input field

and click on F4 button it should display in the search criteria.

I have written the following code in the ON_OVS method.

TYPES: BEGIN OF ty_stru_input,

           strno      TYPE string,

strname    TYPE string,

           strcountry TYPE string,

strchara   TYPE string,

strstat    TYPE string,

         END OF ty_stru_input,

         BEGIN OF ty_stru_list,

           strno TYPE string,

         END OF ty_stru_list.

  DATA: ls_search_input  type ty_stru_input,

lt_store_list    type standard table of ty_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,

        lv_strno         type string,

lv_strname       type string,

lv_strcntr       type string,

lv_strchar       type string,

lv_strstat       type string,

        lt_name          type WDR_NAME_VALUE_LIST,

        ls_name1 like line of lt_name,

lo_nd_nd_storeno TYPE REF TO if_wd_context_node,

lo_el_nd_storeno TYPE REF TO if_wd_context_element,

        ls_nd_storeno TYPE wd_this->Element_nd_storeno.

*----- Reading Context ----------------*

  lo_nd_nd_storeno = wd_context->get_child_node( name =

wd_this->wdctx_nd_storeno ).

  lo_el_nd_storeno = lo_nd_nd_storeno->get_element( ).

lo_el_nd_storeno->get_static_attributes(

    IMPORTING

static_attributes = ls_nd_storeno ).

  FIELD-SYMBOLS:

<ls_query_params>   TYPE ty_stru_input,

           <ls_selection>      TYPE ty_stru_list,

<lt_sel_opt_result> TYPE STANDARD TABLE.

  DATA: lv_short TYPE string,

        lv_stext TYPE string,

        l_text   TYPE string.

*----------------------------------------------------------------------*

* Main Processing

*----------------------------------------------------------------------*

  CASE ovs_callback_object->phase_indicator.

*-->Phase 0

    WHEN if_wd_ovs=>co_phase_0.

ls_text-name  = `STRNO`.

      ls_text-value = `Store Number`.

      INSERT ls_text INTO TABLE lt_label_texts.

ls_name1-name  = 'Store Number'.

      ls_name1-value = ls_nd_storeno-attr_strno.

      INSERT ls_name1 INTO TABLE lt_name.

ls_text-name  = `STRNAME`.

      ls_text-value = `Store Name`.

      INSERT ls_text INTO TABLE lt_label_texts.

ls_text-name  = `STRCOUNTRY`.

      ls_text-value = `Store Country`.

      INSERT ls_text INTO TABLE lt_label_texts.

ls_text-name  = `STRCHARA`.

      ls_text-value = `Store Characteristic`.

      INSERT ls_text INTO TABLE lt_label_texts.

ls_text-name  = `STRSTAT`.

      ls_text-value = `Store Status`.

      INSERT ls_text INTO TABLE lt_label_texts.

ovs_callback_object->set_configuration( label_texts  =

                                             lt_label_texts

column_texts =

lt_column_texts

                                   group_header = 'Search the store'

                                              col_count = 1

row_count    = 20 ).

*-->Phase I

    WHEN if_wd_ovs=>co_phase_1.

ovs_callback_object->context_element->get_static_attributes(

IMPORTING static_attributes = ls_search_input ).

      ovs_callback_object->set_input_structure( input = ls_search_input

).

*-->Phase II

    WHEN if_wd_ovs=>co_phase_2.

      ASSIGN ovs_callback_object->query_parameters->*

                                    TO <ls_query_params>.

      IF <ls_query_params> IS ASSIGNED.

        lv_strno   = <ls_query_params>-strno.

        lv_strname = <ls_query_params>-strname.

        lv_strcntr = <ls_query_params>-strcountry.

        lv_strchar = <ls_query_params>-strchara.

        lv_strstat = <ls_query_params>-strstat.

      ENDIF.

*Get the Store list.

wd_assist->search_store_number(

        EXPORTING

ip_storenum     = lv_strno

ip_storename    = lv_strname

ip_storecntry   = lv_strcntr

          ip_storechar    = lv_strchar

ip_storestat    = lv_strstat

        IMPORTING

           ep_stornum = lt_store_list ).

*Set the output table.

ovs_callback_object->set_output_table( output = lt_store_list ).

*-->Phase III

    WHEN if_wd_ovs=>co_phase_3.

      ASSIGN ovs_callback_object->selection->* TO <ls_selection>.

      if <ls_selection> is assigned.

ovs_callback_object->context_element->set_attribute(

name  = 'ATTR_STRNO'

value = <ls_selection>-strno ).

      ENDIF.

  ENDCASE.

endmethod.

Kindly help me to resolve the issue.

Thanks,

Pradeep

Accepted Solutions (1)

Accepted Solutions (1)

phanir_mullapudi
Active Participant
0 Kudos

I think You will have set the Value/Attribute in the Phase-1, which is where you can set the structure and default values of the search structure.

In Phase-1,  before doing Set Attributes, read the context element value for STRNO

*-->Phase I

    WHEN if_wd_ovs=>co_phase_1.

ovs_callback_object->context_element->get_static_attributes(

IMPORTING static_attributes = ls_search_input ).

CALL METHOD ovs_callback_object->context_element->get_attribute

         EXPORTING

           name  = 'ATTR_STRNO'

         IMPORTING

           value = lv_strno.

     ls_search_input-strno = lv_Strno.

      ovs_callback_object->set_input_structure( input = ls_search_input

).

Pls try this & it should work.

Happy Programming!

Phani R Mullapudi

Former Member
0 Kudos

Thanks Phani..

It work fine.

Regards,

Pradeep

Answers (1)

Answers (1)

naresh_bammidi
Contributor
0 Kudos

Hi,

As Phani said ,In Phase 1 you can write the code to fix the value .Get the value of store number and pass the value to the structure ls_search_input.

Thanks

Naresh