odatalisted
Install: claude install-skill williamcorrea23/sap-router-skill
# SAP OData Development
OData V2/V4 protocol patterns for SAP Gateway, S/4HANA, and BTP.
## OData URL Structure
```
https://<host>:<port>/sap/opu/odata/sap/<SERVICE_NAME_SRV>/<EntitySet>
?$format=json
&$filter=MaterialType eq 'FERT'
&$expand=to_ProductText
&$select=Material,Description,Plant
&$orderby=CreatedAt desc
&$top=10
&$skip=20
&$count=true
```
## OData V2 vs V4
| Feature | V2 | V4 |
|---|---|---|
| Metadata path | `/$metadata` | `/$metadata` |
| Entity key access | `/Product('MAT001')` | `/Product('MAT001')` |
| Count | `$inlinecount=allpages` | `$count=true` |
| Batch | `/$batch` | `/$batch` |
| Null values | Omitted by default | `null` returned |
| Enum types | String-based | Typed enums |
| Containment | Not supported | Navigation via containment |
## $filter Examples
```
# V2/V4 equality
$filter=MaterialType eq 'FERT'
# Numeric comparison
$filter=NetPrice gt 100 and NetPrice lt 500
# Date filter
$filter=CreatedAt ge datetime'2026-01-01T00:00:00'
# String functions
$filter=startswith(Material,'MAT')
$filter=substringof('WIDGET',Description)
# Null check
$filter=Plant eq null
$filter=Plant ne null
# Logical OR
$filter=MaterialType eq 'FERT' or MaterialType eq 'HAWA'
```
## $expand (Navigation Properties)
```
# Single-level expand
$expand=to_ProductText
# Multi-level expand (V4 only)
$expand=to_Items($expand=to_Material)
# Expand with filter
$expand=to_Items($filter=Quantity gt 10;$top=5)
```
## Deep Insert (Parent + Children)
```htt