# sap-samples/abap-platform-code-samples-cloud architecture

> Architecture diagram of the GitHub repository sap-samples/abap-platform-code-samples-cloud, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sap-samples/abap-platform-code-samples-cloud
- Repository: https://github.com/sap-samples/abap-platform-code-samples-cloud

## Overview

##### Project type and purpose
- This repository is a set of ABAP Platform code samples for SAP BTP (ABAP environment), specifically demonstrating how to use side-effects in RAP (Restful Application Programming Model).
- It is not a traditional multi-tier web app; rather it provides ABAP back-end artifacts (CDS definitions, Behavior Definitions, Service Definitions, Service Bindings, ABAP classes, table metadata) that you import into an ABAP environment package and then expose as OData services.

##### File structure
- Top level:
- LICENSE, README.md, REUSE.toml – project metadata and licensing
- json/ – sample payload or JSON definitions for tree traversal utility
- src/001/ – the first sample package containing all RAP objects
- Within src/001:
- package.devc.xml – ABAP package descriptor
- *.clas.abap / *.clas.xml – ABAP class implementations and metadata
- *.bdef.* / *.bdef.xml – RAP Behavior Definition artifacts
- *.ddls.* / *.ddls.xml – Data Definition Language artifacts (CDS view definitions)
- *.tabl.xml – table definitions in XML
- *.srvd.* / *.srvd.xml – Service Definition artifacts (exposed OData V4 Interfaces)
- *.srvb.xml – Service Binding artifacts (SAP Cloud Platform OData endpoint)
- *.sco2.xml – Service Consumption – UI annotations for SAP Fiori elements

##### README for additional insights
- The README confirms that each sample lives in its own “prefix‐logic” subpackage (here “001”).
- It instructs users how to import the code into a ZLOCAL package in the ABAP environment.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "SAP BTP ABAP Environment" 
        direction TB
        Package["ABAP Package ZDMO_ABAP_CLOUD_SAMPLES_01_001"]:::package
        subgraph "Module 001" 
            direction TB
            subgraph "Data Persistence Layer" 
                direction TB
                TableCalc00["zcalculato00d_01.tabl.xml"]:::persistence
                TableCalc["zcalculator.tabl.xml"]:::persistence
            end
            subgraph "Data Model Layer (CDS)" 
                direction TB
                CDS1["zc_calculatortp_01.ddls.xml"]:::datamodel
                CDS2["zc_calculatortp_01.ddlx.xml"]:::datamodel
                CDS3["zi_calculatortp_01.ddls.xml"]:::datamodel
                CDS4["zr_calculatortp_01.ddls.xml"]:::datamodel
            end
            subgraph "Business Logic Layer" 
                direction TB
                BDEF1["zc_calculatortp_01.bdef.xml"]:::business
                BDEF2["zr_calculatortp_01.bdef.xml"]:::business
                subgraph "ABAP Classes" 
                    direction TB
                    ClassImpl["zbp_r_calculator_01.clas.abap"]:::business
                    ClassLocals["zbp_r_calculator_01.clas.locals_imp.abap"]:::business
                    ClassMeta["zbp_r_calculator_01.clas.xml"]:::business
                end
            end
            subgraph "Service Exposure Layer" 
                direction TB
                SrvDef["zcalculator_01.srvd.xml"]:::service
                SrvBind["zui_calculator_o4_01.srvb.xml"]:::service
            end
            subgraph "UI Layer (Fiori Elements)" 
                direction TB
                UIAnn["zui_calculator_o4_01_0001_g4ba.sco2.xml"]:::ui
            end
        end
    end

    %% Relationships
    TableCalc00 -->|"defines tables"| CDS1
    TableCalc -->|"defines tables"| CDS1
    CDS1 -->|"entity definitions"| BDEF1
    CDS2 -->|"view definitions"| BDEF1
    CDS3 -->|"entity definitions"| BDEF2
    CDS4 -->|"entity definitions"| BDEF2
    BDEF1 -->|"invokes methods"| ClassImpl
    BDEF1 -->|"invokes methods"| ClassLocals
    BDEF2 -->|"invokes methods"| ClassImpl
    ClassImpl -->|"logic for RAP"| BDEF1
    BDEF1 -->|"exposed in"| SrvDef
    BDEF2 -->|"exposed in"| SrvDef
    SrvDef -->|"bound by"| SrvBind
    SrvBind -->|"consumed by"| UIAnn

    %% Click events
    click Package "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/package.devc.xml"
    click TableCalc00 "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zcalculato00d_01.tabl.xml"
    click TableCalc "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zcalculator.tabl.xml"
    click CDS1 "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zc_calculatortp_01.ddls.xml"
    click CDS2 "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zc_calculatortp_01.ddlx.xml"
    click CDS3 "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zi_calculatortp_01.ddls.xml"
    click CDS4 "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zr_calculatortp_01.ddls.xml"
    click BDEF1 "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zc_calculatortp_01.bdef.xml"
    click BDEF2 "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zr_calculatortp_01.bdef.xml"
    click ClassImpl "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zbp_r_calculator_01.clas.abap"
    click ClassLocals "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zbp_r_calculator_01.clas.locals_imp.abap"
    click ClassMeta "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zbp_r_calculator_01.clas.xml"
    click SrvDef "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zcalculator_01.srvd.xml"
    click SrvBind "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zui_calculator_o4_01.srvb.xml"
    click UIAnn "https://github.com/sap-samples/abap-platform-code-samples-cloud/blob/main/src/001/zui_calculator_o4_01_0001_g4ba.sco2.xml"

    %% Styles
    classDef package fill:#FFD580,stroke:#333,stroke-width:2px;
    classDef persistence fill:#FFE0E0,stroke:#E60000,stroke-width:1px;
    classDef datamodel fill:#E0FFE0,stroke:#00A600,stroke-width:1px;
    classDef business fill:#E0E0FF,stroke:#0000A6,stroke-width:1px;
    classDef service fill:#FFF0E0,stroke:#A65C00,stroke-width:1px;
    classDef ui fill:#F0E0FF,stroke:#6A00A6,stroke-width:1px;
```
