Cross Charging your SAP BTP Charges: Gain Transparency and Simplify Cross Alloca...
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.
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:
- Configure labels in the BTP Cockpit for each sub-account – to mark sub-accounts to exclude in subscription data.
- Create entitlements for “Cloud Management Service” and “Usage Data Management.”
- Create instances of “Cloud Management Service” and “Usage Data Management” services.
- 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.
EXCLUDE Label
-
After creating the label, you can view it in your Global Account – Account Explorer.
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.
- In BTP Cockpit, go to “Service Assignments“ to check the Quota Assignments of the two service
- Go to Entity Assignments, select your subaccount in “Select Entities”
Entity Assignments
- 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 CMS Entitlement
Cloud Management Service
- 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
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 Service instances
- Enter an Instance Name – ex “TEST_CMS” and make sure you select “Other” in the runtime environment
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 UDM Instance
- Check and make sure instances are created under “instances and subscriptions”
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 UDM Key
- Create Service Binding for “Cloud Management Service” Service
CMS Binding
- Enter the Binding Name – Ex CMS-Key. Click “Create”
CMS Key
- Once the binding is created, you can view the same
- Download it or copy JSON and keep it
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK