- A CAP Node.js service that proxies the S/4HANA `API_OUTBOUND_DELIVERY_SRV` OData v2 API
- A pro-code A2A Agent endpoint ready to be integrated with Joule or any MCP-compatible AI tool (such as Claude)
- SAP BTP account with a Cloud Foundry environment
- SAP S/4HANA Cloud system with access to the Outbound Delivery API
- SAP CAP (`@sap/cds`) installed globally
- Node.js 20+
- Cloud Foundry CLI (`cf`)
- SAP AI Core service instance on BTP
cd capagents4
code .
“cds”: {
“requires”: {
“API_OUTBOUND_DELIVERY_SRV_0002”: {
“kind”: “odata-v2”,
“model”: “srv/external/API_OUTBOUND_DELIVERY_SRV_0002”
}
}
}
“requires”: {
“API_OUTBOUND_DELIVERY_SRV_0002”: {
“kind”: “odata-v2”,
“model”: “srv/external/API_OUTBOUND_DELIVERY_SRV_0002”,
“[hybrid]”: {
“csrf”: true,
“csrfInBatch”: true,
“credentials”: {
“url”: “https://<S4-instance>-api.s4hana.ondemand.com/sap/opu/odata/sap/API_OUTBOUND_DELIVERY_SRV;v=0002”,
“authentication”: “BasicAuthentication”,
“username”: “<S4-communication-user>”,
“password”: “<S4-communication-password>”
}
},
“[production]”: {
“credentials”: {
“destination”: “<S4-destination-name>”,
“path”: “/sap/opu/odata/sap/API_OUTBOUND_DELIVERY_SRV;v=0002”
}
}
}
}
}
service dnsservices {
entity DeliveryDocument as projection on s4h.A_OutbDeliveryHeader;
entity DeliveryDocumentItem as projection on s4h.A_OutbDeliveryItem;
type DeliveryItemInput {
ReferenceSDDocument : String;
ReferenceSDDocumentItem : String;
}
action createDelivery(ShippingPoint: String,
items: many DeliveryItemInput) returns DeliveryDocument;
}
annotate dnsservices with @AGent;
module.exports = class dnsservices extends cds.ApplicationService {
async init() {
const s4h = await cds.connect.to(“API_OUTBOUND_DELIVERY_SRV_0002”);
const { DeliveryDocument, DeliveryDocumentItem } = this.entities;
this.on(“READ”, DeliveryDocument, (req) => s4h.run(req.query));
this.on(“READ”, DeliveryDocumentItem, (req) => s4h.run(req.query));
this.on(“createDelivery”, async (req) => {
const { ShippingPoint, items } = req.data;
const result = await s4h.post(“/A_OutbDeliveryHeader”, {
ShippingPoint,
to_DeliveryDocumentItem: items.map((i) => ({
ReferenceSDDocument: i.ReferenceSDDocument,
ReferenceSDDocumentItem: i.ReferenceSDDocumentItem,
})),
});
return result;
});
return super.init();
}
};
“kind”: “aicore”,
“model”: “anthropic–claude-4.6-sonnet”
},
cds add xsuaa
cds add mta
cds bind -2 <AI Core instance>
npm i
cds watch –profile hybrid
