How to create an ID field in SAP Profitability and Performance Management
Hello everyone, I want to share how to create a simple row id number using a calculation function in SAP Profitability and Performance Management.
In order to solve this, I’ve come with a solution that creates a consecutive number (1,2,3,4…) using SAP HANA database function ROWNUMBER() that is calculated in a key figure field (List #) using a calculation function.
In the following example I will detail how to create step by step:
For the example I created two environment fields:
Owner Name: This fields stores a person name
List #: This field will store the ID
Then I created a model table (Sample Input Data), this will have both fields, then I filled manually it with the following sample data:
To calculate the ID number, I used a calculation function (List Number Calculation) where the model table (Sample Input Data) is our input function and defining the “List #” field as an action field.
Using the formula function, the field “List #” has a formula with the following code:
ROW_NUMBER() OVER (ORDER BY "Any Field" ASC)
When I run the function, the result sorts by the field “Owner Name” and calculates a consecutive for the input data.
As you can see, the “List #” has been filled with a consecutive ID number, no matter if registers are repeated
In the end, you will have your input data (model table) and your result data (calculation) as shown:
Hope it comes useful in your projects. You can also try even more complex IDs using the rest of SAP HANA functionalities through the calculation function formula.
If you want to know more about SAP Profitability and Performance Management and SAP HANA functions, you can consult the following SAP Help links:
SAP HANA SQL functions: https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.03/en-US/20a61f29751910149f99f0300dd95cd9.html
SAP Profitability and Performance Management functions: https://help.sap.com/viewer/56471df1959f4cfd9e3bf7a6d2d5be42/3.14/en-US/56a0a0a1d8b10f63e10000000a42189c.html
Let me know if there are any questions