Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
TharaniVinoth
Explorer
1,106

In SAP Build Apps, transformation formulas play a vital role in dynamically manipulating data within applications. Like Excel formulas, these predefined functions and expressions allow you to build logic seamlessly without the need for custom coding. By leveraging transformation formulas, you can efficiently transform data for UI bindings, API responses, and other app logic requirements.

Formulas serve as one of the primary component binding types in SAP Build Apps. This means they can be applied in almost any part of the application to bind and manipulate data dynamically. For instance, when binding a "Text" or "Dropdown" component value, you can simply select the binding icon in the Properties tab and choose "Formula" as the binding type. This flexibility extends to tasks such as validating data fetched from an API, validating the data, Changing the Formats of display data, String and Arithmetic functions, etc., Using formulas, you can access all existing variables in the application that can then be modified.

We developed a prototype for creating a Business Partner using SAP Build Apps integrated with SAP Build Process Automation. Here, SAP On-Prem systems are connected to read data from the Business Partner API and display it as Value Helps for dropdown values

TharaniVinoth_11-1734707421323.png

 

 

TharaniVinoth_19-1734707778781.png

Here’s an overview of common transformation formulas that we used in SAP Build Apps for reading the data from backend and displaying as value helps:

 

 

 

 

TharaniVinoth_18-1734707746390.png

TharaniVinoth_3-1734707317891.png

 

SAP Build Apps provides an extensive range of built-in functions to simplify transformations, covering categories like:

  • Text Operations: To Check if a value exists, Select Query , or match patterns using regex.
  • Date Functions: Manipulate and format dates dynamically to the local format.
  • Color and Object Handling: Dynamically update colors based on conditions, objects, and other data types.
  • Arithmetic Operations: Perform calculations and computations directly such as sum, absolute values, is_even, is_odd, divide, multiply etc,.

 

TharaniVinoth_4-1734707317894.png

In addition to built-in formulas, you can design custom transformation formulas to handle specific functionalities within your app. Here are a few common use cases:To map an input field of Dropdown type, we can map the data that needs to read from a datasource

  • Mapping Data to a Dropdown Input FieldTo bind a dropdown component to a field in data source as a value help,we can map the desired fields as:

MAP(data.ZCDV_BusinessPartnerRole1, {label:item.BPRoleText,value:item.BusinessPartnerRole})

 

TharaniVinoth_5-1734707317901.png

 

  • Displaying Unique Fields Without Duplicates - To ensure a dropdown contains only unique values and no duplicates with different combinations

UNIQUE_BY_KEY(MAP(data.ZCDV_BupaCountry1,{label:item.CountryText, value:item.Country}), "value")

TharaniVinoth_6-1734707317946.png

  • Fetching State/Region Data Based on Selected Country input - To dynamically filter and display regions or states in dropdown based on the selected country

 

MAP(SELECT(data.ZCDV_BupaCountry1, item.Country == pageVars.bp_inputs.country), {label: item.RegionText, value: item.RegionName})

 

TharaniVinoth_7-1734707317950.png

  • Checking if Input is Empty - To validate whether an input field is blank or contains a value for conditional processing

IS_EMPTY(pageVars.bp_inputs.country)

TharaniVinoth_8-1734707317952.png

 

  • Text transformationsConverting Variables to Uppercase/Lowercase using text transformations.Also, we can validate pattern for email using IS_EMAIL or REGEX functions.

UPPERCASE(data.A_BusinessPartner1[0].Initials)

TharaniVinoth_9-1734707317958.png

Note: In SAP Build Apps, custom logic or formulas cannot be directly written for all data sources. Only APIs that are exposed can be utilized for any kind of data transformation or manipulation.

I hope this blog post provides you with a understanding of formulas in SAP Build Apps and how they can be leveraged to enhance data manipulation within your applications.

4 Comments
hari424
Explorer
0 Kudos

@TharaniVinoth , Thanks for the blog, where can we see list of all Formulae in SAP BUILD

Yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

@TharaniVinoth @hari424 

you can find formulas with provided examples in my blog.. you can bookmark and reference to your designing your app.. Kindly share this blogs to your colleagues who are working on SAP Build Apps

https://community.sap.com/t5/technology-blogs-by-sap/sap-build-apps-functions-quot-text-quot-of-all-...

https://community.sap.com/t5/technology-blogs-by-sap/sap-build-apps-functions-quot-utility-quot-of-a...

hari424
Explorer
0 Kudos

Thanks @Yogananda , looking forward for more such insighful posts from you.
Could you please let me know where can I refer functions in any SAP site for reference?

Yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

@hari424 

you can find it here but not much detailed you will see it in SAP Help Documentation
https://help.sap.com/docs/build-apps/service-guide/formula-functions

Labels in this area