Part 1 — A practical, end-to-end build: manage vendor records in SAP BTP and securely expose a read-only directory to an external application.
I wanted to build something more useful than an isolated SAP BTP demo: a small business capability that connects the major pieces of the platform and has a clear integration boundary. The result is a vendor directory administered through SAP Fiori Elements, persisted in SAP HANA Cloud, and exposed to an external consumer through SAP Integration Suite API Management.
The exercise brought together SAP Business Application Studio, the Cloud Application Programming Model (CAP), OData V4, SAP HANA Cloud/HDI, XSUAA, SAP Build Work Zone, and Integration Suite. It also surfaced several configuration problems that are worth understanding before attempting the same architecture.
Scope note: These are vendor records owned by a custom SAP BTP application, not SAP S/4HANA Business Partner or vendor master records. The actual Dockvera Next.js integration is a next step; the secured API and external OAuth-client tests described here were completed.
Prerequisites: If you are following along and still need a trial subaccount with HANA Cloud, Work Zone, Integration Suite API Management, and Business Application Studio, start with Part 0: SAP BTP Trial Prerequisites. This Part 1 article assumes those services are already provisioned.
The business requirement: one owner, two ways to consume the data
The design started with a straightforward separation of responsibilities:
- SAP BTP owns vendor-directory records. An administrator creates, edits, activates, and deactivates vendors in a Fiori application.
- External applications consume a read-only directory. Dockvera, a separate application, will search vendors and let plant managers select the vendors associated with their plants.
- Dockvera owns plant-to-vendor relationships. Those associations belong in Dockvera's database; this scenario does not write plant assignments back to SAP BTP or modify S/4HANA vendor master data.
That separation shaped the service and authorization design from the beginning.
Architecture
There are two access paths to the same vendor data. The Fiori application uses the administration service; the external client uses a restricted directory service through API Management.
What each component contributes
| Component | Responsibility |
|---|---|
| SAP Business Application Studio | Development environment for CAP and Fiori Elements |
| CAP / Node.js | Data model, OData V4 endpoints, validation, and authorization enforcement |
| SAP HANA Cloud + HDI | Durable, application-isolated persistence |
| Fiori Elements | Generated list report and object page for vendor administration |
| SAP Build Work Zone, standard edition | Business-user launchpad and application navigation |
| SAP Authorization and Trust Management (XSUAA) | OAuth identities, application scopes, and user-role integration |
| SAP Integration Suite — API Management | External API endpoint, read-only gateway policy, throttling, and monitoring |
1. Create the CAP data model
The CAP project was created in Business Application Studio under dockvera-btp-integration. During development, it used local SQLite; the deployed runtime uses SAP HANA Cloud.

Business Application Studio dev space DockveraBTP (Full Stack Cloud Application) used for the CAP and Fiori work.
The core entity is intentionally small, but it includes the identifiers and operational fields that an external system needs:
db/schema.cds
namespace dockvera.integration;
using { cuid, managed } from '@sap/cds/common';
@assert.unique: {
vendorCode: [vendorCode]
}
entity Vendors : cuid, managed {
vendorCode : String(40) not null;
name : String(160) not null;
email : String(255);
phone : String(40);
city : String(100);
country : String(2);
isActive : Boolean default true;
}
Two CAP aspects do useful work here: cuid supplies a UUID primary key, and managed supplies created/modified audit fields. The unique vendorCode gives administrators a human-readable business identifier. External systems should retain a stable identifier and avoid depending on a vendor's mutable display name.
2. Put administration and directory access behind different services
Rather than exposing one broad API to every consumer, I created two projections over the same entity.
srv/vendor-service.cds — representative service definition
using { dockvera.integration as db } from '../db/schema';
@requires: 'VendorAdmin'
service VendorAdminService @(path: 'vendor-admin') {
@odata.draft.enabled
entity Vendors as projection on db.Vendors;
}
@requires: 'VendorDirectoryReader'
service VendorDirectoryService @(path: 'vendor-directory') {
@readonly
@cds.search: { vendorCode, name, city }
entity Vendors as projection on db.Vendors {
ID, vendorCode, name, city, country, isActive
};
}
This gives the two audiences clearly different contracts:
| Service | Endpoint | Intended caller | Behavior |
|---|---|---|---|
VendorAdminService | /odata/v4/vendor-admin/ | Authorized vendor administrators | Create, edit, activate, and manage vendors, with Fiori draft behavior |
VendorDirectoryService | /odata/v4/vendor-directory/ | Authorized external consumers | Read/search/filter a limited set of fields |
The read-only service is protected twice: CAP's @readonly constrains its operations, while @requires checks that the caller has VendorDirectoryReader. The directory projection also avoids returning email and phone fields that the initial external use case does not need.
Local testing covered create/read behavior, filtering and search, and rejection of write requests to the directory. Draft handling was tested by editing a vendor without saving: the directory kept returning the active saved value until the Fiori draft was activated. That is a valuable property when external systems should not consume unapproved edits.
3. Build the Fiori administration experience
Using the Fiori Application Generator in Business Application Studio, I created a Fiori Elements List Report / Object Page application against the CAP VendorAdminService.

Fiori Application Generator — Template Selection. The List Report Page template is the one used for vendor administration.

Data Source and Service Selection against the local CAP project dockvera-btp-integration and VendorAdminService.
The generated application was customized through CDS UI annotations for useful table columns, selection fields, object-page sections, and contact details. Draft support provides the expected Create / Edit / Save workflow without hand-coding a custom React interface.
The application identity and navigation were configured for launchpad integration:
- App: Dockvera Vendor Management
- Semantic object:
DockveraVendor - Action:
manage - OData backend: CAP
VendorAdminService(V4)
The local preview worked first, including creation and activation of vendor records. Only then did I move to production deployment.
4. Deploy CAP and the database to Cloud Foundry
For production, CAP was configured to use SAP HANA Cloud rather than development SQLite. The project used an HDI container so database artifacts could be generated and managed from the CDS model instead of changing tables by hand.
Representative preparation and deployment commands:
cds add hana
cds add mta
cds build --production
# Verify the intended Cloud Foundry organization and space.
cf target
# Build an MTA archive, then deploy it.
mbt build -t gen --mtar dockvera-btp-integration.mtar
cf deploy gen/dockvera-btp-integration.mtar
# Check runtime applications and service instances.
cf apps
cf services
The MTA packaged the CAP Node.js service and HDI database deployer and bound the backend to its database and security services. This did not create a separate HANA database server; it provisioned an application HDI container inside the existing HANA Cloud instance.
After deployment, the CAP backend was running in Cloud Foundry and the vendor tables were visible through the HDI container in SAP HANA Database Explorer.
A practical SQL lesson: A query run as DBADMIN without an explicit schema initially failed with invalid table name because the table lived in the application's HDI-managed schema. The physical table name also needed to be read from the catalog rather than assumed from CDS.
-- Discover the actual schema and physical table name.
SELECT SCHEMA_NAME, TABLE_NAME
FROM SYS.TABLES
WHERE UPPER(TABLE_NAME) LIKE '%VENDOR%'
ORDER BY SCHEMA_NAME, TABLE_NAME;
-- Then use the exact names returned by the query above.
SELECT COUNT(*) AS "VendorCount"
FROM "<HDI_SCHEMA>"."<ACTUAL_VENDOR_TABLE>";
The better day-to-day approach is to open a SQL console connected to the HDI container and inspect its actual tables and permissions.
5. Set up user and machine-to-machine authorization
Security was intentionally split by caller type:
| Caller | Required application scope | Access |
|---|---|---|
| Vendor administrator in Work Zone | VendorAdmin | Vendor administration service |
| External Dockvera-oriented OAuth client | VendorDirectoryReader | Read-only directory service |
| Anonymous request | None | Rejected |
The CAP services use @requires, backed by the XSUAA authorization configuration. The implementation used an existing XSUAA broker-plan instance named hardertech_broker for the API-providing CAP application. The VendorAdmin role was made available through a BTP role collection assigned to the administrator.
For the external integration, I created a separate XSUAA application-plan client named dockvera-directory-auth. The provider allowed the VendorDirectoryReader scope to be granted to that named client using grant-as-authority-to-apps, and the consumer explicitly requested the corresponding authority. VendorAdmin was not granted to the consuming client.
A simplified security-descriptor excerpt illustrates the intent:
{
"scopes": [
{
"name": "$XSAPPNAME.VendorAdmin",
"description": "Maintain vendor directory"
},
{
"name": "$XSAPPNAME.VendorDirectoryReader",
"description": "Read vendor directory",
"grant-as-authority-to-apps": [
"$XSAPPNAME(application,dockvera-directory-client)"
]
}
]
}
The consuming client used its own security descriptor with a directory-only authorities request. This is not the same as assigning a BTP role collection to a human user: the OAuth client_credentials grant represents a technical client, not an interactive user.
A security test worth keeping
Before granting the directory authority, the technical token reached CAP but received HTTP 403. After configuring the explicit cross-application permission, that client's token could retrieve the directory but could not access the admin endpoint.
| Request | Observed status | What it demonstrated |
|---|---|---|
| Anonymous GET — directory | 401 | Authentication required |
| Anonymous GET — administration | 401 | Administration not public |
| Valid technical token without directory scope | 403 | Authentication is not authorization |
| Authorized technical GET — directory | 200 | Scope and API access working |
| Same technical token GET — administration | 403 | No accidental administrator access |
Service keys used during terminal testing were temporary and deleted afterward. The actual Dockvera application should later keep its production credentials exclusively on the server side, using an appropriate secrets-management mechanism.
6. Deploy Fiori to SAP Build Work Zone
The backend and Fiori UI have separate deployment concerns. I added Work Zone support to the CAP project, built the HTML5 application into the MTAR, and deployed it to the SAP HTML5 Application Repository.
The production application appeared in BTP Cockpit → HTML5 Applications as comhardertechdockveravendoradmin, with business solution identifier dockverabtpintegration.service. That confirmed the UI artifacts had deployed successfully—but they initially did not appear in Work Zone's Content Explorer.
The discovery issue that mattered
In the original MTA, the HTML5 repository destination was defined only under instance-level destination content. The relevant destination was not present under BTP subaccount destinations, so Work Zone could not discover the HTML5 application.
The working approach made the HTML5 repository destination available at subaccount level, kept the XSUAA destination appropriately configured, rebuilt/redeployed the MTAR, and refreshed the HTML5 Apps provider in Work Zone's Channel Manager.
A shortened illustration of the important distinction:
# Illustrative excerpt only; not a complete MTA module.
parameters:
content:
subaccount:
existing_destinations_policy: update
destinations:
- Name: dockvera-btp-integration-html5-repository
ServiceInstanceName: dockvera-btp-integration-html5-repo-host
ServiceKeyName: dockvera-btp-integration-html5-repo-host-key
sap.cloud.service: dockverabtpintegration.service
Once the destination scope was corrected, Dockvera Vendor Management appeared in Content Explorer, was added to the site's content, launched successfully, and created a vendor record that persisted to HANA Cloud.

Dockvera Operations site settings — Display configured for Spaces and Pages - New Experience.

Content Explorer after the HTML5 Apps provider discovered Dockvera Vendor Management (com.hardertech.dockvera.vendoradmin).

Content Manager with the app, page, catalog/space content, and Dockvera Vendor Managers role.

Site Role Assignments including Dockvera Vendor Managers and Everyone.

Runtime site: Operations → Vendor Management tile launching the admin app.

