Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
chirag_gupta
Associate
Associate

Motivation:

This blog focuses on the concept and usability of flattening object feature within an Action of the Action Project.

Parent Blog:

Actions Editor – Feature List, Usage and Maintenance of Actions Project | SAP Blogs

Concept & Need:

Flattening objects refers to the process of transforming nested or hierarchical data structures into a flat structure. This can be helpful if you need to simplify data for easier processing in your business process. As a result of flattening, citizen developers are able to take advantage of the nested input and output body parameters of the action by moving up the flattened fields one level in the object hierarchy.

Flattening an object:

Use Case:

An Action Designer can use the flattening icon present with the key name for each parameter of type object with some properties to flatten that parameter. Let us try to understand this with an example.

Example:

Flattening an input parameter object.

An object can be flattened by using the flattening icon present with the key name as shown in figure 1.

Figure 1: Flattening an object.Figure 1: Flattening an object.

When flattening icon is clicked, keyword flattened is shown along with the key name as shown in figure 2.

Figure 2: An object is flattened.Figure 2: An object is flattened.

When an object is flattened, the properties present inside the object can be accessed one level up in the object hierarchy. The same can be seen in the test table as shown in figure 3.

Figure 3: Test table after flattening.Figure 3: Test table after flattening.

Flattening is also possible for objects present in output body as shown in figure 4.

Figure 4: Flattening available in output bodyFigure 4: Flattening available in output body

Flattening of objects present in output body helps get output parameters one level up in object hierarchy.

Note: Flattening is possible at multiple level of hierarchy as shown in figure 5.

Figure 5: Flattened object present inside a flattened object.Figure 5: Flattened object present inside a flattened object.

When test is performed after flattening parameters present in output body, the response is generated according to the new object structure as shown in figure 6.

Figure 6: Response after flattening.Figure 6: Response after flattening.

 

Blog Reference:



 



Thanks for reading and I hope it helped to understand the concept of object flattening within the Actions Editor. Please feel free to leave a comment if there are any questions and I would be happy to receive any feedback.