Welcome to SAP BW tutorial where we will talk about SAP BW Structures. After completing this tutorial you will learn how to create SAP BW structures and how to use them in Query Designer for reporting. If you are interested in learning SAP BW, check out other tutorials in our free SAP BW training course.
SAP BW Structures
SAP BW structure is defined as a grouping of objects together where we can group key figures or characteristics in structures. In other words, SAP BW structures are combinations of InfoProvider key figures and characteristics. These are basic structural components of a BEx query that are used to define the layout of the query for a row or column.
The two different types of structures that can be created in a query for report are:
- Structures with key figures
- Structures with characteristics (without key figures)
One query can have a maximum of two structures. We can use one structure in a report rows and one structure in the report columns or use both structures in the columns or in the rows.
Key Figure Structures
Whenever we add any field into the query panel, we will see that it is automatically created under a key figure structure in the columns section as shown in below image.
Here we have dragged quantity and revenue to the columns section. A key figure structure automatically is created in the query when we drag and drop key figures from the InfoProvider screen to query rows and columns. This structure is by default named key figures.
Key figure structure includes the components that are based on key figures such as basic, formula, restricted key figures and calculated key figures. Each component included in a key figure structure should include a key figure. This means we can include key figures, formula key figures, selection with key figures, restricted key figures, and calculated key figures in a key figure structure.
However, a characteristic or a selection without a key figure cannot be included in the key figure structure.
Create New Key Figure Structure
To create a key figure structure other than the default one, select Key Figures, right click, and select New Structure.
Then, select New Selection.
After clicking New Selection, give an appropriate description, technical name and drag material object to the right side (details of the selection).
Select Restrict option from the context menu of a material object.
Choose M01 from single values and drag M01 to the right-side selection screen.
Then click OK. Now, the key figure structure has been created with Material selection.
Similarly, we will add customer object to the structure with some restrictions.
When we use two structures in the query, a new function will be available in the Query Designer. This function is cell definition in the cell editor. Here, we can additionally define a separate logic (selection or formula) for each of the cells formed due to intersection of the two structures.
To open Cell Editor, click on the cell definition button on top of properties tabs or use menu path to view cell editor. When cell definition is enabled, an additional cells tab area is visible on the Query Designer layout as shown in below image.
Here we can see Cells screen. This option is activated only when there are two structures in the query.
We can create a characteristic structure by adding characteristics into the new structure in the rows section. We can add as many characteristics to the structure as necessary. Characteristic structures determine the sequence and number of key figures and characteristics in the columns and rows of a query. The components of characteristic structures cannot contain key figure selections.
For example, if we want to always use customer and material in our queries, then we can create a characteristic structure with customer and material and use it in our queries.
To do this, we have to create a structure (customer, material) in the rows section. Go to rows, right click, and select New Structure.
Right click on the new structure and choose New Selection.
To edit and add characteristics choose the selection and click on Edit button as shown below.
Then, give a proper description and add a customer characteristic to the right-hand side.
For Material, we also need to create another selection with adding material characteristic to the selection.
After saving the query the Cell editor is enabled. Now, the query has two SAP BW structures. One is the key figure structure and another is the characteristic structure.
Save the query and the Cell editor will become enabled.
When we have two structures created in our query, cell definitions are automatically created and Cell editor becomes active. Cell definition is useful functionality of a Query Designer which helps us define logic for each individual cell.
As explained above, based on the two structures (characteristic and key figures) SAP BW will generate the report. However, to avoid errors or wrong results due to intersection of these two structures, we can also define logic for individual cells. Using Cell editor, we can go to each of the cells and can control its behavior. Using Cell editor, we can write a new formula, selection or restriction in each individual cell.
Overall, Cell editor in BEx Query Designer enables us to:
- Define formulas and selection conditions for a cell to override the automatically created cell values.
- Define help cells that have no direct relationship to the structures.
Choose cell tab to create the logic. Here, we can control each and every individual cell on the cell tab.
Select Revenue cell and then choose Edit button.
We will be presented with all the properties to restrict or write formula to control the individual Revenue cell.
Benefits of SAP BW Structures
The benefit of using a structure is reusability of certain objects several times. We are able to reuse combination of fields at any point of time. No need to drag one by one many times. The reusability here becomes very useful. The structure will let us bring those objects every time we want to use them.
Reusable SAP BW Structures
When we save SAP BW structures as reusable structures, we can also use them in other queries for the same InfoProvider. For that we need to save this structure using Save As command from the context menu.
Then, give an appropriate description and technical name for the structure.
Next, this structure will be saved as a reusable structure under Structures folder in the InfoProvider tab.
Did you like this tutorial? Have any questions or comments? We would love to hear your feedback in the comments section below. It’d be a big help for us, and hopefully it’s something we can address for you in improvement of our free SAP BW tutorials.