Creating Structures

Objective

After completing this lesson, you will be able to create a query with two structures.

Structures in Queries

Structures are combinations of InfoProvider key figures and characteristics. A structure has multiple purposes. It can be used to form the basic framework of the rows or columns for a query result. Structures provide precise control of where key figures and characteristic appear in a result. A structure can also be defined as reusable so it provides a ready-made layout that benefits future query developers who need to the same layout.

Structures are built from selections and formulas.

Key Figure Structures

In the BW Query Designer in SAP HANA Studio, a Key Figure Structure appears automatically when you move a key figure from the InfoProvider section to the Rows or Columns sections.

This image presents a screenshot of the BW Query Designer interface, showing how a Key Figure Structure is defined in SAP HANA Studio. It illustrates key figures and formulas being grouped to create meaningful structures for queries. Key figures like Net Order Amount USD 2015 and % Variance 2015/2014 are used, with formulas displayed below. The surrounding details, including columns, rows, and selections, are explained further in the text that follows.
  • Components are basic key figures, restricted key figures, and calculated key figures or formulas.

  • Key figures in rows or columns are always components of a key figure structure.

  • Each component of a key figure structure must contain a key figure.

  • You can use only one key figure structure in a query.

Characteristic Structures

You also can define Characteristic Structures: The structural elements of a characteristic structure cannot contain any key figure selections.

This figure demonstrates the construction and composition of a characteristic structure in BW Query Designer. The characteristic structure is divided into components with specific attributes, such as Notebooks Basic and Notebooks Professional. It highlights how formulas can combine multiple components into higher-level groupings and outlines the net order amounts for each notebook category.
  • Use one or more characteristics and filtering to define the selections of the components of the structure - for example, single values, ranges, or hierarchy nodes.
  • Use variables for flexible selections.
  • The components of a characteristic structure cannot contain key figure selections, but they can contain formulas.
This image depicts a BW Query Designer interface, illustrating the configuration of characteristics on the Row axis and their application in a filtered report. The details shown, including the Product IDs, default filter values, and the resulting Net Order Amounts in the report, are further described in the text that follows.

The difference between a characteristic structure and the use of characteristics on an axis is as follows:

  • Characteristic structure: You specify the number, sequence, and the content of structure elements in the query definition.
  • Characteristics on an axis: All selected characteristic values are displayed in the report.

Reusable Structures

You can save structures so that they are reusable and they can be used in other queries for the same InfoProvider. The structure then belongs to the InfoProvider and is known as an InfoProvider-level structure.

Changes made later to InfoProvider-level structures immediately affect all queries in which they are used.

Quite often a reusable structure needs adjustments for a specific query. However, if you change the reusable structure then all queries that use that structure will be affected. If you want to adjust the structure for a specific query but do not want to affect the reusable structure, you can convert the reusable structure that you have added to your query, into a query-level structure. This is done by right-clicking the reusable structure that you have added to your query to open the context menu and choosing Dereference. You can then make changes to the structure in your query without affecting the reusable structure.

Queries with Two Structures

A query can have a maximum of two structures. If you are using two structures, for example, a key figure structure in the columns and a characteristic structure in the rows, a table with fixed-cell definitions is created.

A screenshot of a sheet definition for a query titled Queries with Two Structures. The image includes two structures: a Key Figure Structure displaying metrics like net order amounts and percentage variances, and a Characteristic Structure listing comparison products such as notebooks. Annotations with arrows highlight the two structures. The general section includes technical name, description, and a checkbox for zero suppression.

More Details about Queries with Two Structures

  • You can include only one key figure structure in a query.

  • You can define one structure in the columns and one structure in the rows, or use both structures in the columns or in the rows.

  • You can combine structures freely with other characteristics in the rows and columns.

  • You can provide your own custom descriptions for rows or columns that are represented by members of a structure. For example, you could define the first row of a structure using a selection of values from the characteristic 0PERSON, then name the row of the structure, My Team. The next row in the structure might include the remaining values from the characteristic 0PERSON and you might name this row, Employees not in my team.

  • You can define formulas in either structure. However, ensure that you avoid formula collisions. This is where formulas defined in a row and also a column collide at the intersecting cell.

  • If you cannot avoid formula collision, you can resolve it if the default behavior leads to incorrect results (see lesson Resolving Formula Collision).

How to Create a Query with a Characteristic Structure and a Key Figure Structure

Launch the following demonstration to learn about different types of structures.

How to Work with Reusable Structures within a Query with two Characteristic Structures

In the following demonstration, you explore how to work with reusable structures and to build a business scenario using two characteristic structures.

Defining Priorities for Structure Elements

  • If you use two structures in a query, the system takes into account the properties, which have been specified for the structures or for specific cells.

  • The system takes the properties into account according to the order in which the properties are specified.

  • The last specification made has priority.

  • On the Priorities tab, you can view and modify the priority handling by explicitly specifying which property is actually taken into account.

  • This is a power user function.

For the Select Property field, the system displays a list of properties, for which you can set priorities. These are mostly display properties, which you can find in the definition of a structure element (selection or formula) or a cell on the General tab.

Here, you see the two structures of the query with their structure elements in the grid. If the properties of a structure element have not been changed in the query definition, the system displays the default values configured on the InfoObject maintenance screen.

However, if a property of a structure element in the query definition has been explicitly changed, the system displays the changed value.

Image showing a software interface for defining priorities in query structures. Dropdown menus labeled Select Property are used to assign properties like Highlight or Number of Decimal Places to data rows (e.g., Notebooks Basic, Notebooks Professional). Data columns include metrics such as Net Order Amount USD for 2014 and 2015 and % Variance. A yellow annotation highlights the selection process for assigning properties.

The following figure shows an example of an explicitly changed property of a structure element included in the Columns and of explicitly defined Cell settings .

By using Apply Row Value, the property setting of the structure element included in the Rows will take place. This property setting will also override explicitly defined Cell settings when Keep Explicit Cell Values is not set.

Image showing a tabular interface titled Defining Priorities for Structure Elements and Cells with multiple sections displaying rows of data properties, values, and configuration options. Columns include labels such as Select Property, Number of Decimal Places, and metrics like Net Order Amount USD for different time periods. A yellow-highlighted note reads Last Changed into 0.000, emphasizing the adjustment of a specific value. Various buttons for applying or keeping explicit cell values are visible at the bottom.

Symbols and Meanings

SymbolMeaning

The value in the column structure matches the value in the row structure.

The structure element inherits the property from the structure in the row.

The structure element inherits the property from the structure in the column.

Symbol for the cell definition: An explicitly set cell value has priority.

Note that the Keep Explicit Cell Value field is selected by default, to save values in the event of any changes. This means that explicitly set cell values are retained, even if the default value of the row structure or column structure is to be generally applied.

If you have changed an explicitly set cell value, the system adds the expression (Cell) to the new value.