Creating Calculated Fields in a Composite Provider

Since SPS04 for BW/4HANA 2.0, it has been possible to create calculated fields directly in the composite provider and to fill them dynamically:

These fields can be created in the target section of the composite provider. The following types are available (these reflect the characteristic types of info objects):
  • Key Figures
  • Features
  • Time Characteristics
  • Units

The following scenario was chosen to illustrate the function:

In purchasing, different date values are often used to calculate a lead time. In order to calculate these dynamically at query runtime, it was often necessary to work with variables in a cumbersome way. To simplify the query and reduce development effort, such date key figures can be represented using calculated fields in the composite provider.

Three Simple Steps to Success

In the following example, we want to calculate how much time has passed from the “Requested Delivery Date” to the current calendar day. Based on this, a categorisation “Tolerance Limits” could be created in the query with further calculated key figures or work with different formatting.

1. Create a Calculated Key Figure

First, the calculated field is created in the composite provider. To do this, add it manually to the group of key figures in the target area:

Since the new calculated field is to be used for further calculations, select the type “Key Figure” and specify “Integral Number” as the key figure type:

2. Define Calculation

Now that the calculated field has been created, the next step is to define the logic. To calculate the difference between two date values, use the SQL function “days_between” and add the fields “Requested Delivery Date” and the SQL operator “current_date”:

3. Query Definition

In the query, the calculated field can now be used like a normal key figure. To check whether the calculated field really works, we added an additional calculated field in the composite provider for the current day:

All images on this page © 2021. BIG.Cube GmbH. All rights reserved.

Conclusion

In three simple steps we have described how you can create and dynamically fill calculated fields directly in the composite provider. With calculated fields and the corresponding SQL expressions, some of the functionalities of calculation views are transferred from HANA to the Business Warehouse Layer. This speeds up development and keeps the number of objects needed for modelling low.

Written by Marko Zaric

Get In Touch With Us Now

Share Post

More Exciting Topics from our Newsroom

We are one of “Germany’s best employers”

As one of Germany's top 100 employers with renewed 'Great...

Read More

Shortcuts for SAP BW in Eclipse

This blog post explains five simple shortcuts to make working...

Read More

Bavarian Curling with the BIG.Cube

BIG.Cube employees went bavarian curling together after work. Find out...

Read More