**&---------------------------------------------------------------------*
**& Report ZF4_MULTIPLE
**&---------------------------------------------------------------------*
**&
**&---------------------------------------------------------------------*
REPORT zf4_multiple.
TABLES: mara.
SELECT-OPTIONS: s_matnr FOR mara-matnr NO INTERVALS.
PARAMETERS: p_maktx TYPE makt-maktx.
DATA:
BEGIN OF itab OCCURS 0,
matnr LIKE makt-matnr,
maktx LIKE makt-maktx,
END OF itab,
t_dynptab TYPE TABLE OF dselc,
t_rettab TYPE TABLE OF ddshretval,
fs_rettab TYPE ddshretval,
fs_dynptab TYPE dselc,
w_matnr TYPE mara-matnr.
INITIALIZATION.
SELECT matnr
maktx
FROM makt
INTO TABLE itab
UP TO 20 ROWS
WHERE spras = sy-langu.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_MAKTX'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_matnr-low.
fs_dynptab-fldname = 'F0001'.
fs_dynptab-dyfldname = 'S_MATNR-LOW'.
APPEND fs_dynptab TO t_dynptab.
fs_dynptab-fldname = 'F0002'.
fs_dynptab-dyfldname = 'P_MAKTX'.
APPEND fs_dynptab TO t_dynptab.
fs_rettab-fieldname = 'P_MATNR'.
APPEND fs_rettab TO t_rettab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR'
dynpprog = 'ZF4_MULTIPLE'
dynpnr = sy-dynnr
dynprofield = 'S_MATNR-LOW'
value_org = 'S'
TABLES
value_tab = itab
return_tab = t_rettab
dynpfld_mapping = t_dynptab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc EQ 0.
CLEAR w_matnr.
READ TABLE t_rettab INTO fs_rettab WITH KEY fieldname = 'F0001'.
IF sy-subrc EQ 0.
w_matnr = fs_rettab-fieldval.
ENDIF.
ENDIF.