Extension Fields – Enabling Calculations on the fly – SAP C4C
Whenever we design a solution, we lookout for either a standard or custom procedure. We try to be innovative and explore all available options possible for the solution to be accurate. In my experience with SAP Sales Cloud, there were such situations where the requirement was not straight forward, and the solution required some alteration in the standard (Out of the box) functionality.
To my experience with Cloud application from SAP, a special feature that has made life easier for Consultants like me is the Adaptation Mode feature. This is such a space where any kind of screen tweaking is possible in the easiest manner by adapting to business needs. Among those, one such feature it provides is the creation of Extension fields. These are fields which complement the existing standard fields and the main differentiation factor is the Data type.
If creation of these Extension fields with required data type was considered as a special feature, SAP added another feather to its cap by introducing the calculation functionality to the field. Which mean, one can not only create a field, but it can also calculate a specific value on the fly. Sounds amazing! Lets then not wait any further and get into the details. 😊
For this blog post we will consider an example for Quotes, where I will create an Extension field which will calculate an amount value on the fly.
Scenario: As part of requirement, the standard external Price field will be used as Item price. Another price field should be available which will be manually entered by the user creating the object. This New amount field will capture the selling price of the Item, and another amount field should capture the total selling price.
The new field will be a standard extension field with no calculation involved. But, to capture the total selling price, an extended field will be created which will calculate the total selling price value on the fly when the user enters the Selling price of the item.
Step 1: Once on the Sales Quote overview screen, click on the option Start Adaptation from the User icon.
Step 2: Click on the Tab Products and click on the blue pencil icon to create an extension field at item level.
Step 3: click on the option Add -> Field to create an extension field.
Step 4: Click on Create Fields option in the pop-up and create a calculated field by selecting the tag option.
Step 5: A calculated Field can be of the following Data types:
Out of these Data types, we will now observe the creation of Amount Data type field.
All the mandatory fields are populated as shown below:
Note: Under Calculation Rule, we should make sure that we select the correct operator.
The available operators are:
In our scenario, we will take Multiply as the operator, as we must calculate the total selling price of the item. We achieve this by the calculation:
Request price Sales = Request Price * Request Quantity
Step 6: Once we click on Save and Close, the field will be created and will be displayed in the list of fields.
Select the Check box and Click on Apply on the same screen. This will enable the field to be displayed on the Item. Now for every value entered for the field Requested price, the field Requested Price Sales will calculate the total value on the fly and no manual effort is required.
Let us also understand other scenarios in which this functionality can be beneficial:
Scenario 1: In continuation with the above scenario, if business would like to compare the Target Price Sales to that of the Requested Price Sales, i.e. total Cost price to total selling price of product, in this scenario, the current functionality will be beneficial. Where we can create an Extension field which will save the value of Total selling Price/Total Cost price, and one calculation field which will save the percentage value of the same. We will use workflow to populate the value of the 1st Extension field. Once the 1st field is populated with the value, the calculated extension field will calculate the %value on the fly. the configuration for the Calculated extension field would be as below:
As you observe we have considered Data type as Decimal number and under the calculation Rule, one is a field value, which will determine the numeric value of Total Selling price/total cost price, and the other field is a Constant which will help in calculating the % value. When we Select Constant, we can provide a specific numeric value which will be used as part of the calculation to determine the value of the field.
Note: Though the value calculated is a % value, but it will not be denoted in the value field. The field name should represent the % symbol, to determined that, the value is a percentage value and not numeric.
Scenario 2: If business wants to have a text field which is auto populated to determine Product Category description and Selling company on each item of the Quote, this scenario can be accomplished with the calculated extension field.
In this scenario, a calculated Text (data type) field will be created, which will capture the Product Category Description field text followed by the selling company of the item. This field will auto-populate the text value of the field when the Product category description (auto determined by standard for each item when product is selected) and selling company fields is filled manually. The extension field creation screen would be as below:
Select the field created and click on Apply to populate the field on the quote.
Once it is selected, the field will be displayed in the item level of the quote. And once the item is added and the selling company is maintained, the extension calculated text field will auto determine the text value even before Save.
Note: For any scenario, the changes will take effect, only when the user exits the adaptation mode.
Few instructions to consider while creating a calculated field:
- A Text field can either be of 40, 80, 120 characters or an extended text.
- For any Data type of calculated extension field, only two fields can be used as part of calculation.
- The calculation can be done between two field values or one field and one constant value.
- If a calculation must be performed for more than two field a workflow can be used to display the final value in a general KUT extension field.
- Best practice is to add a prefix ‘Z’ to the Technical field during extension field creation, which will help in clear differentiation between an extension field and a standard field.
- Calculated extension field cannot have default values, as they will represent the value determined by calculation.
These were few scenarios I wanted to share as part of my experience with business users. There still can be many more scenarios where this functionality can be implemented, and with new quarterly enhancements from SAP, sky is the limit.
We have observed that this functionality can be utilized in achieving multiple business needs in different ways, let us also understand what benefits this functionality can bring:
- No SDK (custom development) required to create such calculated extension fields.
- These field calculate the required value on the fly and does not require any manual intervention.
- Flexibility in choosing the exact data type, and selection of fields or Constants with the correct operators to achieve the accurate value on the fly
- Extending the extension fields to respective Data source which will help in building Reports around the objects.
- Options to either make the field visible/hidden/mandatory or Read only.
- These fields can also be sent to external systems by selecting the settings for services and OData.
For any further understanding on the steps of creating an extension field please refer to the link: SAP reference link
As a summary to my blog post, let me highlight the points covered in brief:
- We understood what a calculated extension field is and where can these be used.
- Business Scenario wise creation of extension fields which will help business users view field value being populated on the fly.
- We also understood what all data types the calculated extension fields support and how are they useful to business.
- Knowledge on Operators that would help in performing the calculations accurately.
- Creation of calculated extension fields and applying them to the exact location in a layout.
- Understood the benefits of the field.
Hope the blog post was useful in one way or another and you could gather some knowledge from this. Till my next blog post reaches you, all the best and keep learning. Kindly leave a feedback comment which will help me learn and improve further. Thank you.. 😊
Hi Sravant Bitra,
Thank you for the interesting blog.
We have a extension field that has been set up with a calculation.
Now we do not want to use it anymore and we have hidden it.
Nevertheless, even if it is hidden it is still doing its calculations, which leads in our case to error messages.
How can we change the extention field e.g. that it is no longer calulating? Can we stop the calculation? As the calculation indicator is no longer visible after the extension field is created, we can not do this, but maybe you have a solution.
How can we deactivate the extension field without having the error messages? Can we delete it without any problems.
Hi Marie Jose,
Thank you for the comment. 🙂
Yes, the field can be removed form the object from adaptation, instead of deleting it.
It will not cause any harm to the current scenario as you would not want it.
Hope this helps,
kindly let me know if the issue still persists with details, so that i can try to check from my end.
Thanks and Regards,
Very nice blog! To my understanding the 'dynamic' calculation only calculates upon creation of the object, correct? So if you would change (in your first example) the quantity or price there would not be any recalculation. Is there any easy way to accomplish that, or would you need a workflow that triggers on every change?
Hello Sravant Bitra,
Thank you for the detailed post!
I am trying to create a calculated KUT field to calculate the price/gallon.
So wanted to check if there is a restriction of any sort?