Introduction
If you use pricing schemes in your pricing setup, you can rate usage records either aggregated or individually. With individual rating, the usage record is billed immediately, on the exact moment when the actual consumption occurs, regardless of the billing cycle. The bill can then be immediately transferred to Convergent Invoicing in SAP S/4HANA Cloud, and the customer can receive the invoice very soon.
To learn more about setting up individual rating, see our blog post
Rating Delivered Value with SAP Subscription Billing.
Users of this rating variant can also define price-relevant fields at item level on usage records. To map those fields to the invoice in Convergent Invoicing, the standard integration flow in SAP Cloud Integration must be extended. In this blog post, we’ll show you how to do it with an example use case.
Example Use Case: Charging an Electric Car
An energy provider offers subscriptions to charge electric vehicles at public charging stations. When using the charging station, customers are then immediately charged based on:
- The energy they consumed.
- The type of power connector they used.
- The time the vehicle is parked at the charging point.
For this scenario, the provider must charge usage records with two items:
- Item 1 contains the ID of the charge point operator, the energy consumed during the charging process, as well as the type of power connector used.
- Item 2 contains the time the electric vehicle is parked at the charging station.
For this use case, the provider defines these price-relevant fields:
Code |
Description |
Field Type |
EV_ChargedEnergy |
Total amount of energy charged during a charging period, defined in kWh (KWH) |
Quantity |
EV_PowerType |
Type of connector
Values: AC, DC |
String |
EV_PartyId |
Abstract ID of the charge point operator |
String |
EV_ParkingTime |
Total parking time, defined in hours (H) |
Quantity |
In the
Bills API, the usage record will show the item fields:

Usage Record - Item 1

Usage Record - Item 2
You would map those fields from the usage record items to Convergent Invoicing as follows:
- For ‘EV_PartyId’ and ‘EV_PowerType’, add two custom fields in Convergent Invoicing.
- For ‘EV_ChargedEnergy’ and ‘EV_ParkingTime’, map the ‘quantityValue’ to the standard quantity field in the billable item.For parking, we’ll use a dedicated field derivation schema.
To modify the message mapping of the standard integration flow accordingly, the following steps are required in SAP Cloud Integration:
- Download the standard message mapping.
- Check the POST-EXIT processing in the standard integration flow.
- Create a custom extension flow.
- Enable the extension in the standard integration flow.
Download the Standard Message Mapping
Start by downloading the standard message mapping from the standard integration flow. You need the message mapping to add it your custom extension flow later, where you can modify the mapping.

Check the POST-EXIT Processing in the Standard Integration Flow

POST-EXIT Processing
In the POST-EXIT Processing step, take a look at the Bundle Message step. This step creates a new payload that contains the following:
- The original bill payload
- The message mapping output
This payload will be passed from the standard integration flow to your custom extension flow.

Bundle Message Payload
The next step in the Post-Exit processing will then request the extension flow using the ProcessDirect adapter.
Create a Custom Extension Flow

Custom Extension Flow
Now we’ll customize the Post-Exit integration flow following these steps:
- Enter the following namespace mapping:xmlns:p1=http://sap.com/xi/SAPGlobal20/Global;xmlns:p2=http://sap.com/xi/XI/SplitAndMerge

- Modify the address for the sender adapter (ProcessDirect).
The address for the exit integration flow must run at the exact address expected by the standard integration flow.
- In the filter step, set the XPath Expression to /p2:Messages/p2:Bill/BillList. This filters for the original bill payload as the source message.

- In the Message Mapping step, upload the message mapping from the standard integration flow.


- Download the latest WSDL of the S/4 web service and update it in the extension flow in order to include the extended fields defined in Convergent Invoicing.

- Modify the message mapping for the extended, price-relevant fields as follows:


- Change the Quantity mapping for individual usage:

- Change the Field Derivation Schema mapping for individual usage:

- Save and deploy.
Enable the Extension in the Standard Integration Flow
To finish, in the standard integration flow you need to set the “Extension_Implemented” flag to
true. This will enable the standard integration flow to look for the customized post-exit.

Extension Implemented is True
The default value of “Extension_Implemented” is false and doesn’t call exits. The default value is used for the standard scenario without extensions.
Monitoring
In the message monitor you can now not only see the messages triggered for the standard flow, but also for the custom Post-Exit extension flow.

Billable Items in Convergent Invoicing
Lastly, the mapped price-relevant fields will appear in billable items:

More Information