❓ 목표: carrid가 'AA'인 CARRID와 CONNID 조회
DATA: gs_sflight TYPE sflight,
gt_sflight LIKE TABLE OF gs_sflight.
SELECT carrid connid INTO CORRESPONDING FIELDS OF TABLE gt_sflight
FROM sflight
WHERE carrid = 'AA'.
LOOP AT gt_sflight INTO gs_sflight.
WRITE :/ gs_sflight-carrid, gs_sflight-connid.
ENDLOOP.
sflight는 Abap Dictionary에 있는 테이블이다
gs_sflight TYPE sflight
테이블을 바로 타입으로 선언해준다
gt_sflight LIKE TABLE OF gs_sflight
이미 선언해둔 gs_sflight의 타입을 선언해준다
SELECT carrid connid INTO CORRESPONDING FIELDS OF TABLE gt_sflight
FROM sflight
WHERE carrid = 'AA'.
INTO CORRESPONDING FIELDS OF TABLE 테이블명
DATA : BEGIN OF gs_sflight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
END OF gs_sflight.
DATA : gt_sflight LIKE TABLE OF gs_sflight.
SELECT carrid connid INTO TABLE gt_sflight
FROM sflight
WHERE carrid = 'AA'.
LOOP AT gt_sflight INTO gs_sflight.
WRITE :/ gs_sflight-carrid, gs_sflight-connid.
ENDLOOP.
DATA : BEGIN OF gs_sflight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
END OF gs_sflight.
Table 만들때 요소들을 Dictionary Table Field를 참조
DATA : gt_sflight LIKE TABLE OF gs_sflight.
마찬가지로 LIKE TABLE OF
SELECT carrid connid INTO TABLE gt_sflight
FROM sflight
WHERE carrid = 'AA'.
INTO TABLE 테이블명