1. Using SEGW (Service Gateway Builder) – Traditional Approach
Transaction code: SEGW
Steps:
Create a new project in SEGW.
Define Data Model (Entity Types & Entity Sets).
Map Entities to ABAP structures/tables.
Implement CRUD operations in DPC (Data Provider Class).
Register and activate the service in /IWFND/MAINT_SERVICE.
✅ Use Case: Legacy SAP systems, custom OData for ECC or S/4HANA on-prem.
❌ Limitation: Manual coding, more effort, less aligned with modern RAP.
2. From ABAP CDS Views (Annotation-Based Exposure)
Use annotation:
@OData.publish: true
define view entity Z_SalesOrder as select from I_SalesOrder { … }
The CDS View is automatically published as an OData service.
Then activate the service in /IWFND/MAINT_SERVICE.
✅ Use Case: Quick and simple OData exposure from CDS Views.
❌ Limitation: Only read-only services, no transactional behavior.
3. Using the RAP (RESTful ABAP Programming Model)
RAP provides managed OData services with end-to-end support:
Define CDS Data Model (Root & Projection Views).
Define Behavior Definition (CRUD operations, determinations, validations).
Create Service Definition to expose data.
Create Service Binding (OData V2/V4) and publish.
✅ Use Case: Modern SAP S/4HANA Cloud / On-Prem for transactional + analytical apps.
❌ Limitation: Available only in S/4HANA and requires ABAP on Eclipse (ADT).
4. Using SAP Gateway Service Builder + RFC/BAPI
Wrap an RFC or BAPI in SEGW to expose as OData.
Often used in integration scenarios.
✅ Use Case: Exposing existing RFC/BAPIs as REST APIs.
❌ Limitation: Old-school approach, less future-proof.