TABLES: ekbe.
TYPES: BEGIN OF ts_ekbe,
ebeln TYPE ekbe-ebeln,
ebelp TYPE ekbe-ebelp,
zekkn TYPE ekbe-zekkn,
vgabe TYPE ekbe-vgabe,
gjahr TYPE ekbe-gjahr,
belnr TYPE ekbe-belnr,
buzei TYPE ekbe-buzei,
bwart TYPE ekbe-bwart,
budat TYPE ekbe-budat,
menge TYPE ekbe-menge,
matnr TYPE ekbe-matnr,
werks TYPE ekbe-werks,
maktx TYPE makt-maktx,
END OF ts_ekbe.
FIELD-SYMBOLS: <wa_ekbe> TYPE ts_ekbe,
<it_ekbe> TYPE STANDARD TABLE.
TYPES: BEGIN OF ts_makt,
matnr TYPE makt-matnr,
spras TYPE makt-spras,
maktx TYPE makt-maktx,
END OF ts_makt.
FIELD-SYMBOLS: <wa_makt> TYPE ts_makt,
<it_makt> TYPE STANDARD TABLE.
DATA: dref TYPE REF TO data,
wa_ekbe TYPE ts_ekbe.
SELECT-OPTIONS s_ebeln FOR ekbe-ebeln.
START-OF-SELECTION.
CREATE DATA dref TYPE TABLE OF ts_ekbe.
ASSIGN dref->* TO <it_ekbe>.
SELECT ebeln ebelp zekkn vgabe
gjahr belnr buzei bwart
budat menge matnr werks
FROM ekbe INTO TABLE <it_ekbe>
WHERE ebeln IN s_ebeln
AND matnr NE ' '.
IF sy-subrc = 0.
CREATE DATA dref TYPE TABLE OF ts_makt.
ASSIGN dref->* TO <it_makt>.
ASSIGN 'matnr = <it_ekbe>-matnr' TO FIELD-SYMBOL(<matnr>).
SELECT matnr spras maktx
FROM makt INTO TABLE <it_makt>
FOR ALL ENTRIES IN <it_ekbe>
WHERE (<matnr>).
IF sy-subrc = 0.
SORT <it_makt> BY ('MATNR').
ENDIF.
ENDIF.
WRITE: / 'PO',
12 'Item',
18 'Material Doc.',
32 'Year',
38 'Movement',
48 'Date',
60 ' Quantity',
80 'Material',
105 'Description'.
ULINE.
IF <it_ekbe> IS ASSIGNED.
LOOP AT <it_ekbe> ASSIGNING <wa_ekbe>.
IF <it_makt> IS ASSIGNED.
READ TABLE <it_makt> ASSIGNING <wa_makt>
WITH KEY ('MATNR') = <wa_ekbe>-matnr
BINARY SEARCH.
IF sy-subrc = 0.
<wa_ekbe>-maktx = <wa_makt>-maktx.
ENDIF.
ENDIF.
wa_ekbe = <wa_ekbe>.
WRITE: / wa_ekbe-ebeln,
12 wa_ekbe-ebelp,
18 wa_ekbe-belnr,
32 wa_ekbe-gjahr,
38 wa_ekbe-bwart,
48 wa_ekbe-budat,
60 wa_ekbe-menge,
80 wa_ekbe-matnr,
105 wa_ekbe-maktx.
ENDLOOP.
ENDIF.
TYPES: BEGIN OF ts_ekbe,
ebeln TYPE ekbe-ebeln,
ebelp TYPE ekbe-ebelp,
zekkn TYPE ekbe-zekkn,
vgabe TYPE ekbe-vgabe,
gjahr TYPE ekbe-gjahr,
belnr TYPE ekbe-belnr,
buzei TYPE ekbe-buzei,
bwart TYPE ekbe-bwart,
budat TYPE ekbe-budat,
menge TYPE ekbe-menge,
matnr TYPE ekbe-matnr,
werks TYPE ekbe-werks,
maktx TYPE makt-maktx,
END OF ts_ekbe.
FIELD-SYMBOLS: <wa_ekbe> TYPE ts_ekbe,
<it_ekbe> TYPE STANDARD TABLE.
TYPES: BEGIN OF ts_makt,
matnr TYPE makt-matnr,
spras TYPE makt-spras,
maktx TYPE makt-maktx,
END OF ts_makt.
FIELD-SYMBOLS: <wa_makt> TYPE ts_makt,
<it_makt> TYPE STANDARD TABLE.
DATA: dref TYPE REF TO data,
wa_ekbe TYPE ts_ekbe.
SELECT-OPTIONS s_ebeln FOR ekbe-ebeln.
START-OF-SELECTION.
CREATE DATA dref TYPE TABLE OF ts_ekbe.
ASSIGN dref->* TO <it_ekbe>.
SELECT ebeln ebelp zekkn vgabe
gjahr belnr buzei bwart
budat menge matnr werks
FROM ekbe INTO TABLE <it_ekbe>
WHERE ebeln IN s_ebeln
AND matnr NE ' '.
IF sy-subrc = 0.
CREATE DATA dref TYPE TABLE OF ts_makt.
ASSIGN dref->* TO <it_makt>.
ASSIGN 'matnr = <it_ekbe>-matnr' TO FIELD-SYMBOL(<matnr>).
SELECT matnr spras maktx
FROM makt INTO TABLE <it_makt>
FOR ALL ENTRIES IN <it_ekbe>
WHERE (<matnr>).
IF sy-subrc = 0.
SORT <it_makt> BY ('MATNR').
ENDIF.
ENDIF.
WRITE: / 'PO',
12 'Item',
18 'Material Doc.',
32 'Year',
38 'Movement',
48 'Date',
60 ' Quantity',
80 'Material',
105 'Description'.
ULINE.
IF <it_ekbe> IS ASSIGNED.
LOOP AT <it_ekbe> ASSIGNING <wa_ekbe>.
IF <it_makt> IS ASSIGNED.
READ TABLE <it_makt> ASSIGNING <wa_makt>
WITH KEY ('MATNR') = <wa_ekbe>-matnr
BINARY SEARCH.
IF sy-subrc = 0.
<wa_ekbe>-maktx = <wa_makt>-maktx.
ENDIF.
ENDIF.
wa_ekbe = <wa_ekbe>.
WRITE: / wa_ekbe-ebeln,
12 wa_ekbe-ebelp,
18 wa_ekbe-belnr,
32 wa_ekbe-gjahr,
38 wa_ekbe-bwart,
48 wa_ekbe-budat,
60 wa_ekbe-menge,
80 wa_ekbe-matnr,
105 wa_ekbe-maktx.
ENDLOOP.
ENDIF.
No comments:
Post a Comment