odata-abaplisted
Install: claude install-skill williamcorrea23/sap-router-skill
# OData Service Development in ABAP
Three approaches: CDS-exposed (simplest), Service Definition + Binding (RAP, recommended), SEGW (legacy).
## Prerequisites
- SAP system with SAP Gateway (SAP_GWFND) or S/4HANA
- ABAP Development Tools (ADT) in Eclipse
- Development package and transport request
- Authorization for `/IWFND/MAINT_SERVICE`
## 1. CDS-Exposed OData (Simplest)
```cds
@OData.publish: true
@EndUserText.label: 'Product API'
define view entity Z_C_PRODUCT_API
as select from zproduct
{
key product_guid as ProductGuid,
material as Material,
material_type as MaterialType,
description as Description,
created_at as CreatedAt,
@Consumption.filter: { mandatory: false }
plant as Plant
}
```
1. Activate the CDS view in ADT
2. OData service auto-registers as `Z_C_PRODUCT_API_CDS`
3. Register in Gateway: `/IWFND/MAINT_SERVICE` → Add Service
4. Test via SAP Gateway Client (`/IWFND/GW_CLIENT`)
## 2. Service Definition + Binding (RAP — Recommended)
**Service Definition (SRVD):**
```abap
@EndUserText.label: 'Product Service'
define service Z_PRODUCT_SRV {
expose Z_C_PRODUCT_API as Product;
expose Z_C_PRODUCT_TEXT_API as ProductText;
}
```
**Service Binding (SRVB) in ADT:**
1. Right-click service definition → New → Service Binding
2. Binding type: **OData V4 (UI)**
3. Select service definition: `Z_PRODUCT_SRV`
4. Activate → click **Preview** to test
## 3. SEGW Manual OData (Legacy)
```
SEGW → Create Pro