TABLES: marc,makt.
TYPES: BEGIN OF ty_makt,
werks TYPE werks_d,
matnr TYPE matnr,
maktx TYPE maktx,
END OF ty_makt.
DATA: it_dynpr TYPE STANDARD TABLE OF dynpread,
wa_dynpr TYPE dynpread.
DATA: gt_makt TYPE TABLE OF ty_makt,
gs_makt TYPE ty_makt.
DATA: gt_out TYPE STANDARD TABLE OF ddshretval,
gs_out TYPE ddshretval.
DATA: gw TYPE makt-matnr.
*SELECT-OPTIONS: s_field1 FOR makt-matnr.
PARAMETERS:p_field1 TYPE marc-werks,
p_field2 TYPE makt-matnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field2.
REFRESH it_dynpr.
wa_dynpr-fieldname = 'P_FIELD1'.
APPEND wa_dynpr TO it_dynpr.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
* translate_to_upper = 'X'
TABLES
dynpfields = it_dynpr
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 EQ 0.
READ TABLE it_dynpr INTO wa_dynpr WITH KEY fieldname = 'P_FIELD1'.
IF sy-subrc EQ 0.
gw = wa_dynpr-fieldvalue.
ENDIF.
ENDIF.
START-OF-SELECTION.
SELECT
a~werks b~matnr b~maktx FROM marc AS a
INNER JOIN makt AS b ON a~matnr = b~matnr
UP TO 10 ROWS INTO TABLE gt_makt
WHERE werks = p_field1 AND b~spras = 'EN'.
IF sy-subrc EQ 0.
SORT gt_makt BY matnr.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'MATNR'
*
value_org = 'S'
* =
* IMPORTING
* USER_RESET =
TABLES
value_tab = gt_makt
return_tab = gt_out
* DYNPFLD_MAPPING =
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
READ TABLE gt_out INTO gs_out INDEX 1.
IF sy-subrc EQ 0.
p_field2 = gs_out-fieldval.
ENDIF.
OUT PUT:
I/P:
O/P:
No comments:
Post a Comment