Skip to content

SAP BTP

Closing the B2B Loop: Event-Driven Notifications with SAP CAP and Integration Suite

HarderTech LLC

After CardQuest’s purchase order lands in CreatureWorks, confirm and ship events have to reach the game — queued CAP notifications, an outbound iFlow, and a working test receiver.

Sending order confirmations and shipment notifications from SAP BTP so CardQuest can eventually mark packs as available.

Part 1 covered how a reward-based collectible-card game led to CreatureWorks on SAP BTP. Part 2 covered inbound purchase orders from CardQuest into that supplier.

Imagine what happens after that call succeeds. The purchase order is in. The sales order exists as SUBMITTED. For the game to sell or open those packs later, CardQuest still needs to know whether I confirmed the order and whether anything shipped. Checking Work Zone by hand isn’t an integration.

Part 3 is the return path: after I confirm and ship, an external receiver gets ORDER_CONFIRMED and DELIVERY_SHIPPED events. Those events are what a future CardQuest service would use to update its own inventory before packs show up in the in-game store.

The reward system, currency earning, pack opening, and collection gameplay are still being built. What works today is the SAP-side outbound integration — proven against a temporary test receiver.

Ecosystem story: packs, order, fulfill, deliver, retail game

Longer-term picture: CreatureWorks fulfills; CardQuest receives inventory and players open packs. This article is the notification plumbing on the SAP side.

Why not call Integration Suite inside the Confirm button?

Confirming a sales order updates durable state: status becomes CONFIRMED, and inventory reservation increases (see Part 1 — reservation is on confirm, not on order create).

If that same request also POSTs to Integration Suite and CPI is down, I’m stuck:

  • fail a good confirmation because messaging failed, or
  • confirm successfully and lose the notification with no recovery story

So I separated business commit from external delivery. CAP confirms first. As part of that work it queues a notification. After the transaction commits, a dispatcher sends the event through an outbound iFlow.

That’s a transactional outbox pattern. I used CAP’s queued event processing rather than inventing a custom table and worker from scratch.

How the notification design works

CAP side

The notification work lives next to the existing order libraries — notification-service plus srv/lib/order-notification.js.

Notification modules in the CAP srv tree

notification-service and order-notification.js alongside the B2B and supplier services.

NotificationService exposes a deliver event. After successful confirm or ship, queueOrderNotification builds a JSON payload and emits through cds.queued(...).

queueOrderNotification after status CONFIRMED

Confirm updates the sales order, then queues ORDER_CONFIRMED in the same transactional story — external delivery happens after commit.

Only customer CQ-001 (CardQuest) is wired for outbound in this milestone. Other customers don’t get a channel until one is designed.

The dispatcher uses the SAP Cloud SDK HTTP client against BTP destination CW_CPI_OUTBOUND, posting to /http/creatureworks/notifications with an X-CW-Event-ID header.

CAP dispatcher calling Integration Suite via destination

Outbound call is destination-based so OAuth material stays in BTP, not in application code.

BTP destination CW_CPI_OUTBOUND

HTTP destination with OAuth2 client credentials — the CAP app looks up this name; secrets stay in the cockpit.

Representative confirmation payload (abbreviated from the implementation):

{
  "eventId": "07dee98d-434d-4eba-82ff-ee5388a90490",
  "eventType": "ORDER_CONFIRMED",
  "version": 1,
  "occurredAt": "2026-11-01T18:28:24.000Z",
  "customerCode": "CQ-001",
  "purchaseOrderNumber": "CQ-PO-0002",
  "supplierOrderId": "…",
  "orderStatus": "CONFIRMED",
  "totalAmount": "190.00",
  "currency": "CRD",
  "items": [
    { "sku": "CW-FOR-001", "quantity": 10 },
    { "sku": "CW-OCN-001", "quantity": 5 }
  ]
}

DELIVERY_SHIPPED adds delivery number, carrier, tracking, and shippedAt.

Why eventId matters: delivery is at-least-once in spirit. If a retry happens, the consumer should dedupe on event ID rather than double-apply the same confirmation. I verified happy-path delivery to the test receiver. I did not fully prove retry/dead-letter recovery under prolonged outages in this milestone — CAP’s queue is designed for that class of problem, but green webhook responses aren’t a load test.

Outbound iFlow

CreatureWorks Order Status Notifications mirrors Part 2’s direction: CAP is now the caller.

Outbound iFlow canvas

Validate the notification, set correlation headers, POST to the external receiver, log success; technical failures go through an exception subprocess.

HTTPS sender for /creatureworks/notifications

CAP reaches Integration Suite on this path, protected with the messaging send role.

Outbound header enrichment

Content-Type / Accept plus X-Event-ID from exchange properties — correlation before the retailer call.

For testing, the HTTP receiver pointed at Webhook.site. That’s a stand-in for CardQuest’s future integration endpoint — not the finished game backend.

