@root3287/cap-segw
A CAP build tool that compiles a CDS service into the ABAP Model Provider and Data Provider classes a SAP Gateway SEGW project expects, for OData V4 by default or V2.
Writes the ABAP half of a Gateway service from the model already maintained in CDS: cds compile srv -s all --to segw produces Model Provider Class and Data Provider Class code, OData V4 by default and V2 with --odata-version 2, and cds build --for segw puts the same step in the build pipeline. Entity sets, associations and annotations come across from the CAP definitions, and a set of @segw.* annotations carries what SEGW has and CDS does not: sortable, filterable, pageable, addressable, an ABAP DDIC type or field name, an HTTP method for a V2 action. @cap-js-community/odata-v2-adapter@cap-js-community/odata-v2-adapterExposes a CAP service as OData V2 for clients that cannot move to V4.community org, cap answers the same older clients by translating inside the CAP runtime; this leaves the runtime in the ABAP system and generates the classes that system runs.
Facts
Where it sits
Who is behind it
In the atlas: maintains 1, contributes to 2@Root3287maintainer
Before choosing this
Conditions
LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2, 3A cds-plugin is used with SAP CAP materials, or an artifact is explicitly identified as a CAP plugin or application.
- § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
- § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.
- § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
PracticalFunctional boundary
The generated files are copied or deployed into the ABAP system by hand, the fourth step of its own usage list, so nothing keeps an activated service in step with the model it was generated from. Its peer dependency is @sap/cds ^9.8, so it does not install into a project on an earlier CAP release.
What it declares
Every artifact
- Type
- Build tool
- Origin
- Independently maintained
- Runtime
- build time
As a build tool
- Declared for
- ^10.1.1
- Distributed through
- npm
Connections
Exposing data and operations through OData
Download
Install
npm add @root3287/cap-segwDerived from the package name. No recipe recorded; the README has the configuration.
README
quoted from Root3287/cap-segw under Apache-2.0, readCAP SEGW
This is a custom SAP CAP Plugin that generates ABAP code for SEGW Model Provider Class (MPC) and Data Provider Class (DPC) definitions. It provides a bridge between modern CAP services and legacy SAP Gateway (OData V2) and (OData V4) environments, enabling interoperability with existing ABAP systems.
Many enterprise systems still rely on SAP NetWeaver Gateway (SEGW) projects to expose OData V2 services. This plugin allows developers to design and maintain their data models in CAP CDS while automatically generating the corresponding ABAP classes needed to integrate with older systems.
Features
- Supports entity sets, associations, and annotations from CAP definitions.
- Seamlessly integrates into the CAP build pipeline (cds build --for segw).
- Allows custom annotations to control ABAP output generation.
- Extensible design for future SEGW enhancements and ABAP compatibility layers.
Annotations
Since there are some annotations that are not present in CDS but can be set on SEGW, we added some annotations.
| Annotation | Description | Type |
|---|---|---|
@segw.name | Set the name of the component | string |
@segw.ignore | Ignores an element | boolean |
@segw.sortable | Enable Sortable | boolean |
@segw.filterable | Enabled Filterable | boolean |
@segw.conversion | ABAP Field Conversions | boolean |
@segw.pageable | Pagination | boolean |
@segw.addressable | Addressable | boolean |
@segw.ftxt_search | Filter Text Search | boolean |
@segw.subscribable | Allows to be subscribable | boolean |
@segw.filter_required | Filtered is required | boolean |
@segw.expand | Expand Complex Types | boolean |
@segw.abap.name | ABAP Field Name Override | string |
@segw.abap.type | ABAP DDIC Type | string |
@segw.abap.multiplicity | Override multiplicity for SEGW | string |
@segw.mpc.define.name | MPC Define Entity Method Name | string |
@segw.set.name | Set the name of Entity/Association Set | string |
@segw.association.name | Set the name of the association | string |
@segw.association.ignore | Ignore the parent side of an association | boolean |
@segw.action.method | Set the HTTP method for Action (ODATAV2) | string |
Installation
npm install @root3287/cap-segw
Register the plugin in your CAP project:
// in cds-plugin.js
module.exports = require("@root3287/cap-segw");
Usage
cds compile srv -s all --to segw
- Define your entities and services in CAP CDS as usual.
- Annotate your services or entities using your custom SEGW annotations (if required).
- Run
cds compile --to segwto generate ABAP classes. - Copy or deploy the generated .abap files into your ABAP system for SEGW integration.
By default this will generate an ODataV4 classes.
To switch to ODataV2 run with --odata-version 2 parameter.
Development
git clone https://github.com/Root3287/cap-segw.git
cd cap-segw
npm install
npm run build
Local Testing
# install globally
npm link
# install locally
cd /path/to/your-cap-project
npm link cap-segw
In-Repository Tests
export PATH=$PATH:$(pwd)/node_modules/.bin
mkdir node_modules/@root3287 && ln -s . node_modules/@root3287/cap-segw
License
This project is licensed under the Apache 2.0 License. See the LICENSE
History
Fixes 1
Notes
Fix
- Action/Function Imports getting
edm_set_name
Changed 2, Fixes 1
Notes
Fix
- MPCV4 using string as the data type
Changed
- MPCV4 now use SAP Constants for data types.
- Updated Test Packages
Features 1, Fixes 1
Notes
Feature
- Added implementation generator
Fix
- Referencing Association ignores
@segw.abap.name
Features 4, Changed 2, Other 2
Notes
Added
- Initial public release of the CAP ➜ SEGW generator supporting OData V2 and V4.
- MPC/DPC class generation from CAP CDS with custom
@segw.*annotations for names, ABAP types, sets, and associations. - Support for generating actions/functions, complex types, and associations across V2/V4.
- Unit and integration test suites for writers, generators, and CDS-to-ABAP conversions.
Changed
- Emits ABAP DDIC types and ABAP-friendly names via
@segw.abap.*overrides where provided. - Improved association handling to respect on-clause constraints and custom association names.
Build/CI
- GitLab CI pipeline with test/build, manual publish to GitLab registry, and GitHub status/release notifications.
- GitHub Actions workflow for npm publishing (Trusted Publishing) and GitLab registry publishing.
[1.1.6]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.1.6 https://github.com/Root3287/cap-segw/releases/tag/v1.1.6 [1.1.5]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.1.5 https://github.com/Root3287/cap-segw/releases/tag/v1.1.5 [1.1.4]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.1.4 https://github.com/Root3287/cap-segw/releases/tag/v1.1.4 [1.1.3]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.1.3 https://github.com/Root3287/cap-segw/releases/tag/v1.1.3 [1.1.2]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.1.2 https://github.com/Root3287/cap-segw/releases/tag/v1.1.2 [1.1.1]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.1.1 https://github.com/Root3287/cap-segw/releases/tag/v1.1.1 [1.1.0]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.1.0 https://github.com/Root3287/cap-segw/releases/tag/v1.1.0 [1.0.0]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.0.0 https://github.com/Root3287/cap-segw/releases/tag/v1.0.0 [1.0.0-rc.6]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.0.0-rc.6 https://github.com/Root3287/cap-segw/releases/tag/v1.0.0-rc.6 [1.0.0-rc.5]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.0.0-rc.5 https://github.com/Root3287/cap-segw/releases/tag/v1.0.0-rc.5 [1.0.0-rc.4]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.0.0-rc.4 https://github.com/Root3287/cap-segw/releases/tag/v1.0.0-rc.4 [1.0.0-rc.3]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.0.0-rc.3 https://github.com/Root3287/cap-segw/releases/tag/v1.0.0-rc.3 [1.0.0-rc.2]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.0.0-rc.2 https://github.com/Root3287/cap-segw/releases/tag/v1.0.0-rc.2 [1.0.0-rc.1]: https://git.root3287.site/root3287/cap-segw/-/releases/v1.0.0-rc.1 https://github.com/Root3287/cap-segw/releases/tag/v1.0.0-rc.1
Others providing
Compare all 12 on the OData page →- launchpad-kpilaunchpad-kpiAn OData service and a one-method ABAP interface that put a number from an abap2UI5 app on a SAP Fiori launchpad tile.community org, abapPuts a number from an abap2UI5 app on a Fiori launchpad tilefrom ABAP
- com.sap.cds:cds-adapter-odata-v2com.sap.cds:cds-adapter-odata-v2The OData V2 protocol adapter for CAP Java, which the runtime serves natively once this beta module is on the classpath, so a V2 frontend keeps working without a change to the CDS model.sap official, capOData V2 protocol adapter built into the CAP Java runtimefrom CAP
- com.sap.cds:cds-adapter-odata-v4com.sap.cds:cds-adapter-odata-v4The OData V4 protocol adapter for CAP Java, auto-exposing every Application Service in the model at /odata/v4/<Service> without protocol code of its own, active by default in the CDS Maven Archetype.sap official, capOData V4 protocol adapter for CAP Java Application Servicesfrom CAP
- @cap-js-community/odata-v2-adapter@cap-js-community/odata-v2-adapterExposes a CAP service as OData V2 for clients that cannot move to V4.community org, capExposes a CAP service as OData V2from CAP
- odata-fwodata-fwA framework for building OData services in ABAP with each entity implemented as its own class, reusable across services, so a model change no longer forces the SEGW service to be regenerated.independent, abapABAP framework for OData services with one class per entityfrom ABAP
- @odatano/core@odatano/coreA CAP plugin that serves the Cardano blockchain as OData V4, giving enterprise-shaped access to a public chain, funded through Cardano Catalyst.independent, capCAP plugin serving the Cardano blockchain as OData V4from CAP
- @odatano/nightgate@odatano/nightgateIndexes the Midnight blockchain and submits transactions to it from CAP, exposed as OData V4, with command-line tools for schema deltas, key rotation and migration.independent, capCAP plugin indexing the Midnight blockchain, exposed as OData V4from CAP
- open-steamgateopen-steamgateAn ABAP application server you clone and run on your own machine: transpiled ABAP serving classic /IWBEP/ OData v2 to Fiori over a local database, with no SAP system attached.independent, abapLocal ABAP server serving /IWBEP/ OData v2 without an SAP systemfrom ABAP
- open-abap-odataopen-abap-odataA set of OData and Gateway shims in ABAP that serve services built the SEGW way, from a model provider and a data provider class, on Node.js and in "Steampunk".community org, abapOData and Gateway shims serving SEGW-style services on Node.jsfrom ABAP
- @sap/cds@sap/cdsThe CAP Node.js runtime, which compiles the CDS model, serves the services declared in it, answers generic requests before any handler runs, and loads every cds-plugin.sap official, capCAP Node.js runtimefrom CAP
- OData Batch CreatorOData Batch CreatorBuilds the payload for an OData batch request from an uploaded $metadata XML file, generating sample data from the metadata rather than asking for it by hand.independent, abapBuilds OData batch request payloads from an uploaded $metadata filefrom ABAP
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
History in the atlas
- First seen.
For your agent
- Ref
artifact:root3287-cap-segw- JSON
- /artifacts/root3287-cap-segw.json
- MCP
- Connecting an agent