13

Cross Charging your SAP BTP Charges: Gain Transparency and Simplify Cross Alloca...

 1 year ago
source link: https://blogs.sap.com/2023/04/19/cross-charging-your-sap-btp-charges-gain-transparency-and-simplify-cross-allocation/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

A step-by-step guide to understanding your SAP BTP sub-account costs and facilitating cross-allocation across your business units.

Introduction

Many customers take advantage of the consumption-based pricing model of SAP BTP. In doing so, customer teams need to organize their account structure to distribute consumption across different units, departments, and regions within their organization. While SAP bills customers for each Global Account, customers often want to cross-charge these units according to their usage. To achieve this, customer account teams require transparency of usage patterns per sub-account and an easy way to cross-charge their internal units accordingly. This article outlines a solution to this problem.

Solution Approach

The solution is broken down into four steps:

  1. Configure labels in the BTP Cockpit for each sub-account – to mark sub-accounts to exclude in subscription data.
  2. Create entitlements for “Cloud Management Service” and “Usage Data Management.”
  3. Create instances of “Cloud Management Service” and “Usage Data Management” services.
  4. Use simple code to extract the metering data using a Resource Consumption API.

Step 1 – Configure Labels in the BTP Cockpit for Each Sub Account

First, define labels for your sub-account using a specific label name called “EXCLUDE.” This is crucial since the code in later steps uses the hardcoded label called “EXCLUDE” to identify all sub-accounts to be excluded from metering calculations. To add a new label, go to your sub-account edit page. There’s no need to add any values for this label.

  • Go to your subaccount edit page and add a new label. No need to add any values for this label.
Add%20New%20Label

EXCLUDE Label

  • After creating the label, you can view it in your Global Account – Account Explorer.

Account%20Explorer

Step 2 – Create entitlements for “Cloud Management Service” and “Usage Data Management

Next, create entitlements for the two services used in extracting usage data for all your sub-accounts in your global account. In the BTP Cockpit, go to “Service Assignments” to check the Quota Assignments of the two services. Then, go to Entity Assignments, select your sub-account in “Select Entities,” and provide an entitlement for the Cloud Management Service and Usage Data Management service.

  1. In BTP Cockpit, go to “Service Assignments“ to check the Quota Assignments of the two service
Service%20Assignments
  1. Go to Entity Assignments, select your subaccount in “Select Entities”
Entity%20Assignments

Entity Assignments

  1. Give entitlement to the Cloud Management Service
    • Click Add Service Plan
    • Click Configure Entitlements
    • Search for “Cloud Management Service”
    • Select the “central” option
    • “Add 1 Service Plan”
    • Click Save
Add%20CMS%20Entitlement

Add CMS Entitlement

Cloud%20Management%20Service

Cloud Management Service

  1. Repeat the same for the “Usage Data Management” service
    • Click Configure Entitlements
    • Click Add Service Plan
    • Search for “Usage Data Management”
    • Select the “reporting-ga-admin” option
    • “Add 1 Service Plan”
    • Click Save
07-Add-UDM.png

Step 3 – Create an instance of “Cloud Management Service” and “Usage Data Management” services

Create instances of the two services, and then create service keys and bindings for each service. Remember to save the JSON data for each service key and binding as this will be used in the next step.

  • Go to Service Market Place, Select Cloud Management Service, and click “Create”
Create%20Service%20instances

Create Service instances

  • Enter an Instance Name – ex “TEST_CMS” and make sure you select “Other” in the runtime environment
Create%20CMS%20Instance

Create CMS Instance

  • Instantiate the Usage Data Management service in any subaccount as this service reports usage data for the whole of the Global Account
  • Go to Service Market Place, Select Usage Data Management, and click “Create
  • Enter an Instance Name – ex “TEST_UDM” and make sure you select “Cloud Foundry” in the runtime environment
Create%20UDM%20Instance

Create UDM Instance

  • Check and make sure instances are created under “instances and subscriptions”
Check%20Instances

Check Instances

  • Select the Usage Data Management service and click on Create Service Key
  • Enter the Service Key name – ex “Test_UDM”
  • Once the key is created, Keep a copy of the service key – just the “verificationKey” section as shown below. This will help bind the application in GitHub to the User Data Management service.
Create%20UDM%20Key

Create UDM Key

  • Create Service Binding for “Cloud Management Service” Service
CMS%20Binding

CMS Binding

  • Enter the Binding Name – Ex CMS-Key. Click “Create”
CMS%20Key

CMS Key

  • Once the binding is created, you can view the same
  • Download it or copy JSON and keep it
View%20CMS%20Key

View CMS Key

Step 4 -Sample application to extract the Metering Data

Create a simple application to extract the metering data. A sample application has been provided for your reference: Link

Clone the GIT project and make necessary changes to the demo.js file, replacing the asterisks with your own JSON for Usage Data Management – Service Key and Cloud Management Service – Service Key. After making the changes, run the sample application using “node demo.js” in your Command Line Interface (CLI).

To retrieve calculated subaccount data, use the following URL structure:

http://localhost:3000/getCalculatedConsumption?startDate={startDate}&toDate={toDate}

Replace {startDate} and {toDate} with the start and end dates of the billing in Year-Month format (YYYYMM). You can use Postman or Curl to execute the request and retrieve the calculated subaccount data.

Conclusion

By following these four steps, you can gain transparency into your SAP BTP sub-account costs and simplify cross-allocation across your business units. This solution will enable your customer account teams to efficiently manage their internal units and provide accurate billing information for each department or region.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK