Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Search Help in Module Pool

former_member51562
Participant
0 Likes
3,881

I have a custom module pool that requires the dynamic creation of a dropdown list box or search help based on the value of a previous field entered.

Currently the screen has search help which is the entire list of values. The user now wants the list of values to be filtered by a location code entered in a previous field.

Is this possible in a module pool?

5 REPLIES 5
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,870

Check thi slink :

Read only

PedroGuarita
Active Contributor
0 Likes
1,870

Use PROCESS ON VALUE-REQUEST for that particular field.

Read only

Former Member
0 Likes
1,869

You can use FMs HELP_VALUES_GET_NO_DD_NAME and DYNP_VALUES_UPDATE.

Rob

Read only

Former Member
0 Likes
1,869

Hi Sheri,

First in the PAI get the field value using the FIELD : fieldname.

And in the POV (PROCESS ON VALUE-REQUEST) using the above fieldname value get the List box corresponding entries from the Database table. then use the FM "F4IF_INT_TABLE_VALUE_REQUEST".

Like in the below example I am getting the entries corresponding to the countries "US" (Value in the fieldname variable).

Declare the resultant field as 'Listbox' in the screen attribuites"


PAI.

PROCESS ON VALUE-REQUEST.

*-- Activity F4 help
  FIELD wa_control-ec_state  MODULE z_ec_state_values_0102.

MODULE z_ec_state_values_0102 INPUT.
  SELECT bland
         INTO TABLE it_state
         FROM t005s
         WHERE land1 = 'US'.

  IF sy-subrc EQ 0.
    SORT it_state BY state.
  ENDIF.

*-- F4 help for activity
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = "DATABASE FIELDNAME"
      dynprofield = "SCREEN FIELD NAME"
      value_org   = 'S'
    TABLES
      value_tab   = it_state.
ENDMODULE

Read only

0 Likes
1,869

One more point I would like to add here...

For getting f4 help inside a table control, I had to add the following piece of code :

Get the values from the F4 help created :

DATA  lt_f4_return      TYPE TABLE OF  ddshretval.

DATA  ls_f4_return      TYPE ddshretval.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

       EXPORTING

         retfield        = 'EBELP'

         dynprofield     = 'LS_ITEM-ITEM_NO'

         value_org       = 'S'

       TABLES

         value_tab       = lt_ebelp

         return_tab      = lt_f4_return  " Selected value from F4 help

       EXCEPTIONS

         parameter_error = 1

         no_values_found = 2

         OTHERS          = 3.

  DATA: dynpfields        LIKE dynpread OCCURS 5 WITH HEADER LINE.

    READ TABLE lt_f4_return INTO ls_f4_return INDEX 1.

       IF sy-subrc = 0.

         lt_dynpfields-fieldname  = 'LS_ITEM-ITEM_NO'.

         lt_dynpfields-fieldvalue = ls_f4_return-fieldval "wa_ekpo-ebelp.         

         APPEND lt_dynpfields.


         CALL FUNCTION 'DYNP_VALUES_UPDATE'

           EXPORTING

             dyname     = sy-repid    "Program name

             dynumb     = '0110'           "Screen number

           TABLES

             dynpfields = lt_dynpfields

           EXCEPTIONS

             OTHERS     = 0.

       ENDIF.