관리 메뉴

JIHYUN JEONG

[SAP ERP] SAP ABAP 1-6. Complex Data Object 본문

SAP ERP System/ABAP 교재정리

[SAP ERP] SAP ABAP 1-6. Complex Data Object

StopHyun 2013. 4. 7. 00:10

오늘부터 SAP ABAP 정식교재에 대해서 공부를 해볼려고 합니다.


그 여섯번째 시간으로 SAP 1-6. Complex Data Object 입니다.




ㅁ Unit 9 : Complex Data Objects


ㅁ Lesson : Working with Structures


ㅁ Definition of Structures with Global Types

 - TYPES - Local type, Global type

 - EX

  * DATA 변수명 TYPE 타입명 (타입명이 ABAP Dicitionary에 있는게 Global type)


ㅁ Defining Structures with Local Types

 * TYPES : BEGION OF 구조체 명,

     ~~~~~~~~~~~~~~


     END OF 구조체 명.


ㅁ Access to Structure Components


ㅁ Copying Structure Components with the Same Name

 - MOVE-CORRESPONDING A TO B : A에 있는것을 B로 카피, 컬럼명이 같은것 만


ㅁ Structures in Debugging Mode

 

ㅁ Lesson Summary

 



ㅁ Lesson : Using Internal tables

 

ㅁ Internal Tables : Usage Options

 - Internal Table : 프로그램 내부에 존재하는 테이블, a program


ㅁ Attributs of Internal Tables

 * 구성요소

  1. Line type : 해당 테이블을 구성하는 요소( ex. CARRID, CONNID, DISTANCE) 

  2. Key : PK, FK

  3. Table Type 

   1) Standard

   2) Sorted

   3) Hashed


ㅁ Attributes and Use of Table Types


 

Index Tables 

Hashed Table 

Table Type 

 STANDARD TABLE

SORTED TABLE 

HASHED TABLE 

Index Access 

O 

 

Key Access 

O 

 O  

O 

Key Uniqueness 

NON-UNIQUE 

UNIQUE | NON-UNIQUE 

UNIQUE 

Use in 

Mainly Index Access 

Mainly Key Access 

Only Key Access 


 - 가장 효율적인 테이블 : Hashed Table

 - 검색 속도 측면 (빠른순) : Hashed > Sorted > Standard


ㅁ Defining Internal Tables with Global Types

 - DATA Internal 테이블 명 TYPE 테이블 타입     VS      DATA Internal 테이블 명 TYPE 테이블 명

  -> 테이블 타입 : Internal 테이블 형태

  -> 테이블 명 : Structure의 형태


ㅁ Defining Internal  Tables with Local Types

 - TYPES ~~~~


ㅁ Independent Definition of Internal Tables

 

ㅁ Possible Definitions of Internal Tables

 - Internal Table을 선언할 수 있는 방법


 1. DATA gt_itab TYPE <Table Type>.       - In abap dictionary 


 2. DATA gt_itab TYPE (STANDARD | SORTED | HASHED) TABLE OF <Structure Type> WITH .... KEY ....


 3. DATA gt_itab TYPE TABLE OF <Structure Type>.


ㅁ Accessing Single Record (Overview)

 * Sing Record에 대한 접근 방법


 1. APPEND : APPEND gs TO gt_itab  (주의점, gs, gt_itab 모양이 같은 라인 아이템)

 2. Insert : INSERT gs INTO TABLE gt_itab <condition>.     

 3. Read : READ TABLE gt_itab INTO gs <condition>.        조건에 맞는 gt_itab 레코드를 찾아서 gs에 넣겠다.

 4. Change : MODIFY TABLE gt_itab FROM gs [<condition>].    조건에 맞는 gt_itab을 gs로 변경해라

 5. Delete : DELETE gt_itab <condition>.   조건에 맞는 gt_itab을 지워라

 

ㅁ Processing Sets of Records (Overview)

 * Internal Table에 대한 접근 방법중 좀 더 디테일 한 내용

 - Processing record by record over the entire(or a part) of the internal table

  > LOOP AT gt_it INTO gs <condition>.

    ......

    ENDLOOP

  > LOOP AT gt_it INTO gs WHERE carrid = 'LH'.


 - Deleting several records 

  > DELETE gt_it <condition>.


 - Inserting several rows from another internal table

  > INSERT LINES of gt_it1 <condition1> 

     INTO gt_it2 <condition2>.


 - Appending several rows from another internal table

  > APPEND LINES OF gt_it1 <condition>

     TO gt_it2.


ㅁ Syxtax Example : Inserting a Row


 - Internal table을 조작하기 위한 Line type을  work area라고 함.


ㅁ Syntax Example : Outputting an Internal Table Row-By-Row


ㅁ Syntax Example : Reading by Index

 

ㅁ Syntax Example : Reading by Key

 

ㅁ Syntax Example : Sorting and Deleting Content


 - REFRESH : 메모리 반납하지 않고 공간을 삭제

 - FREE : 메모리를 반납하고 삭제


ㅁInternal Tables in Debugging Mode

 

ㅁ Comparison : Internal Tables with and Without Header Lines

 - without header vs with header 


Comments