‎2010 Oct 26 4:35 PM
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?
‎2010 Oct 26 4:39 PM
‎2010 Oct 26 4:41 PM
‎2010 Oct 26 4:45 PM
You can use FMs HELP_VALUES_GET_NO_DD_NAME and DYNP_VALUES_UPDATE.
Rob
‎2010 Oct 26 4:49 PM
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
‎2013 Jul 19 1:48 PM
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.