brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
sap-btp-feature-flagsSAP BTP Feature Flags Service — feature toggles for BTP applications, gradual rollouts, A/B testing, feature lifecycle management. Use when implementing feature flags on BTP, managing gradual rollouts, toggling features per tenant/user, or integrating feature flags with CAP and ABAP Cloud.
Independent GitHub snapshot · Automated classification · Original documentation governs
name: sap-btp-feature-flags description: SAP BTP Feature Flags Service — feature toggles for BTP applications, gradual rollouts, A/B testing, feature lifecycle management. Use when implementing feature flags on BTP, managing gradual rollouts, toggling features per tenant/user, or integrating feature flags with CAP and ABAP Cloud. trigger:
Feature toggle management for SAP BTP — controlled rollouts, tenant-specific features, A/B testing, runtime evaluation.
cf login)@sap/feature-flags package (for CAP integration)cf create-service feature-flags standard my-feature-flags
cf bind-service my-app my-feature-flags
cf restage my-app
# Create a flag via REST API
curl -X POST "https://feature-flags.cfapps.<region>.hana.ondemand.com/api/v1/flags" \
-H "Authorization: Bearer $(cf oauth-token)" \
-H "Content-Type: application/json" \
-d '{
"name": "new-product-search",
"description": "Enhanced product search with fuzzy matching",
"lifecycle": "beta",
"defaultValue": false,
"rolloutPercentage": 10,
"rules": {
"userGroups": ["beta-testers"],
"timeRange": { "from": "2026-07-01", "to": "2026-08-01" }
}
}'
# List all flags
curl "https://feature-flags.cfapps.<region>.hana.ondemand.com/api/v1/flags" \
-H "Authorization: Bearer $(cf oauth-token)"
npm install @sap/feature-flags
const { FeatureFlags } = require('@sap/feature-flags')
module.exports = class ProductService extends cds.ApplicationService {
async init() {
this.on('searchProducts', async (req) => {
const ff = new FeatureFlags()
const enabled = await ff.isEnabled('new-product-search', {
tenant: req.tenant,
user: req.user.id,
attributes: { group: req.user.groups }
})
if (enabled) {
return this.fuzzySearch(req.data.query)
} else {
return this.exactSearch(req.data.query)
}
})
await super.init()
}
}
DATA(lo_ff) = cl_feature_flags_client=>create_for_cloud( ).
DATA(lv_enabled) = lo_ff->is_enabled(
iv_feature_name = 'Z_NEW_PRODUCT_SEARCH'
iv_user_id = sy-uname
iv_tenant_id = cl_abap_context_info=>get_tenant_id( )
).
IF lv_enabled = abap_true.
" New implementation
ELSE.
" Old implementation
ENDIF.
// Get variant for A/B testing (sticky: same user always gets same variant)
const variant = await ff.getVariant('new-checkout-flow', { user: req.user.id })
if (variant === 'B') {
req.audit({
category: 'ab-test',
object: { type: 'Feature', id: 'new-checkout-flow' },
attributes: [{ name: 'variant', value: 'B' }]
})
return this.newCheckoutFlow(req)
}
Rollout config fields: rolloutPercentage (0–100), targetTenants (allowlist), excludeTenants, userGroups, timeRange.
Development → Beta → GA → Deprecated → Removed
(internal) (10%) (100%) (read-only) (deleted)
Pitfall: Flag evaluated per user instead of per request
ff.isEnabled() for every user in a loop causes N network calls.Pitfall: Sticky rollout not working
Pitfall: Deprecated flag crashes production
grep -r "flag-name" src/ to find all call sites.Pitfall: Tenant-specific flags ignored
Pitfall: Exceeded flag limit
# 1. Verify service instance exists and is bound
cf services | grep my-feature-flags
cf env my-app | grep -A5 feature-flags
# 2. Verify flag exists via API
curl "https://feature-flags.cfapps.<region>.hana.ondemand.com/api/v1/flags/new-product-search" \
-H "Authorization: Bearer $(cf oauth-token)"
# → Should return JSON with flag definition
# 3. Test flag evaluation from app
curl "https://my-app.cfapps.<region>.hana.ondemand.com/odata/v4/Products/searchProducts?query=test" \
-H "Authorization: Bearer <jwt>"
# → Should return search results (new or old path depending on flag state)
# 4. Verify audit log in BTP Cockpit
# Navigate: BTP Cockpit -> Subaccount -> Feature Flags -> Dashboard
# Note: Audit Log tab availability depends on your Feature Flags service plan