1.) Structure, Table with Header line Data declaration
2.) Select Query
3.) Display of fetched records and
3.) Also usage of Insert, Modify and Delete statements for fetched records
REPORT ZREPORT4.
TYPES: BEGIN OF ITAB,
CARRID TYPE SFLIGHT-CARRID,
CONNID TYPE SFLIGHT-CONNID,
FLDATE TYPE SFLIGHT-FLDATE,
PRICE TYPE SFLIGHT-PRICE,
END OF ITAB.
* With Header Line
DATA: ITAB_FLIGHT TYPE TABLE OF ITAB INITIAL SIZE 0 WITH HEADER LINE.
SELECT CARRID CONNID FLDATE PRICE FROM SFLIGHT INTO ITAB_FLIGHT UP TO 5 ROWS.
APPEND ITAB_FLIGHT.
ENDSELECT.
LOOP AT ITAB_FLIGHT.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-connid,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ENDLOOP.
ULINE.
CLEAR ITAB_FLIGHT.
ITAB_FLIGHT-CARRID = 'XXX'.
ITAB_FLIGHT-CONNID = '747'.
INSERT ITAB_FLIGHT INTO ITAB_FLIGHT INDEX 2.
LOOP AT ITAB_FLIGHT.
FORMAT COLOR 3 ON.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-CONNID,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ENDLOOP.
ULINE.
*READ
READ TABLE ITAB_FLIGHT INDEX 2.
FORMAT COLOR 3 ON.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-CONNID,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ULINE.
FORMAT COLOR 4 ON.
LOOP AT ITAB_FLIGHT.
IF SY-TABIX = 2.
ITAB_FLIGHT-CONNID = '18'.
MODIFY TABLE ITAB_FLIGHT TRANSPORTING CONNID.
ENDIF.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-CONNID,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ENDLOOP.
ULINE.
DELETE ITAB_FLIGHT INDEX 2.
FORMAT COLOR 3 ON.
LOOP AT ITAB_FLIGHT.
FORMAT COLOR 3 ON.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-CONNID,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ENDLOOP.
ULINE.
TYPES: BEGIN OF ITAB,
CARRID TYPE SFLIGHT-CARRID,
CONNID TYPE SFLIGHT-CONNID,
FLDATE TYPE SFLIGHT-FLDATE,
PRICE TYPE SFLIGHT-PRICE,
END OF ITAB.
* With Header Line
DATA: ITAB_FLIGHT TYPE TABLE OF ITAB INITIAL SIZE 0 WITH HEADER LINE.
SELECT CARRID CONNID FLDATE PRICE FROM SFLIGHT INTO ITAB_FLIGHT UP TO 5 ROWS.
APPEND ITAB_FLIGHT.
ENDSELECT.
LOOP AT ITAB_FLIGHT.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-connid,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ENDLOOP.
ULINE.
CLEAR ITAB_FLIGHT.
ITAB_FLIGHT-CARRID = 'XXX'.
ITAB_FLIGHT-CONNID = '747'.
INSERT ITAB_FLIGHT INTO ITAB_FLIGHT INDEX 2.
LOOP AT ITAB_FLIGHT.
FORMAT COLOR 3 ON.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-CONNID,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ENDLOOP.
ULINE.
*READ
READ TABLE ITAB_FLIGHT INDEX 2.
FORMAT COLOR 3 ON.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-CONNID,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ULINE.
FORMAT COLOR 4 ON.
LOOP AT ITAB_FLIGHT.
IF SY-TABIX = 2.
ITAB_FLIGHT-CONNID = '18'.
MODIFY TABLE ITAB_FLIGHT TRANSPORTING CONNID.
ENDIF.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-CONNID,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ENDLOOP.
ULINE.
DELETE ITAB_FLIGHT INDEX 2.
FORMAT COLOR 3 ON.
LOOP AT ITAB_FLIGHT.
FORMAT COLOR 3 ON.
WRITE:/ SY-VLINE,ITAB_FLIGHT-CARRID,SY-VLINE,
10 ITAB_FLIGHT-CONNID,SY-VLINE,
25 ITAB_FLIGHT-FLDATE,SY-VLINE,
42 ITAB_FLIGHT-PRICE LEFT-JUSTIFIED,SY-VLINE.
ENDLOOP.
ULINE.
No comments:
Post a Comment