RAP

[RAP] 전체 흐름 및 기초 개념

셜록누나 2026. 3. 15. 15:50

DB Table → CDS Data Model → Behavior → Projection → Service → Binding → OData 서비스 노출


 

1️⃣ Dictionary Layer (맨 아래)

🔹 DB Table(s)

  • SE11에서 만든 실제 물리 테이블
  • 데이터가 저장되는 곳
  • 예: ZSALES, ZC5MSVBRK, ZC5MSBSEG

✔ 여기는 그냥 저장소

✔ 로직 없음


2️⃣ Core Data Services (노란 영역)

여기가 RAP의 핵심


🔹 ① Data Model View(s)

Interface CDS View (보통 ZI_ 로 시작)

역할:

  • DB 테이블을 감싸는 CDS View
  • 데이터 모델 정의
  • association, composition 정의

예:

define root view entity ZI_SALES
  as select from zsales
{
  key vbeln,
      vkorg,
      netwr
}

✔ DB 위에 논리 모델을 하나 만든 것

✔ 아직 서비스 아님


🔹 ② Behavior Definition

.behavior 파일

여기서 정의함:

  • create
  • update
  • delete
  • action
  • validation
  • determination

예:

define behavior for ZI_SALES
persistent table zsales
lock master
{
  create;
  update;
  delete;
}

✔ "이 CDS는 생성/수정/삭제 가능하다" 정의

✔ 실제 로직은 아직 없음


🔹 ③ Behavior Pool (ABAP Class)

실제 ABAP 구현 클래스

여기서 구현:

METHOD create.
METHOD update.
METHOD delete.

✔ 진짜 로직이 들어감

✔ validation, determination 코드 작성

📌 구조:

Behavior Definition → Behavior Pool 구현

3️⃣ Business Services (파란 영역)

이제 외부에 공개하는 단계


🔹 ④ Projection View(s)

보통 ZC_ 로 시작

역할:

  • Interface View를 외부용으로 가공
  • 필드 숨기기 가능
  • UI 전용 구조
define projection view entity ZC_SALES
  as projection on ZI_SALES
{
  key vbeln,
      vkorg,
      netwr
}

✔ 내부 모델(ZI)을 외부용(ZC)으로 감싼 것


🔹 ⑤ Behavior Projection

Projection용 Behavior 정의

define behavior for ZC_SALES
{
  use create;
  use update;
  use delete;
}

✔ 내부 behavior 중 어떤 걸 쓸지 결정


🔹 ⑥ Service Definition

어떤 Projection을 서비스로 노출할지 정의

define service ZUI_SALES {
  expose ZC_SALES;
}

✔ “이 CDS를 OData로 공개하겠다”


🔹 ⑦ Service Binding

OData V4 / UI / WebAPI 바인딩

여기서:

  • OData V4 선택
  • Publish 체크
  • 서비스 URL 생성

예:

/sap/opu/odata4/sap/zui_sales/...

🔥 전체 흐름 연결

DB Table
   ↓
Data Model View (ZI_)
   ↓
Behavior Definition
   ↓
Behavior Pool (ABAP Class)
   ↓
Projection View (ZC_)
   ↓
Behavior Projection
   ↓
Service Definition
   ↓
Service Binding
   ↓
OData Service
   ↓
Fiori App

🎯 핵심 개념 정리

계층 역할

DB 실제 데이터 저장
Data Model View 논리 데이터 모델
Behavior Definition CRUD 규칙 정의
Behavior Pool 실제 ABAP 로직
Projection 외부용 모델
Service Definition 서비스 공개 선언
Service Binding OData 생성

💡 이렇게 나누는 이유

✔ 이유 1: 계층 분리

DB / 로직 / 서비스 완전 분리

✔ 이유 2: 재사용성

같은 Data Model을 여러 Projection에서 사용 가능

✔ 이유 3: 보안

Projection에서 필드 숨길 수 있음

✔ 이유 4: 확장성

클린 아키텍처 구조