본문 바로가기
IT/SAP ABAP

W1D4 _ Unit 11 _ p367 _ Complex Data Objects _ incomplete

by caramba 2016. 12. 15.

Unit 11 Complex Data Objects

p 367

Definition of structure with global types


Definition of structure with local types


DATA: BEGIN OF wa1,
                ~ contents ~
            END OF wa1.

cf) 여러 테이블의 data type불러올 수 있다.



Use of Structured Data Object

p 370

Copies of Structure Components with the Same Name

- MOVE-CORRESPONDING  structure_name  TO  structure_name


1
2
3
4
DATA: a TYPE bc400_s_flight,
      b TYPE gty_s_flightinfo.
 
MOVE-CORRESPONDING a TO b.
cs

필드명이 일치하는 것 기준으로 데이터를 옮겨주며, structure끼리만 가능. select 문장 밖에서 이루어짐?



By using the MOVE-CORRESPONDING statement, you can copy structure components with the same name from the source structure to the target structure, one component at a time. 




Using Internal Tables

p 381

Standard Table - 90% 사용 / Index Access - 앞, 뒤 몇 번째에 유리 (중간 targeting 느림) / flexable

Sorted Table    - DB에서 가져올 때 Key 기준 오름차순 자동 정렬 / sort 한 번 더 하면 Syntax error 발생. 

Hashed Table   - Key Access


How to make respective tables

TABLES : scarr ---> table로 선언된 경우에는 Work Area를 의미함.

여기서 scarr은 data-obj


DATA: scarr TYPE scarr. " 에러 안 나도 잘못 쓴, 아래처럼 써야해

*******************************************************************

" table이라고 해서 internal table이 되는 것이 아니다




Usage of Internal Tables
p 387

APPEND - appends the content of structure to an internal table, and this operation can be only be used with standard table. ???

INSERT - inserts the content of a structure into an internal table.

READ TABLE - copies the content of a table row to a structure.

MODIFY TABLE overwrites an internal table row with the content of a structure,

DELETE - deletes a row of an interal table






p387

append로 데이터 추가 후  - >  loop로 뽑기 // ex) for문

ex1)


ex2)

LOOP AT it2 INTO wa2 FROM 1 TO 2. " internal table 회전 // from 부터 to 까지


ex3)  loop 밖에서의 index 사용법



ex 4)

single 말고 여러 건 만들려


headline을 가진 internal table


cf) it1 = itab[] / wa1 = itab







sy-tabix -  loop at ~~ endloop




Statements for Deleting Table

p 393

 - REFRESH : deletes the entire content of the internal table. A part of the previously used memory remains available for future insertions.

 - CLEAR    : For internal tables with header lines, this statement only initializes the header line but dose not delete the table content.

 - FREE      : deletes the entire content of the internal table and releases the previously used memory.


clear itab : header line 삭제 - 이게 뭐였지. 삭제하면 ?

clear itab[] : body

refresh itab : body 삭제

free itab : refresh와 같으나, 메모리까지 삭제






exercise 필수 !!! p 397


키워드: BEGIN OF - END OF / MOVE-CORRESPONDING TO


cf) http://abapsharebyreza.blogspot.kr/2014/01/taw10-complex-data-objects.html

댓글