Code: Alles auswählen.
REPORT Z_107_02.
TABLES: spfli, sflight.
*1. Selection Screen
PARAMETERS CARRIER(3) TYPE c DEFAULT 'LH'.
*2. Selection Screen
SELECT-OPTIONS date FOR sflight-fldate.
START-OF-SELECTION.
SELECT * FROM spfli
where carrid = CARRIER.
WRITE: / spfli-carrid, spfli-connid, spfli-cityfrom, spfli-cityto.
ENDSELECT.
SKIP.
IF SY-SUBRC = 4.
WRITE: 'No records have been found!'.
ELSE.
WRITE: / 'Number of flights:', SY-DBCNT.
ENDIF.
Code: Alles auswählen.
SELECT *
FROM spfli, spflight
WHERE spfli-carrid = spflight-carrid
AND spfli-carrid = carrier (der Parameter)
AND sflight-fldate (das Datumsfeld von spflight) = innerhalb der Select-Option
Code: Alles auswählen.
REPORT Z_107_02.
TABLES: spfli, sflight.
*1. Selection Screen
PARAMETERS carrier TYPE c DEFAULT 'LH'.
*2. Selection Screen
SELECT-OPTIONS date FOR sflight-fldate.
SELECT *
FROM spfli join sflight on spfli~carrid = sflight~carrid
WHERE
spfli~carrid = carrier
AND sflight~fldate in date.
SKIP.
IF SY-SUBRC = 4.
WRITE: 'No records have been found!'.
ELSE.
WRITE: / 'Number of flights:', SY-DBCNT.
ENDIF.
Code: Alles auswählen.
REPORT Z_107_02.
TABLES: spfli, sflight.
*1. Selection Screen
PARAMETERS carrier TYPE c DEFAULT 'LH'.
*2. Selection Screen
SELECT-OPTIONS date FOR sflight-fldate.
SELECT *
FROM spfli join sflight on spfli~carrid = sflight~carrid
WHERE
spfli~carrid = carrier
AND sflight~fldate in date.
*Hier kannst du Zeile für Zeile etwas ausgeben. z.B:
write: / spfli-cityfrom, spfli-cityto.
ENDSELECT.
SKIP.
IF SY-SUBRC = 4.
WRITE: 'No records have been found!'.
ELSE.
WRITE: / 'Number of flights:', SY-DBCNT.
ENDIF.
Code: Alles auswählen.
TABLES: spfli, sflight.
types: begin of my_struc.
include structure spfli.
types: end of my_struc.
data: gt_tab type table of my_struc.
*1. Selection Screen
PARAMETERS carrier TYPE c DEFAULT 'LH'.
*2. Selection Screen
SELECT-OPTIONS date FOR sflight-fldate.
SELECT *
FROM spfli join sflight on spfli~carrid = sflight~carrid
into CORRESPONDING FIELDS OF TABLE gt_tab
WHERE
spfli~carrid = carrier
AND sflight~fldate in date.
SKIP.
IF SY-SUBRC = 4.
WRITE: 'No records have been found!'.
ELSE.
WRITE: / 'Number of flights:', SY-DBCNT.
ENDIF.
Code: Alles auswählen.
REPORT Z_107_02.
TABLES: spfli, sflight.
types: begin of my_struc.
include structure spfli.
types: end of my_struc.
data: gt_tab type table of my_struc.
*1. Selection Screen
PARAMETERS carrier(3) TYPE c DEFAULT 'LH'.
*2. Selection Screen
SELECT-OPTIONS date FOR sflight-fldate.
SELECT *
FROM spfli join sflight on spfli~carrid = sflight~carrid
into CORRESPONDING FIELDS OF TABLE gt_tab
WHERE
spfli~carrid = carrier
AND sflight~fldate in date.
WRITE: / spfli-carrid, spfli-connid, spfli-cityfrom, spfli-cityto.
SKIP.
IF SY-SUBRC = 4.
WRITE: 'No records have been found!'.
ELSE.
WRITE: / 'Number of flights:', SY-DBCNT.
ENDIF.
Code: Alles auswählen.
DATA: wa_struc TYPE my_struc.
...
...
LOOP AT gt_tab INTO wa_struc.
WRITE: / wa_struc-carrid, wa_struc-connid, wa_struc-cityfrom, wa_struc-cityto.
ENDLOOP.