OData Gateway Part 2: SEGW vs RAP — Two Ways to Build OData
Preview · a free account unlocks the full lesson
Compare the classic SEGW approach (code-based DPC EXT, referenced data sources, mapped CDS) with RAP (CDS + behavior definition + service definition + service binding), including the obsolete @OData. publish shortcut, and decide which to use on a given system and project.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 1 built a small SEGW service; before going deeper, it's worth knowing the alternative you'll meet on every S/4HANA project.
SEGW, the transaction-based Gateway Service Builder, has you model entity types and write CRUD logic yourself in DPC_EXT — full control, but more code: you implement filtering, paging, sorting, $expand, and error handling yourself, and it works on any NetWeaver 7.x Gateway system.
RAP, the ABAP RESTful Application Programming Model, takes a different approach: CDS views, a behavior definition, a service definition, and a service binding together generate the OData service, with the framework handling CRUD, $filter, paging, $expand, draft, and ETags for you.
There's also a middle path within SEGW itself: under Data Model → Reference → Data Source, a CDS view can become the entity set directly, which generates the read operations, while create and update logic is still coded in DPC_EXT — a reasonable middle ground on S/4HANA on-premise when RAP isn't an option.
Separately, @OData.publish: true is an annotation that was used as a shortcut in S/4HANA systems around the 1511–1909 era to generate a service automatically from a CDS view (activated the same way, in /IWFND/MAINT_SERVICE); it's read-only unless combined with BOPF, and it's now considered obsolete — new services shouldn't start with it.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.