HTTP receiver configured to webhook.site

Temporary external endpoint while the CardQuest application is still under development.

Both inbound and outbound flows deployed and started:

Both CreatureWorks iFlows Started

Purchase orders in; status events out.

Outbound OAuth is the reverse of Part 2’s CAP hop: the CAP app uses destination CW_CPI_OUTBOUND with Process Integration Runtime credentials to call the notifications endpoint.

Deployment snag worth remembering

When I first added the notification modules, a Cloud Foundry start failed with ERR_MODULE_NOT_FOUND for the new order-notifications module. Local syntax checks weren’t enough — the file hadn’t made it into the generated production package the MTA was deploying. Inspecting the built artifacts and fixing packaging resolved it. The lesson: verify what CAP’s production build actually ships, not only whether the source file exists in your workspace.

Walking CQ-PO-0002 from confirm to shipped notification

This walkthrough uses CQ-PO-0002 — another real test order with the same Forest/Ocean mix and 190.00 CRD total as the series example. (Part 1’s shipped object page showed CQ-PO-0001; Part 2’s curl used CQ-PO-0003. Same business scenario, separate test runs.)

  1. Sales order already exists as SUBMITTED from the inbound B2B path (Part 2).
  2. I confirm in Fiori. CAP reserves inventory, sets CONFIRMED, and queues ORDER_CONFIRMED.
  3. Integration Suite delivers that event; monitoring shows custom properties and receiver HTTP 200.
  4. I create the delivery (needs a maintained ship-to on CardQuest), enter carrier/tracking, and ship.
  5. CAP deducts stock, releases reservation, sets SHIPPED, and queues DELIVERY_SHIPPED.
  6. The outbound iFlow delivers again; monitoring shows the shipment event.

Delivery ready to ship with tracking

Delivery for CQ-PO-0002 after shipping details — Ship Delivery is the next supplier action.

MPL ORDER_CONFIRMED

Message Processing Log: event type ORDER_CONFIRMED, purchase order CQ-PO-0002, notification status DELIVERED, receiver HTTP 200.

Webhook.site received ORDER_CONFIRMED for CQ-PO-0002

External proof: the same event payload CardQuest will eventually consume — eventId, items, 190.00 CRD, status CONFIRMED.

MPL DELIVERY_SHIPPED

Same outbound flow for DELIVERY_SHIPPED after the warehouse ship action.

Sales orders list for CardQuest

Supplier operational view while events fan out to the external receiver — CQ-PO-0001 already shipped; later test POs still in flight.

What's next: from SAP integration to the actual game

At this point, I've built a functioning supplier application on SAP BTP — products, inventory, customers, sales orders, and deliveries — and connected it to an external system through Integration Suite and API Management.

We can submit a purchase order, process it in CreatureWorks, confirm it, create a delivery, and ship it. Order confirmations and shipment notifications flow back through Integration Suite to an external test receiver.

That’s a substantial technical foundation. It isn’t the end of the project.

This series started with a reward-based collectible-card game for my son. The SAP supplier and integration work grew out of that idea, and there’s still more to build.

Coming up: SAP Build Process Automation

One of the next areas I’ll explore is SAP Build Process Automation.

The business transactions already exist, but not every decision needs to live only as a direct application action. Approval workflows can fit into supplier operations — and potentially into some of the parent-controlled reward mechanisms planned for the game.

That keeps the pattern of this series: wire SAP BTP services into a real process, not demonstrate them in isolation.

Building CardQuest with Next.js and PostgreSQL

The other major phase is bringing the game itself to life.

CardQuest will be a Next.js and PostgreSQL application — completely separate from CreatureWorks and its HANA database.

The intended experience is straightforward: earn virtual currency through chores, school, behavior, and other accomplishments; visit the CardQuest store; spend that currency on packs; open them to discover original creatures; grow a collection.

Behind that experience sit the inventory, purchasing, and fulfillment processes documented in this series.

There’s also a practical constraint: SAP BTP is currently on a Trial account. I don’t want the game to stop when the trial expires. So I’ll also build a standalone supplier implementation on Next.js and PostgreSQL.

By default, the game should run independently of SAP. When the existing BTP supplier and integration services are configured and available, it should still be able to use them.

That dual-backend path is another interesting piece of the project: the same purchasing experience, different supplier implementations, without changing what the person playing the game sees.

More to come

I’ll keep documenting the work on HarderTech — Build Process Automation, the Next.js applications, and eventually the collectible-card gameplay itself.

For now, a simple reward-game idea became a working SAP BTP supplier with secure B2B integration and outbound business notifications. The next challenge is bringing everything together into the experience that inspired the project in the first place.


Series

  1. Building a Supplier ERP on SAP BTP
  2. Connecting Two Companies with SAP Integration Suite and API Management
  3. Closing the B2B Loop (this article)

Further reading