TABLES: mara.
TYPES: BEGIN OF ts_mara,
matnr TYPE mara-matnr,
ernam TYPE mara-ernam,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
END OF ts_mara.
SELECT-OPTIONS s_matnr FOR mara-matnr.
DATA dref TYPE REF TO data.
CREATE DATA dref TYPE TABLE OF ts_mara.
FIELD-SYMBOLS <it_mara> TYPE STANDARD TABLE.
ASSIGN dref->* TO <it_mara>.
SELECT matnr ernam mtart matkl
FROM mara INTO TABLE <it_mara>
WHERE matnr IN s_matnr.
IF sy-subrc = 0.
LOOP AT <it_mara> ASSIGNING FIELD-SYMBOL(<wa_mara>).
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <wa_mara> TO FIELD-SYMBOL(<matnr>).
ASSIGN COMPONENT 'ERNAM' OF STRUCTURE <wa_mara> TO FIELD-SYMBOL(<ernam>).
ASSIGN COMPONENT 'MTART' OF STRUCTURE <wa_mara> TO FIELD-SYMBOL(<mtart>).
ASSIGN COMPONENT 'MATKL' OF STRUCTURE <wa_mara> TO FIELD-SYMBOL(<matkl>).
WRITE: / <matnr>,
<ernam>,
<mtart>,
<matkl>.
ENDLOOP.
ENDIF.
TYPES: BEGIN OF ts_mara,
matnr TYPE mara-matnr,
ernam TYPE mara-ernam,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
END OF ts_mara.
SELECT-OPTIONS s_matnr FOR mara-matnr.
DATA dref TYPE REF TO data.
CREATE DATA dref TYPE TABLE OF ts_mara.
FIELD-SYMBOLS <it_mara> TYPE STANDARD TABLE.
ASSIGN dref->* TO <it_mara>.
SELECT matnr ernam mtart matkl
FROM mara INTO TABLE <it_mara>
WHERE matnr IN s_matnr.
IF sy-subrc = 0.
LOOP AT <it_mara> ASSIGNING FIELD-SYMBOL(<wa_mara>).
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <wa_mara> TO FIELD-SYMBOL(<matnr>).
ASSIGN COMPONENT 'ERNAM' OF STRUCTURE <wa_mara> TO FIELD-SYMBOL(<ernam>).
ASSIGN COMPONENT 'MTART' OF STRUCTURE <wa_mara> TO FIELD-SYMBOL(<mtart>).
ASSIGN COMPONENT 'MATKL' OF STRUCTURE <wa_mara> TO FIELD-SYMBOL(<matkl>).
WRITE: / <matnr>,
<ernam>,
<mtart>,
<matkl>.
ENDLOOP.
ENDIF.
No comments:
Post a Comment