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.
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:
Total amount of energy charged during a charging period, defined in kWh (KWH)
Type of connector
Values: AC, DC
Abstract ID of the charge point operator
Total parking time, defined in hours (H)
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
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: