Skip to content
Vladimir Chavkov
Go back

SAP Business Technology Platform (BTP): Complete Guide for Enterprise Development

Edit page

SAP Business Technology Platform (BTP): Complete Guide for Enterprise Development

SAP Business Technology Platform (BTP) is SAP’s comprehensive platform-as-a-service (PaaS) offering that enables businesses to integrate, extend, and build intelligent applications. This guide covers everything you need to understand and leverage SAP BTP for enterprise development.

What is SAP BTP?

SAP BTP is an integrated offering comprised of four technology portfolios: database and data management, analytics, application development, and intelligent technologies. It provides a unified environment for developing, deploying, and managing enterprise applications that integrate with SAP and non-SAP systems.

Core Value Propositions

  1. Unified Platform: Single platform for all SAP cloud services
  2. Multi-Cloud Support: Runs on AWS, Azure, GCP, and SAP data centers
  3. Enterprise Integration: Native connectivity to SAP S/4HANA, SuccessFactors, and other SAP solutions
  4. Innovation: AI/ML capabilities, IoT, analytics, and automation
  5. Open Standards: Cloud Foundry, Kubernetes, and open-source technologies

SAP BTP Architecture

High-Level Structure

┌─────────────────────────────────────────────────────────────┐
│ SAP BTP Global Account │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Directory 1 │ │ Directory 2 │ │
│ │ │ │ │ │
│ │ ┌──────────────┴┐ │ ┌──────────────┴┐ │
│ │ │ Subaccount 1 │ │ │ Subaccount 3 │ │
│ │ │ (Dev) │ │ │ (Prod) │ │
│ │ │ │ │ │ │ │
│ │ │ Runtime: │ │ │ Runtime: │ │
│ │ │ Cloud Foundry │ │ │ Cloud Foundry │ │
│ │ │ │ │ │ + Kyma │ │
│ │ │ Services: │ │ │ │ │
│ │ │ • HANA Cloud │ │ │ Services: │ │
│ │ │ • XSUAA │ │ │ • HANA Cloud │ │
│ │ │ • Destination │ │ │ • XSUAA │ │
│ │ └───────────────┘ │ │ • Integration │ │
│ │ │ │ Suite │ │
│ │ ┌──────────────┐ │ └───────────────┘ │
│ │ │ Subaccount 2 │ │ │
│ │ │ (Test) │ │ │
│ │ └──────────────┘ │ │
│ └─────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────┘

Key Components

1. Global Account

2. Directories (Optional)

3. Subaccounts

4. Spaces (Cloud Foundry)

Runtime Environments

SAP BTP offers multiple runtime environments for different use cases:

1. Cloud Foundry Runtime

Best for: Traditional microservices, APIs, web applications

# manifest.yml - Cloud Foundry application descriptor
---
applications:
- name: my-app
memory: 512M
instances: 2
buildpacks:
- nodejs_buildpack
path: ./
routes:
- route: my-app-prod.cfapps.eu10.hana.ondemand.com
services:
- my-hana-db
- my-xsuaa
- my-destination
env:
NODE_ENV: production
SAP_JWT_TRUST_ACL: '[{"clientid":"*","identityzone":"*"}]'

Key Features:

2. Kyma Runtime

Best for: Kubernetes-native applications, event-driven architectures

# deployment.yaml - Kyma/Kubernetes deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
namespace: production
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: app
image: your-registry/my-app:v1.0.0
ports:
- containerPort: 8080
env:
- name: HANA_HOST
valueFrom:
secretKeyRef:
name: hana-credentials
key: host
---
apiVersion: v1
kind: Service
metadata:
name: my-app
spec:
selector:
app: my-app
ports:
- port: 80
targetPort: 8080
type: LoadBalancer

Key Features:

3. ABAP Runtime

Best for: Extending SAP S/4HANA, ABAP development

Core Services

1. SAP HANA Cloud

Enterprise-grade database and data warehouse:

-- CDS (Core Data Services) View
@AbapCatalog.sqlViewName: 'ZSALESORDER'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sales Order View'
define view Z_SALES_ORDER_VIEW
as select from snwd_so
association [1..1] to snwd_bpa as _BusinessPartner
on $projection.buyer_guid = _BusinessPartner.node_key
{
key node_key as OrderId,
so_id as OrderNumber,
buyer_guid as BuyerId,
currency_code as Currency,
gross_amount as GrossAmount,
net_amount as NetAmount,
_BusinessPartner.bp_id as CustomerNumber,
_BusinessPartner.company_name as CustomerName
}

Capabilities:

2. Connectivity & Destinations

Connect to on-premise and cloud systems:

destination-service.js
const xsenv = require('@sap/xsenv');
const { retrieveJwt } = require('@sap-cloud-sdk/connectivity');
async function getDestination(destinationName) {
const { destination } = require('@sap-cloud-sdk/connectivity');
return destination.fetchDestination({
destinationName: destinationName,
jwt: retrieveJwt(req)
});
}
async function callBackendSystem(req, res) {
try {
const dest = await getDestination('MY_BACKEND_SYSTEM');
const response = await axios.get('/api/data', {
baseURL: dest.url,
headers: {
...dest.headers,
'Authorization': dest.authentication
},
httpsAgent: dest.certificates ? new https.Agent({
ca: dest.certificates
}) : undefined
});
res.json(response.data);
} catch (error) {
console.error('Error calling backend:', error);
res.status(500).json({ error: 'Backend call failed' });
}
}

3. XSUAA (Authorization and Trust Management)

OAuth 2.0-based authentication and authorization:

xs-security.json
{
"xsappname": "my-app",
"tenant-mode": "dedicated",
"scopes": [
{
"name": "$XSAPPNAME.Read",
"description": "Read access"
},
{
"name": "$XSAPPNAME.Write",
"description": "Write access"
}
],
"role-templates": [
{
"name": "Viewer",
"description": "View-only access",
"scope-references": [
"$XSAPPNAME.Read"
]
},
{
"name": "Editor",
"description": "Full access",
"scope-references": [
"$XSAPPNAME.Read",
"$XSAPPNAME.Write"
]
}
],
"role-collections": [
{
"name": "MyApp_Viewer",
"description": "MyApp Viewer Role",
"role-template-references": [
"$XSAPPNAME.Viewer"
]
}
]
}
// Middleware to check authorization
const xssec = require('@sap/xssec');
const passport = require('passport');
passport.use(new xssec.JWTStrategy(xsenv.getServices({
uaa: { tag: 'xsuaa' }
}).uaa));
app.use(passport.initialize());
app.use(passport.authenticate('JWT', { session: false }));
// Check scope in route
app.get('/api/sensitive-data',
checkScope('Write'),
(req, res) => {
// Only accessible with Write scope
res.json({ data: 'sensitive' });
}
);
function checkScope(scope) {
return (req, res, next) => {
if (req.authInfo.checkScope(`$XSAPPNAME.${scope}`)) {
next();
} else {
res.status(403).json({ error: 'Insufficient permissions' });
}
};
}

4. SAP Business Application Studio

Cloud-based IDE optimized for SAP development:

Features:

Multi-Target Applications (MTA)

MTA enables deploying complex applications with multiple modules:

mta.yaml
_schema-version: '3.3'
ID: my-business-app
version: 1.0.0
description: "Multi-target application for business processes"
modules:
# Node.js backend (CAP)
- name: my-app-srv
type: nodejs
path: gen/srv
requires:
- name: my-app-db
- name: my-app-uaa
- name: my-app-destination
provides:
- name: srv-api
properties:
srv-url: ${default-url}
# Database deployment
- name: my-app-db-deployer
type: hdb
path: gen/db
requires:
- name: my-app-db
# UI deployer
- name: my-app-ui
type: html5
path: app/webapp
build-parameters:
builder: custom
commands:
- npm run build
supported-platforms: []
requires:
- name: srv-api
group: destinations
properties:
forwardAuthToken: true
strictSSL: true
name: srv-api
url: ~{srv-url}
resources:
# HANA Cloud
- name: my-app-db
type: com.sap.xs.hdi-container
parameters:
service: hana
service-plan: hdi-shared
# XSUAA
- name: my-app-uaa
type: org.cloudfoundry.managed-service
parameters:
service: xsuaa
service-plan: application
path: ./xs-security.json
# Destination
- name: my-app-destination
type: org.cloudfoundry.managed-service
parameters:
service: destination
service-plan: lite
# HTML5 Application Repository
- name: my-app-html5-repo
type: org.cloudfoundry.managed-service
parameters:
service: html5-apps-repo
service-plan: app-host

Deploy with:

Terminal window
# Build MTA archive
mbt build
# Deploy to Cloud Foundry
cf deploy mta_archives/my-business-app_1.0.0.mtar

Integration Scenarios

1. Extending S/4HANA with Side-by-Side Extensions

// Extension application calling S/4HANA OData service
const cds = require('@sap/cds');
module.exports = async function() {
const { BusinessPartner } = this.entities;
const s4hana = await cds.connect.to('S4HANA');
// Before creating local entity, check S/4HANA
this.before('CREATE', 'Customer', async (req) => {
const bpNumber = req.data.businessPartnerNumber;
// Call S/4HANA
const bp = await s4hana.run(
SELECT.one.from('A_BusinessPartner')
.where({ BusinessPartner: bpNumber })
);
if (!bp) {
req.error(404, `Business Partner ${bpNumber} not found in S/4HANA`);
}
// Enrich with S/4HANA data
req.data.businessPartnerName = bp.BusinessPartnerName;
req.data.country = bp.Country;
});
// Expose combined data
this.on('READ', 'Customer', async (req, next) => {
const customers = await next();
// Enhance with real-time S/4HANA data
for (let customer of customers) {
const creditInfo = await s4hana.run(
SELECT.one.from('A_CustomerCreditInfo')
.where({ Customer: customer.businessPartnerNumber })
);
customer.creditLimit = creditInfo?.CreditLimit;
customer.creditExposure = creditInfo?.CreditExposure;
}
return customers;
});
};

2. Event-Driven Architecture with SAP Event Mesh

// producer.js - Publishing events
const { EventEmitter } = require('@sap/xb-msg-env');
async function publishOrderCreated(order) {
const messaging = await EventEmitter.connect();
await messaging.send('orderCreated', {
source: 'order-service',
type: 'sap.s4.beh.salesorder.v1.SalesOrder.Created.v1',
data: {
salesOrder: order.orderNumber,
customer: order.customerId,
amount: order.totalAmount,
currency: order.currency
}
});
console.log(`Published order created event: ${order.orderNumber}`);
}
// consumer.js - Consuming events
const { MessageConsumer } = require('@sap/xb-msg-env');
async function subscribeToOrderEvents() {
const messaging = await MessageConsumer.connect();
messaging.on('orderCreated', async (message) => {
console.log('Received order created event:', message.data);
// Process event
await processNewOrder(message.data);
// Acknowledge
message.ack();
});
messaging.on('error', (error) => {
console.error('Messaging error:', error);
});
}

Best Practices

1. Account Structure

Global Account (Enterprise)
├── Directory: Production
│ └── Subaccount: PROD-EU
│ ├── Space: api-services
│ ├── Space: web-apps
│ └── Space: background-jobs
├── Directory: Non-Production
│ ├── Subaccount: DEV
│ │ └── Space: development
│ ├── Subaccount: TEST
│ │ └── Space: testing
│ └── Subaccount: QA
│ └── Space: quality-assurance
└── Directory: Sandbox
└── Subaccount: SANDBOX
└── Space: experiments

2. Service Management

3. Security

// Implement proper authentication checks
app.use((req, res, next) => {
// Verify JWT token
if (!req.authInfo || !req.authInfo.checkLocalScope('Read')) {
return res.status(403).json({
error: 'Forbidden',
message: 'Insufficient permissions'
});
}
next();
});
// Implement audit logging
const auditLog = require('@sap/audit-logging');
const credentials = xsenv.getServices({ auditlog: { tag: 'audit-log' } }).auditlog;
auditLog.v2(credentials, (err, auditLogClient) => {
if (err) {
console.error('Failed to initialize audit log:', err);
return;
}
// Log data access
auditLogClient.read({
user: req.user.id,
object: { type: 'Customer', id: customerId },
data: { before: oldData }
}).log((err) => {
if (err) console.error('Audit log failed:', err);
});
});

4. Performance Optimization

5. Monitoring and Observability

// Custom metrics with Application Logging
const logging = require('@sap/logging');
const appContext = logging.createAppContext();
const logger = appContext.createLogContext().getLogger('/Application');
// Structured logging
logger.info('Order processed', {
orderId: order.id,
amount: order.amount,
processingTime: Date.now() - startTime
});
// Error tracking
logger.error('Payment failed', {
orderId: order.id,
error: error.message,
stack: error.stack
});

Development Workflow

1. Local Development

Terminal window
# Initialize CAP project
cds init my-project --add samples
# Install dependencies
npm install
# Run locally with mock data
cds watch
# Deploy to local SQLite
cds deploy --to sqlite

2. Build and Deploy

Terminal window
# Build MTA
mbt build -t gen --mtar my-app.mtar
# Login to Cloud Foundry
cf login -a https://api.cf.eu10.hana.ondemand.com
# Target org and space
cf target -o myorg -s dev
# Deploy
cf deploy gen/my-app.mtar
# Check status
cf apps
cf services

3. CI/CD Pipeline

.gitlab-ci.yml
stages:
- build
- test
- deploy
build:
stage: build
image: node:18
script:
- npm install
- npm run build
- mbt build
artifacts:
paths:
- mta_archives/
test:
stage: test
image: node:18
script:
- npm install
- npm test
- npm run test:integration
deploy-dev:
stage: deploy
image: cloudfoundry/cf-cli
script:
- cf login -a $CF_API -u $CF_USER -p $CF_PASSWORD -o $CF_ORG -s dev
- cf deploy mta_archives/*.mtar
only:
- develop
deploy-prod:
stage: deploy
image: cloudfoundry/cf-cli
script:
- cf login -a $CF_API -u $CF_USER -p $CF_PASSWORD -o $CF_ORG -s prod
- cf deploy mta_archives/*.mtar --strategy blue-green
only:
- main
when: manual

Cost Optimization

Entitlement Management

Service Plan Selection

ServiceDev/TestProduction
HANA Cloudhdi-sharedhana (dedicated)
XSUAAapplicationapplication
Destinationlitelite/standard
Connectivityliteconnectivity_proxy

Conclusion

SAP Business Technology Platform provides a comprehensive, enterprise-grade platform for building, integrating, and extending business applications. With support for multiple runtimes, deep SAP integration capabilities, and a rich service ecosystem, SAP BTP enables organizations to innovate while leveraging their existing SAP investments.

Success with SAP BTP requires understanding both the platform capabilities and SAP’s unique approach to enterprise development. Start with small extensions, master the core services, and gradually build more complex solutions.


Ready to master SAP BTP? Our SAP BTP training programs cover everything from fundamentals to advanced integration patterns with hands-on labs. Contact us for customized training tailored to your team’s needs.


Edit page
Share this post on:

Previous Post
SAP Cloud Application Programming Model (CAP): Complete Development Guide
Next Post
Azure Kubernetes Service (AKS) Production Guide: Complete Enterprise Deployment