본문 바로가기

[ABAP Cloud 기초 #5] CDS Association

2026.11.0914
목차2

Association은 CDS 뷰끼리 관계를 미리 걸어 두는 것. 조인이랑 비슷한데, 그쪽 필드를 실제로 쓸 때만 조인함.

예제

SAP ABAP cheat sheet 예제 일부.

define view entity zdemo_abap_cds_ve_assoc
  as select from zdemo_abap_cds_ve_assoc_e as _flsch
  association [1..1] to zdemo_abap_carr as _carr1 on _flsch.Carrid = _carr1.carrid
{
  key _flsch.Carrid   as carrier,
  key _flsch.Connid   as connection_id,
      _carr1.carrname as carrier_name
}
  • association [1..1] to 대상 as 이름 on 조건으로 관계를 정의
  • _carr1.carrname처럼 대상 필드를 쓰면 그때 조인됨
  • [1..1]은 1:1, [1..*]은 1:N

노출

필드 목록에 association 이름만 넣어 두면(예: _carr1) 이 뷰를 쓰는 다른 CDS 뷰나 ABAP에서 필요할 때 꺼내 쓸 수 있음. 이걸 노출(expose)이라고 함.

다음 편: [ABAP Cloud 기초 #6] CDS 어노테이션

댓글

아직 댓글이 없어요.

더 보기
  1. ABAPTailwind2026.11.10

    [ABAP Cloud 기초 #9] RAP 서비스 정의와 바인딩

  2. ABAPTailwind2026.11.10

    [ABAP Cloud 기초 #8] RAP 동작 정의

  3. ABAPTailwind2026.11.09

    [ABAP Cloud 기초 #7] RAP 전체 구조