Skip to main content

Fact or Fiction: Field Routines Slow Down BW Transformations

Quite often, even experienced SAP BW consultants have said that one should not use field routines because of their poor BW transformation performance. I’d like to set the record straight here – I believe these routines are fast. There’s little doubt when running field formulae directly on a HANA database, but ABAP field routines and formulae also perform better than end routines.

Field formulae and routines – an example

I will try and highlight this with an example.

 

feldformeln-und-feldroutinen

 

Let’s say we want to set a flag for the value of a parameter, meaning when it equals one.

 

flag-kennzahl-gleich-1

 

For that, the field formula would be as follows.

 

feldformel

 

We’ll now look at the generated transformation program to understand how field formulae and routines really function in an ABAP application server. This program would be generated, even if a transformation gets direct assignments.  

 

abap-applikationsserver

 

The data packages are processed in the next program step.

 

verarbeitung-der-datensätze

 

It’s evident here that BW transformations typically run a loop over each data package, even without a start or end routine. Our field routine is then executed within this loop. 

 

bw-transformation-schleife-ueber-datensatz

 

What are the advantages of field routines?

From a performance perspective, there is barely any difference between a direct assignment and a simple field routine. The difference between a field and end routine is also revealed at this stage – because when you describe an end routine, you could create an extra, irrelevant LOOP under certain conditions.

Hence, one can conclude that as long as feasible, it’s better to apply field and end routines, since you avoid the superfluous LOOP. 

But we have two other relevant aspects to consider.

First: it is often easier to understand the programming logic of a field routine than that of an end routine, since the latter normally includes information on just the specific field. In general, application of field rules and routines improves serviceability of the system.

Second: the built-in and often unnoticed execution button lets you easily debug field routines and field formulae. This speeds up the development process.

 

feldroutine

 

Better performance through field routines

At this point, another question that arises is whether one should simply modify field routines such that the program logic also works for other fields. This could be useful in situations where you would normally use end routines.

For example, if you identify several data fields via lookup, you could read these through the first field routine via a defined structure in the start routine. The respective structural components are then simply assigned in the remaining field routines. Even if this does not feel really clean, it could still deliver noticeably better performance for big data by saving you the extra loops in the end routine.

Has anyone tried this already? I’d love to hear about your particular experiences under comments.

Markus Sontheimer
Senior Consultant
Markus is a consultant b.telligent specializing in business intelligence, self-service BI, requirements analysis and project management. He advises clients from a wide range of industries on the subjects of business intelligence and reporting. SAP BI products are one of his main areas of interest.
#everydataisbeautiful #sapisgreat #datapassion