REPORT z_vtest9.
* Table declaration
TABLES : mara,
marc,
mapl,
mast.
* Selection Screen
SELECT-OPTIONS : s_matnr FOR mara-matnr,
s_werks FOR marc-werks.
PARAMETERS : p_dispo TYPE marc-dispo.
* Internal table declaration type - 3.
* (First declare the include structures and then declare the internal table based on the structures)
* Declare internal structure 1
TYPES : BEGIN OF ty_mara,
matnr TYPE matnr,
mtart TYPE mara-mtart,
material_uom TYPE meins,
mat_grp TYPE mara-matkl,
END OF ty_mara.
* Declare internal table it_mara along with work area wa_mara (Header which can hold only one record at a time)
DATA : it_mara TYPE TABLE OF ty_mara,
wa_mara TYPE ty_mara.
* Declare internal structure 2 and then decalre internal table it_marc.
TYPES : BEGIN OF ty_marc,
matnr TYPE marc-matnr,
werks TYPE werks,
mrp_controller TYPE dispo,
pur_grp TYPE marc-ekgrp,
END OF ty_marc.
DATA : it_marc TYPE TABLE OF ty_marc,
wa_marc TYPE ty_marc.
* Declare internal structure 3 and then decalre internal table it_mast.
TYPES : BEGIN OF ty_mast,
matnr TYPE matnr,
werks TYPE mast-werks,
bom_number TYPE mast-stlnr,
END OF ty_mast.
DATA : it_mast TYPE TABLE OF ty_mast,
wa_mast TYPE ty_mast.
* Select statements
SELECT matnr mtart meins matkl
FROM mara
INTO TABLE it_mara UP TO 10 ROWS.
SELECT matnr werks dispo ekgrp
FROM marc
INTO TABLE it_marc UP TO 10 ROWS.
SELECT matnr werks stlnr
FROM mast
INTO TABLE it_mast UP TO 10 ROWS.
* Output
WRITE : / 'Temporary output screen'.
skip 5.
WRITE : / 'it_mara output'.
LOOP AT it_mara INTO wa_mara.
WRITE :/ wa_mara-matnr, ' ', wa_mara-mtart, ' ', wa_mara-material_uom, ' ', wa_mara-mat_grp.
ENDLOOP.
skip 5.
WRITE : / 'it_marc output'.
LOOP AT it_marc INTO wa_marc.
WRITE :/ wa_marc-matnr, ' ', wa_marc-werks, ' ', wa_marc-mrp_controller, ' ', wa_marc-pur_grp.
ENDLOOP.
skip 5.
WRITE : / 'it_mast output'.
LOOP AT it_mast INTO wa_mast.
WRITE :/ wa_mast-matnr, ' ', wa_mast-werks, ' ', wa_mast-bom_number.
ENDLOOP.
* Table declaration
TABLES : mara,
marc,
mapl,
mast.
* Selection Screen
SELECT-OPTIONS : s_matnr FOR mara-matnr,
s_werks FOR marc-werks.
PARAMETERS : p_dispo TYPE marc-dispo.
* Internal table declaration type - 3.
* (First declare the include structures and then declare the internal table based on the structures)
* Declare internal structure 1
TYPES : BEGIN OF ty_mara,
matnr TYPE matnr,
mtart TYPE mara-mtart,
material_uom TYPE meins,
mat_grp TYPE mara-matkl,
END OF ty_mara.
* Declare internal table it_mara along with work area wa_mara (Header which can hold only one record at a time)
DATA : it_mara TYPE TABLE OF ty_mara,
wa_mara TYPE ty_mara.
* Declare internal structure 2 and then decalre internal table it_marc.
TYPES : BEGIN OF ty_marc,
matnr TYPE marc-matnr,
werks TYPE werks,
mrp_controller TYPE dispo,
pur_grp TYPE marc-ekgrp,
END OF ty_marc.
DATA : it_marc TYPE TABLE OF ty_marc,
wa_marc TYPE ty_marc.
* Declare internal structure 3 and then decalre internal table it_mast.
TYPES : BEGIN OF ty_mast,
matnr TYPE matnr,
werks TYPE mast-werks,
bom_number TYPE mast-stlnr,
END OF ty_mast.
DATA : it_mast TYPE TABLE OF ty_mast,
wa_mast TYPE ty_mast.
* Select statements
SELECT matnr mtart meins matkl
FROM mara
INTO TABLE it_mara UP TO 10 ROWS.
SELECT matnr werks dispo ekgrp
FROM marc
INTO TABLE it_marc UP TO 10 ROWS.
SELECT matnr werks stlnr
FROM mast
INTO TABLE it_mast UP TO 10 ROWS.
* Output
WRITE : / 'Temporary output screen'.
skip 5.
WRITE : / 'it_mara output'.
LOOP AT it_mara INTO wa_mara.
WRITE :/ wa_mara-matnr, ' ', wa_mara-mtart, ' ', wa_mara-material_uom, ' ', wa_mara-mat_grp.
ENDLOOP.
skip 5.
WRITE : / 'it_marc output'.
LOOP AT it_marc INTO wa_marc.
WRITE :/ wa_marc-matnr, ' ', wa_marc-werks, ' ', wa_marc-mrp_controller, ' ', wa_marc-pur_grp.
ENDLOOP.
skip 5.
WRITE : / 'it_mast output'.
LOOP AT it_mast INTO wa_mast.
WRITE :/ wa_mast-matnr, ' ', wa_mast-werks, ' ', wa_mast-bom_number.
ENDLOOP.
No comments:
Post a Comment