본문 바로가기
IT/SAP ABAP

W4DA _ Object-Oriented Programming

by caramba 2017. 1. 2.

Unit 1 Introduction to Object-Oriented Programming


The Procedural Prog. Model


Concepts of Object-Oriented Programming Model 

p 011

 Encapsulation / Inheritance ( 상속 ) / Polymorphism for support of generic programming / Event Controlling

 


Unit 2 Fundamental Object-Oriented Syntax

p 033

Creating Local Classes

Class 에 선언할 수 없는 4가지 - p 37

  1. TABLES

  2. OCCURS 0

  3. WITH HEADER LINE

  4. LIKE structure type ( data obj, system field 는 가능 )


-> READ ONLY : METHOD를 만들어서 안에서 써라, CLASS밖에서는 수정이 안된다.


Static attributes and Instance attributes / Static Methods and Instance Methods

p 40, 44

Static attributes      - Exist once per class. / Defined with CLASS-DATA

Instance attributes - Exist once per object. / Defined with DATA

Static Methods       - Only static components can be accessed.                    / Defined with CLASS-METHODS

Instance Methods   - Both static and instance components can be accessed. / Defined with METHODS



Creating Objects

p 054

Internal Table을 활용 ( ref1 = 주소 )

  n_o_vehicles 는 static --


Method Calls

p 63

** Method 호출 **


1. Instance 활용 ( -> )

1. Method 선언부에 Importing이 있으면 - Call 할 때 Exporting 필요
Call method 이렇게도 가능

3. Private Section 안에 Method 사용 방식. Public Method 안에서 사용


2. Class 활용 ( => )

1. CLASS-METHODS 는 static, CLASS-DATA, 사용해야 함.

2. Initiation 필요없이 CLASS 명 => CLASS-METHOD 명으로 바로 사용 가능.



Functional Method Calls **

p 066

  • IMPORTING 을 통해 값을 전달받고 RETURNING VALUE( … )로 값을 내보냄

  • Precisely one Returning parameters. (리터닝 파라미터는 반드시 1개만!)

  • JAVA 에서 return 값이 있는 Method와 비슷하다고 보면 될 듯.

 MOVE lcl_vehicle=>calculatoriv_int1 300 iv_int2 400 TO result2. ( MOVE TO 사용 가능 )



Unit 3 Inheritance ( 상속 ) and Casting

p 105

Implementation of Inheritance  

public, protected : 상속 o / private : 상속x

Program 코딩상으로 상속을 표현 할 때 Definition INHERITING FROM + super class(부모 클래스)



Redefinition of Methods ( 부모로부터 상속 받은 Method 재정의 )

p 109

1. Signature must be retained ( 인자 값은 바꾸지 못한다. )
2. 
New implementation of inherited method. (상속 받은 Method 재정의 가능 )
3. Can use "super->" to access components in the superclass. ( 상속 받은 Method 바로 사용 가능 )
    cf) 다형성(Polymorphism)을 위해 사용 / 같은 명령어로 각자 다른 행동을 하게끔…!


Subclass Constructor

p 110

a. 인자값 추가 가능

b. super에 대한 constructor 사용 必, 그 후 자기가 정의한 부분을 추가 가능


Constructor(생성자, 부모 class에서 생성한 초기값) 재정의 불가. Cannot redefine Constructor.

- constructor에서만 Overloading 가능

- Overloading in JAVA : 인자값에 따라 다른 Method 호출.


Inheritance and Static Components - p 012

1. Static method cannot be redefined.

2. The static constructor of a superclass is executed when the superclass or one of its subclass is accessed for the first time.
      ( 슈퍼클래스의 생성자는 슈퍼클래스뿐만 아니라 서브클래스 접근에도 생성된다. )
3. A subclass can always have a static constructor irrespective of superclass. ( ~에 관계없이 )

4. The superclass static constructor will execute first immediately followed by the subclass static constructor.

( 슈퍼 클래스의 생성자가 먼저 실행된다. )


Implementing Upcast Using Inheritance

p 125


SUPER: ZABAP01_GLOBAL_CLASS_3 / SUB: ZCL01_VEHICLE, BUS, TURCK, CAR



Downcasts Using Inheritance

부모 -> 자식




Unit 4 Interface and Casting 

p 162

Interface의 특징

  1. public 섹션 만이 존재

  2. Interfaces 라는 문장을 통해 인터페이스를 받음

  3. 한개의 클래스가 여러개의 인터페이스를 받을 수 있다 ( multiple inheritance )

  4. 인터페이스의 메소를 사용할때 ~(tild)가 생김

  5. 정의영역은 있지만, 구현영역만 있음(구현은 상속받은 클래스에서 실시함) ( No implementation part )

cf ) ZABAP01_GLOBAL_CLASS_6

compound interface : Interface가 Interface를 호출하는 형태



Unit 5 



Unit 8 Class-Based Exceptions

p 332




Unit 9 Object-Oriented Design Patterns

p 381




Unit 10 Program Calls amd Memory Management

p 421

두 프로그램 간 데이데를 넘길 수 있는 경우

  1. SAP Memory : field 단위의 이동

  2. ABAP Memory : work area, table 등의 이동

  3. Interface

  4. Shared Object

  5. Database ( Table ) : insert, update

  6. File ( Application ) / UPLOAD, DOWNLOAD


1. SAP Memory ( set / get parameter )

- External Session 사이에 Data 전달
- Field 단위 정도 크기 가능 ( work area, internal table 불가 ) - se16 -> TPARA 에서 관리


2. ABAP Memory

- Work area, Internal table. 많은 양의 Data 호출 가능

- 형태
EXPORT parameter_list TO MEMORY [COMPRESSION {ON|OFF}].
IMPORT parameter_list FROM MEMORY [conversion_options].

SUBMIT[program name] AND RETURN.

- 같은 이름의 Work Area 이동

- 다른 이름의 Internal Table 이동






cf ) http://abapsharebyreza.blogspot.kr/2013/11/taw-12-introduction-to-object-oriented.html



댓글