Fetching the records of table using select options in the selection screen
TABLES: SPFLI.
TYPES: BEGIN OF TY_SPFLI,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
COUNTRYFR TYPE SPFLI-COUNTRYFR,
CITYFROM TYPE SPFLI-CITYFROM,
END OF TY_SPFLI.
DATA: IT_ITAB TYPE STANDARD TABLE OF TY_SPFLI,
WA_ITAB TYPE TY_SPFLI.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS: S_CARRID FOR SPFLI-CARRID.
SELECTION-SCREEN: END OF BLOCK B1.
START-OF-SELECTION.
SELECT CARRID CONNID COUNTRYFR CITYFROM
FROM SPFLI
INTO TABLE IT_ITAB
WHERE CARRID IN S_CARRID.
IF SY-SUBRC EQ 0.
LOOP AT IT_ITAB INTO WA_ITAB.
WRITE:/ WA_ITAB-CARRID, WA_ITAB-CONNID, WA_ITAB-COUNTRYFR, WA_ITAB-CITYFROM.
ENDLOOP.
TYPES: BEGIN OF TY_SPFLI,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
COUNTRYFR TYPE SPFLI-COUNTRYFR,
CITYFROM TYPE SPFLI-CITYFROM,
END OF TY_SPFLI.
DATA: IT_ITAB TYPE STANDARD TABLE OF TY_SPFLI,
WA_ITAB TYPE TY_SPFLI.
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS: S_CARRID FOR SPFLI-CARRID.
SELECTION-SCREEN: END OF BLOCK B1.
START-OF-SELECTION.
SELECT CARRID CONNID COUNTRYFR CITYFROM
FROM SPFLI
INTO TABLE IT_ITAB
WHERE CARRID IN S_CARRID.
IF SY-SUBRC EQ 0.
LOOP AT IT_ITAB INTO WA_ITAB.
WRITE:/ WA_ITAB-CARRID, WA_ITAB-CONNID, WA_ITAB-COUNTRYFR, WA_ITAB-CITYFROM.
ENDLOOP.
ENDIF.
No comments:
Post a Comment