Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Retrieving Values from Select-Options without Executing

Hi,

I'm trying to get the values from a select-options into a search help function module without executing the program. How would this be done? I tried using 'f4if_int_table_value_request' and 'rs_refresh_from_selectoptions'. I need to be able to filter the search help values that are dependent on a certain select-option value without having to press the enter/execute button.

Thanks for the help

Tags:
Former Member
Former Member replied

You can to use this FM DYNP_VALUES_READ, look at this example

REPORT ytest.

TABLES: t005u.

PARAMETERS: p_land1 TYPE t005-land1.

SELECT-OPTIONS: s_bland FOR t005u-bland.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_bland-low.

* Local Variables

   DATA: lt_t005u  TYPE TABLE OF t005u,

         lt_dynp   TYPE TABLE OF dynpread,

         lt_return TYPE TABLE OF ddshretval.

   FIELD-SYMBOLS: <fs_dynp>   TYPE dynpread,

                  <fs_return> TYPE ddshretval.

* Fill parameters to get values

   APPEND INITIAL LINE TO lt_dynp ASSIGNING <fs_dynp>.

   <fs_dynp>-fieldname = 'P_LAND1'.

* Get value

   CALL FUNCTION 'DYNP_VALUES_READ'

     EXPORTING

       dyname                  = sy-repid

       dynumb                  = sy-dynnr

     TABLES

       dynpfields              = lt_dynp

     EXCEPTIONS

       invalid_abapworkarea    = 1

       invalid_dynprofield     = 2

       invalid_dynproname      = 3

       invalid_dynpronummer    = 4

       invalid_request         = 5

       no_fielddescription     = 6

       invalid_parameter       = 7

       undefind_error          = 8

       double_conversion       = 9

       stepl_not_found         = 10

       others                  = 11.

   IF sy-subrc = 0.

* Get Country

     READ TABLE lt_dynp ASSIGNING <fs_dynp> WITH KEY fieldname = 'P_LAND1'.

     IF sy-subrc = 0.

       IF <fs_dynp>-fieldvalue IS NOT INITIAL.

* Get Regions

         SELECT *

           INTO TABLE lt_t005u

             FROM t005u

               WHERE spras = sy-langu

                 AND land1 = <fs_dynp>-fieldvalue.

         IF sy-subrc = 0.

* Show Help

           CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

             EXPORTING

               retfield         = 'BLAND'

               dynpprog         = sy-repid

               dynpnr           = sy-dynnr

               value_org        = 'S'

             TABLES

               value_tab        = lt_t005u

               return_tab       = lt_return

             EXCEPTIONS

               parameter_error  = 1

               no_values_found  = 2

               others           = 3.

           IF sy-subrc = 0.

             READ TABLE lt_return ASSIGNING <fs_return> INDEX 1.

             IF sy-subrc = 0.

               s_bland-low = <fs_return>-fieldval.

             ENDIF.

           ENDIF.

         ELSE.

           MESSAGE s888(sabapdocu) WITH 'There is not any region of country' <fs_dynp>-fieldvalue.

         ENDIF.

       ELSE.

         MESSAGE s888(sabapdocu) WITH 'Enter a country'.

       ENDIF.

     ENDIF.

   ENDIF.

START-OF-SELECTION.

   WRITE: p_land1.

I hope this help you

Regards

David Carballido


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question