REPORT z_vtest12.
* Table declaration
TABLES:
mara,
marc,
mast,
mapl.
* Selection screen
SELECT-OPTIONS : s_matnr FOR mara-matnr,
s_mtart FOR mara-mtart,
s_werks FOR marc-werks.
PARAMETERS : p_stlan TYPE mast-stlan,
p_plnty TYPE mapl-plnty.
* Variable declaration
DATA : i TYPE i.
* Internal Structure 1 declaration
TYPES : BEGIN OF ty_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
aenam TYPE mara-aenam,
vpsta TYPE mara-vpsta,
pstat TYPE mara-pstat,
lvorm TYPE mara-lvorm,
mtart TYPE mara-mtart,
mbrsh TYPE mara-mbrsh,
matkl TYPE mara-matkl,
bismt TYPE mara-bismt,
meins TYPE mara-meins,
END OF ty_mara.
* Internal table 1 declaration
DATA : it_mara TYPE TABLE OF mara,
wa_mara TYPE ty_mara.
* Internal Strucuture 2 declaration
TYPES : BEGIN OF ty_marc,
matnr TYPE marc-matnr,
werks TYPE marc-werks,
pstat TYPE marc-pstat,
lvorm TYPE marc-lvorm,
bwtty TYPE marc-bwtty,
xchar TYPE marc-xchar,
mmsta TYPE marc-mmsta,
mmstd TYPE marc-mmstd,
maabc TYPE marc-maabc,
kzkri TYPE marc-kzkri,
ekgrp TYPE marc-ekgrp,
ausme TYPE marc-ausme,
dispr TYPE marc-dispr,
dismm TYPE marc-dismm,
dispo TYPE marc-dispo,
END OF ty_marc.
* Internal table 2 declaration
DATA : it_marc TYPE TABLE OF marc,
wa_marc TYPE ty_marc.
* Internal table 3 declaration
DATA : it_mast TYPE TABLE OF mast WITH HEADER LINE.
* Outputs
WRITE : / 'Output Screen'.
* Select statement - SELECT *
SELECT *
FROM mast
INTO TABLE it_mast.
* Output for - SELECT *
SKIP 2.
IF sy-subrc <> 0.
WRITE : / 'No Selections made'.
ELSEIF sy-subrc = 0.
WRITE : / 'Output for - SELECT * statement in table MAST'.
SKIP 1.
i = 0.
LOOP AT it_mast.
IF i < 11.
WRITE : / it_mast-matnr, it_mast-werks, it_mast-stlan, it_mast-stlnr, it_mast-stlal.
i = i + 1.
ENDIF.
ENDLOOP.
ENDIF.
* Select statement - SELECT entries into internal table
SELECT matnr werks dispr dispo
FROM marc
INTO TABLE it_marc.
* Output for - SELECT entries into internal table
SKIP 4.
i = 0.
WRITE : / 'Output for - SELECT entries into internal table'.
SKIP 1.
LOOP AT it_marc INTO wa_marc.
IF i < 11.
WRITE : / wa_marc-matnr, wa_marc-werks, wa_marc-dispr, wa_marc-dispr.
i = i + 1.
ENDIF.
ENDLOOP.
* Select statement - SELECT entries into corresponding fields of table
SELECT matnr werks dispr dispo
FROM marc
INTO CORRESPONDING FIELDS OF TABLE it_marc.
* Output for - SELECT entries into corresponding fields of table
SKIP 4.
i = 0.
WRITE : / 'Output for - SELECT entries into corresponding fields of table'.
SKIP 1.
LOOP AT it_marc INTO wa_marc.
IF i < 11.
WRITE : / wa_marc-matnr, wa_marc-werks, wa_marc-dispr, wa_marc-dispo.
i = i + 1.
ENDIF.
ENDLOOP.
* Select statement - SELECT entries from selection screen
SELECT matnr werks dispr dispo
FROM marc
INTO TABLE it_marc WHERE matnr IN s_matnr AND werks IN s_werks.
* Output for - SELECT entries from selection screen
SKIP 4.
i = 0.
WRITE : / 'Output for - SELECT entries from selection screen'.
SKIP 1.
LOOP AT it_marc INTO wa_marc.
IF i < 11.
WRITE : / wa_marc-matnr, wa_marc-werks, wa_marc-dispr, wa_marc-dispo.
i = i + 1.
ENDIF.
ENDLOOP.
* Table declaration
TABLES:
mara,
marc,
mast,
mapl.
* Selection screen
SELECT-OPTIONS : s_matnr FOR mara-matnr,
s_mtart FOR mara-mtart,
s_werks FOR marc-werks.
PARAMETERS : p_stlan TYPE mast-stlan,
p_plnty TYPE mapl-plnty.
* Variable declaration
DATA : i TYPE i.
* Internal Structure 1 declaration
TYPES : BEGIN OF ty_mara,
matnr TYPE mara-matnr,
ersda TYPE mara-ersda,
ernam TYPE mara-ernam,
laeda TYPE mara-laeda,
aenam TYPE mara-aenam,
vpsta TYPE mara-vpsta,
pstat TYPE mara-pstat,
lvorm TYPE mara-lvorm,
mtart TYPE mara-mtart,
mbrsh TYPE mara-mbrsh,
matkl TYPE mara-matkl,
bismt TYPE mara-bismt,
meins TYPE mara-meins,
END OF ty_mara.
* Internal table 1 declaration
DATA : it_mara TYPE TABLE OF mara,
wa_mara TYPE ty_mara.
* Internal Strucuture 2 declaration
TYPES : BEGIN OF ty_marc,
matnr TYPE marc-matnr,
werks TYPE marc-werks,
pstat TYPE marc-pstat,
lvorm TYPE marc-lvorm,
bwtty TYPE marc-bwtty,
xchar TYPE marc-xchar,
mmsta TYPE marc-mmsta,
mmstd TYPE marc-mmstd,
maabc TYPE marc-maabc,
kzkri TYPE marc-kzkri,
ekgrp TYPE marc-ekgrp,
ausme TYPE marc-ausme,
dispr TYPE marc-dispr,
dismm TYPE marc-dismm,
dispo TYPE marc-dispo,
END OF ty_marc.
* Internal table 2 declaration
DATA : it_marc TYPE TABLE OF marc,
wa_marc TYPE ty_marc.
* Internal table 3 declaration
DATA : it_mast TYPE TABLE OF mast WITH HEADER LINE.
* Outputs
WRITE : / 'Output Screen'.
* Select statement - SELECT *
SELECT *
FROM mast
INTO TABLE it_mast.
* Output for - SELECT *
SKIP 2.
IF sy-subrc <> 0.
WRITE : / 'No Selections made'.
ELSEIF sy-subrc = 0.
WRITE : / 'Output for - SELECT * statement in table MAST'.
SKIP 1.
i = 0.
LOOP AT it_mast.
IF i < 11.
WRITE : / it_mast-matnr, it_mast-werks, it_mast-stlan, it_mast-stlnr, it_mast-stlal.
i = i + 1.
ENDIF.
ENDLOOP.
ENDIF.
* Select statement - SELECT entries into internal table
SELECT matnr werks dispr dispo
FROM marc
INTO TABLE it_marc.
* Output for - SELECT entries into internal table
SKIP 4.
i = 0.
WRITE : / 'Output for - SELECT entries into internal table'.
SKIP 1.
LOOP AT it_marc INTO wa_marc.
IF i < 11.
WRITE : / wa_marc-matnr, wa_marc-werks, wa_marc-dispr, wa_marc-dispr.
i = i + 1.
ENDIF.
ENDLOOP.
* Select statement - SELECT entries into corresponding fields of table
SELECT matnr werks dispr dispo
FROM marc
INTO CORRESPONDING FIELDS OF TABLE it_marc.
* Output for - SELECT entries into corresponding fields of table
SKIP 4.
i = 0.
WRITE : / 'Output for - SELECT entries into corresponding fields of table'.
SKIP 1.
LOOP AT it_marc INTO wa_marc.
IF i < 11.
WRITE : / wa_marc-matnr, wa_marc-werks, wa_marc-dispr, wa_marc-dispo.
i = i + 1.
ENDIF.
ENDLOOP.
* Select statement - SELECT entries from selection screen
SELECT matnr werks dispr dispo
FROM marc
INTO TABLE it_marc WHERE matnr IN s_matnr AND werks IN s_werks.
* Output for - SELECT entries from selection screen
SKIP 4.
i = 0.
WRITE : / 'Output for - SELECT entries from selection screen'.
SKIP 1.
LOOP AT it_marc INTO wa_marc.
IF i < 11.
WRITE : / wa_marc-matnr, wa_marc-werks, wa_marc-dispr, wa_marc-dispo.
i = i + 1.
ENDIF.
ENDLOOP.
No comments:
Post a Comment