본문 바로가기

Programming/ABAP

Internal Table 데이터 채우기

1. 한 줄씩 데이터 추가하기 - APPEND

다른 work area에서 internal table에 한 줄을 추가하거나, internal table에 첫 한 줄을 추가할 수 있다.

 

Syntax

APPEND [<wa> TO / INITIAL LINE TO] <itable>.

 

work area <wa> 또는 intial line이 internal table <itable>에 추가된다.

시스템 변수 SY-TABIX에 더해진 줄의 인덱스가 추가된다.

 

Example

Data: Begin of itab occurs 10,

col1 type C,

col2 type I,

end of itab.

Append initial line to itab.

* output :  ' ' '0'

 

initial line은 해당 유형에 맞는 초기 값을 테이블에 추가한다. 여기서 col1은 문자이고 col2는 정수이므로, col1의 경우 공백, col2의 경우 0 이 추가된다.

 

2. INSERT 문

internal table에 행/작업 영역을 추가한다. INSERT 문과 함께 INDEX 절을 사용하여 데이터를 추가할 위치를 지정할 수 있다.

 

Syntax

INSERT [<wa> INTO / INITIAL LINE INTO] <itable> [index <idx>].

 

work area <wa> 또는 initial line은 internal table <itable>의  index <idx>에 삽입된다.

 

 

 

728x90

'Programming > ABAP' 카테고리의 다른 글

Internal Table 복사 및 삭제  (0) 2023.08.07
Internal Table 데이터 읽기  (0) 2023.08.04
Internal Table 생성하기  (0) 2023.08.02
Internal Table, Work area  (0) 2023.08.01
Call by Value /Call by Reference /Call by Value and Reference  (0) 2023.07.31