Dockvera Vendor Management list report launched from Work Zone, populated with fictional vendor test data.
A separate provisioning detour occurred earlier: the Work Zone subscription initially reported failure without a useful error. After the Identity Authentication business application registration became visible, Work Zone eventually became operational. The underlying provisioning failure was not conclusively diagnosed, so I would not present that episode as a proven IAS defect.
7. Expose only the directory through Integration Suite API Management
Once administration and persistence were working, I introduced SAP Integration Suite — API Management as the external entry point. The API proxy points to the CAP directory service only:
External API base path: /dockvera/vendors
CAP target path: /odata/v4/vendor-directory
Example external GET: /dockvera/vendors/Vendors

Create API for DockveraVendorDirectory — REST proxy with base path /dockvera/vendors pointing at the CAP directory service URL.
The gateway adds two useful protections:
- A conditional Raise Fault policy returns HTTP 405 for methods other than GET, enforcing a read-only gateway contract.
- A Spike Arrest policy limits request bursts. The development configuration used a rate of
30ps; this was a lab setting, not a production capacity recommendation or a per-client quota.
The essential policy condition was:
request.verb != "GET"

IncomingRequest RaiseFault policy: non-GET methods return HTTP 405 with a read-only error payload.

Spike Arrest policy SA-VendorDirectory at the lab rate of 30ps.
The gateway forwards the caller's Authorization: Bearer header to CAP. CAP remains the component validating XSUAA tokens and checking VendorDirectoryReader. No independent XSUAA JWT-verification policy was implemented at API Management in this phase; deploying a proxy alone does not automatically add that verification.
This is an important distinction: API Management provides an additional managed route, but the original Cloud Foundry CAP route may still be reachable by callers with valid authorization. Making the gateway the only ingress path would require a separate network/exposure decision.
8. Verify the full read path
I populated the production application through Fiori with fictional vendors for repeatable tests:
| Code | Vendor | City | Active |
|---|---|---|---|
| V10006 | Gulf Coast Industrial Services | Houston | Yes |
| V10007 | Lone Star Valve & Controls | Houston | Yes |
| V10008 | Bayou Pipeline Supply | Lafayette | Yes |
| V10009 | Red River Pump Systems | Tulsa | Yes |
| V10010 | Coastal Safety Equipment | Corpus Christi | Yes |
| V10011 | Prairie Instrumentation Services | Oklahoma City | No |
With a valid technical OAuth token, the external proxy returned HTTP 200 and the vendor data. OData filtering also passed through the proxy correctly; V10011 was excluded when requesting active vendors only.
Representative requests (the token is deliberately not shown):
# Use the actual API Management proxy URL in a local environment variable.
API_URL="https://<api-management-host>/dockvera/vendors"
# Retrieve the directory.
curl -fsS \
-H "Accept: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
"${API_URL%/}/Vendors"
# Retrieve only active vendors; URL encoding avoids shell quoting mistakes.
curl -fsS -G \
-H "Accept: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data-urlencode '$filter=isActive eq true' \
"${API_URL%/}/Vendors"
The proxy's monitoring view also showed the test requests. The complete verified read path was:
External OAuth test client → Integration Suite API Management → CAP VendorDirectoryService → HANA Cloud → JSON response.

