FOX formulas are a good solution in SAP planning if you are looking for a high-performance way to process data with SAP Business Planning and Consolidation or BW IP. It is important to understand the functionality of FOX formulas with regard to block formation. This is helpful for debugging as well as essential for increasing the performance of your planning solution. In this article I explain in detail how the blocks are created in FOX formulas.
A FOX formula is always executed several times in a row. First, the data selected by the filter is divided into blocks. The planning function is then executed for each block.
Characteristics that were not selected as characteristics to be changed form a block. Therefore these characteristics are also called block characteristics.
Blocks are formed internally by the system as they facilitate the conversion of FOX formulas into ABAP code. A loop is created for each block characteristic.
All data records in a block have the same characteristic values for the block characteristic. Let's look at an example to illustrate this. The displayed data sets represent the initial data:
Version |
Company Code |
Quantity |
1 |
4711 |
300 |
1 |
0815 |
200 |
2 |
4711 |
300 |
2 |
0815 |
200 |
Assuming that you select the version as the characteristic to be changed, the Company Code characteristic serves as a block characteristic. Two blocks are formed, one block per characteristic value. The FOX formula is thus executed twice.
The following blocks are created by the system. The characteristic value of the company code is identical for each block. Note, however, that the sort order of the blocks can be random.
Block 1:
Company Code |
Version |
Quantity |
4711 |
1 |
300 |
4711 |
2 |
300 |
Block 2:
Company Code |
Version |
Quantity |
0815 |
1 |
200 |
0815 |
2 |
200 |
However, if the Company Code characteristic is selected as the field to be changed, the version functions as a block characteristic. In this case, the following blocks are created.
Block 1:
Version |
Company Code |
Quantity |
1 |
4711 |
300 |
1 |
0815 |
200 |
Block 2:
Version |
Company Code |
Quantity |
2 |
4711 |
300 |
2 |
0815 |
200 |
If you do not select any characteristics to be changed, all characteristics serve as block characteristics. In this case, one call is made per data record. Four blocks are formed.
Block 1:
Version |
Company Code |
Quantity |
1 |
4711 |
300 |
Block 2:
Version |
Company Code |
Quantity |
1 |
0815 |
200 |
Block 3:
Version |
Company Code |
Quantity |
2 |
4711 |
300 |
Block 4:
Version |
Company Code |
Quantity |
2 |
0815 |
200 |
If, on the other hand, you select all characteristics as characteristics to be changed, only one block will be created, since no block characteristics exist. Only one call is made for all data records:
Version |
Company Code |
Quantity |
1 |
4711 |
300 |
1 |
0815 |
200 |
2 |
4711 |
300 |
2 |
0815 |
200 |
In summary, the following overview results:
Field to be changed | Block characteristic | Number of calls / data records |
Version |
Buchungskreis |
2 Aufrufe, Datensätze 1 und 3 sowie 2 und 4 |
Buchungskreis |
Version |
2 Aufrufe, Datensätze 1 und 2 sowie 3 und 4 |
leer |
alle |
4 Aufrufe, ein Datensatz pro Aufruf |
alle |
leer |
1 Aufruf, für alle Datensätze |
Once you know how the block formation works, the effect on performance also becomes clear. For example, you should restrict the values of the block characteristics in the filter as much as possible so that not too many blocks are created.
Using a HANA database brings strong performance advantages. By default, the FOX formulas are executed in the HANA database. However, you should consider some restrictions. The following commands are not supported in the HANA and therefore the FOX formula is executed on the application server, so you cannot benefit from code push down:
As you have noticed, a rather inconspicuous topic like block formation is essential to ensure good performance in data processing using FOX formulas.
Depending on your scenario you have to decide how many blocks you want to be created. It is very important to set the filters of the block characteristics as precisely as possible in order to reduce the number of data records to be processed, but also the number of blocks to be created to a minimum.
Furthermore, this knowledge helps you to better understand the debugging of FOX formulas.
Do you need support with your planning solutions? Please do not hesitate to contact us.