cancel
Showing results for 
Search instead for 
Did you mean: 

How to get value of parameter field

bustamantejt
Explorer
0 Kudos

I need to create a simple selection screen whit a parameter field and a select option. I created them successfully in the WDDOINIT method and I also added a button. When the user presses the button, an ALV is instantiated showing the results of the query.

This is what I have written in the action of the submit button:

  DATA: lo_interfacecontroller TYPE REF TO iwci_wdr_select_options,

        lo_r_helper_class      TYPE REF TO if_wd_select_options,

        lo_cmp_usage           TYPE REF TO if_wd_component_usage,

        lv_matnr               TYPE REF TO data,

        lt_ersda               TYPE REF TO data,

        lt_mara                TYPE wd_this->elements_mara,

  FIELD-SYMBOLS: <fs_mat> TYPE char18,

                 <fs_ers> TYPE table.


* Instantiate used component

  lo_cmp_usage = wd_this->wd_cpuse_sel_opt( ).

  IF lo_cmp_usage->has_active_component( ) IS INITIAL.

    lo_cmp_usage->create_component( ).

  ENDIF.

* Call method in used controller

  lo_interfacecontroller = wd_this->wd_cpifc_sel_opt( ).

  lo_r_helper_class = lo_interfacecontroller->init_selection_screen( ).

* Get parameter field

  CALL METHOD lo_r_helper_class->get_parameter_field

    EXPORTING

      i_id = 'MATNR'

    IMPORTING

      e_value = lv_matnr.

  ASSIGN lv_matnr->* TO <fs_mat>.

* Get select option table

  CALL METHOD lo_r_helper_class->get_range_table_of_sel_field

    EXPORTING

      i_id = 'ERSDA'

    RECEIVING

      rt_range_table = lt_ersda.

  ASSIGN lt_ersda->* TO <fs_ers>.

  SELECT *

    FROM mara

    INTO CORRESPONDING FIELDS OF TABLE lt_mara

    WHERE matnr EQ <fs_mat>

      AND ersda IN <fs_ers>.

Then it goes on with the ALV. The part with the select option works fine. The field symbol <fs_ers> is correctly assigned and that part of the select works. But the field symbol of the parameter is not and I get the following message when I click on the button: "Field symbol has not yet been assigned."

I have also tried writing CREATE DATA lv_prjname TYPE zsci_prjname. before and after the method call and then I get no dump, but the field symbol <fs_mat> is always empty and therefore the SELECT brings no result.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

Use get_value_of_parameter_field( ) method instead of get_parameter_field( ). Or you could use get_parameter_fields( ) method, loop the fields and read the value.

hope this helps u,

Regards,

Kiran

Answers (0)