At Selection Screen on Value Request event is used to display the possible values to be entered into the input field. In the following example we press F4 button on the material field and then we can see the materials with description. Now we can double click on the material which is required and that material will be entered into the input field.
DATA: it_return TYPE TABLE OF ddshretval.
INITIALIZATION.
PARAMETERS p_matnr TYPE mara-matnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
SELECT matnr, maktx FROM makt
INTO TABLE @DATA(it_mara)
WHERE spras = @sy-langu.
IF sy-subrc = 0.
SORT it_mara.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR'
value_org = 'S'
TABLES
value_tab = it_mara
return_tab = it_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
LOOP AT it_return ASSIGNING FIELD-SYMBOL(<lw_ret>).
p_matnr = <lw_ret>-fieldval.
ENDLOOP.
DATA: it_return TYPE TABLE OF ddshretval.
INITIALIZATION.
PARAMETERS p_matnr TYPE mara-matnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
SELECT matnr, maktx FROM makt
INTO TABLE @DATA(it_mara)
WHERE spras = @sy-langu.
IF sy-subrc = 0.
SORT it_mara.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR'
value_org = 'S'
TABLES
value_tab = it_mara
return_tab = it_return
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
LOOP AT it_return ASSIGNING FIELD-SYMBOL(<lw_ret>).
p_matnr = <lw_ret>-fieldval.
ENDLOOP.
No comments:
Post a Comment