Negative-path checks through the managed proxy: anonymous GET returns 401; POST hits the RaiseFault read-only policy and returns 405.
That is the part now ready for integration into Dockvera's server-side Next.js code. The browser should never receive the OAuth client secret.
Troubleshooting: the lessons that mattered most
The most useful lessons in this exercise came from deployment and integration issues, not the initial scaffolding.
| Symptom | Diagnosis or finding | Resolution / takeaway |
|---|---|---|
cf update-service rejected xs-security.json with Invalid xsappname: Must not be <null> | Direct service updates did not receive the xsappname originally supplied through MTA-managed configuration. | Include the existing application's correct base xsappname in the descriptor used for the update; do not invent a new identity. |
| Cloud Foundry command reported expired/revoked token | The administrative CF CLI session expired. | Reauthenticate with cf login --sso; this is distinct from the external client's OAuth credentials. |
API test returned 301 Moved Permanently | The test URL omitted https://. | Use the full HTTPS Cloud Foundry route; confirm whether redirects come from routing or application authentication before changing scopes. |
Destination content deployment reported Missing mandatory service instance [...] | The deployment couldn't resolve a referenced XSUAA service/key configuration. The exact original sub-cause was not conclusively isolated. | Review actual service-instance versus service-key names, use the existing hardertech_broker mapping, remove inapplicable existing-service config, inspect packaged MTAR, and redeploy. |
| Fiori app present in HTML5 Applications but absent from Work Zone Content Explorer | Required HTML5 repository destination was missing at the subaccount scope. | Move the repository destination to subaccount destination content, redeploy, and refresh the HTML5 Apps content provider. |
SQL query failed: table not found in DBADMIN schema | HDI creates application-managed schemas; guessed table names and implicit schemas were wrong. | Query SYS.TABLES for the physical table/schema, or open SQL from the HDI container connection. |
| Work Zone subscription initially failed without useful diagnostic | Subscription provisioning was blocked; IAS registration subsequently became available and the subscription worked. | Verify CIS/IAS OIDC trust and subscription status; use browser/network diagnostics when necessary, but do not assume a root cause without a concrete error. |
The recurring theme: separate the layer where the request fails from the layer you're trying to fix. A 301 redirect is not an XSUAA scope problem. A Fiori application already present in the HTML5 repository does not need to be regenerated because Work Zone cannot discover it.
What this implementation demonstrates
The completed work proved five things:
- One CAP entity can support different business contracts. Administration and consumption do not have to share the same data surface or permissions.
- Fiori Elements can provide a productive admin interface quickly. Draft handling and CDS UI annotations cover much of the routine interface work.
- HANA HDI makes persistence an application deployment concern. Tables and supporting artifacts come from the CDS model and follow the MTA lifecycle.
- XSUAA can separate human administrators from technical clients. A client-credentials token with directory permission does not need, and must not receive, administration permission.
- API Management adds governance without changing the CAP data model. The gateway provides a stable integration endpoint, request-policy enforcement, traffic controls, and monitoring, while CAP remains authoritative for data and business permissions.
The build is a working lab implementation, not a declaration that every production concern has been addressed. Before using the same design for real vendor data, I would review gateway-level JWT verification, direct CAP-route exposure, tenant and data-isolation controls, credential rotation/storage, API versioning, consumer quotas, logging/alerting, and nonproduction/production environment separation.
Next: connect the Dockvera backend
That next step is now written up in Part 2: Bringing SAP BTP Vendor Data into Dockvera: Dockvera's Next.js server requests an XSUAA token, calls the managed Vendor Directory API, and lets plant managers search and enroll active vendors. Dockvera saves its own plant-to-vendor associations and does not create or modify vendors in this SAP BTP service.
A separate article will cover the opposite, transaction-oriented direction: Dockvera outbound events for truck/material receipts, SAP purchase-order line context, Integration Suite orchestration, approvals through SAP Build Process Automation, and eventual SAP S/4HANA updates. That workflow is not part of this vendor-directory build and has not been represented here as complete.
SAP documentation and further reading
These are supporting documentation links, not claims that all versions and account plans behave identically:
- SAP CAP: Deploy to Cloud Foundry
- SAP CAP: Authentication
- SAP CAP: Using SAP HANA Cloud
- SAP BTP Developer's Guide — Integrate with SAP Build Work Zone
- SAP Help: Update an XSUAA Service Instance
- SAP Help: Authorization Scopes and Authorities
- SAP Help: Integration Suite API Management Policy Types
- SAP Help: Spike Arrest Policy
