DATA GT_BSEG LIKE BSEG OCCURS 0 WITH HEADER LINE.
Header Line X | Header Line O |
---|---|
LOOP AT ITAB INTO WA. WRITE WA-ID. ENDLOOP. | LOOP AT ITAB. WRITE: ITAB-EMPNO. ENDLOOP. |
Header Line X | Header Line O |
---|---|
MODIFY TABLE ITAB FROM WA. | MODIFY TABLE ITAB. |
modify
- DB Modify
db에 modify를 하면 키값이 일치하는 자료가 있으면 update, 없으면 insert- Internal Table Modify
update 역할 자료가 없을 경우에 insert가 되지 않음.
인터널테이블에 자료를 modify 하실때 자료가 없다면 append ( 또는 insert) 해줘야 함.
Header Line X | Header Line O |
---|---|
READ TABLE GT_DATA INTO WA INDEX P_ROW. | READ TABLE GT_DATA INDEX P_ROW. |
** 1. STRUCTURE Type 선언
TYPES: BEGIN OF T_LINE,
FIELD1 TYPE C LENGTH 5,
FIELD2 TYPE C LENGTH 4,
FIELD3 TYPE I,
END OF T_LINE.
** 2. Standard Table 타입 선언
TYPES T_TAB TYPE STANDARD TABLE OF T_LINE WITH NON-UNIQUE DEFAULT KEY.
** 3. Internal Table 선언
DATA GT_ITAB TYPE T_TAB WITH HEADER LINE.
GT_ITAB-FIELD1 = 'ENJOY'.
GT_ITAB-FIELD2 = 'ABAP'.
GT_ITAB-FIELD3 = '1'.
APPEND GT_ITAB.
READ TABLE GT_ITAB INDEX 1.
WRITE: / GT_ITAB-FIELD1, GT_ITAB-FIELD2, GT_ITAB-FIELD3.
** 1. STRUCTURE Type 선언
TYPES: BEGIN OF T_LINE,
COL TYPE C,
SEQ TYPE I,
END OF T_LINE.
** 2. Sorted Table 타입 선언
TYPES T_TAB TYPE SORTED TABLE OF T_LINE WITH UNIQUE KEY COL.
** 3. Internal Table 선언
DATA GT_ITAB TYPE T_TAB WITH HEADER LINE.
GT_ITAB-COL = 'B'.
GT_ITAB-SEQ = '1'.
INSERT TABLE GT_ITAB.
GT_ITAB-COL = 'A'.
GT_ITAB-SEQ = '2'.
INSERT TABLE GT_ITAB.
CLEAR GT_ITAB.
READ TABLE GT_ITAB INDEX 2.
WRITE: / GT_ITAB-COL, GT_ITAB-SEQ.