BLOGBUSINESS INTELLIGENCESAP BUSINESS WAREHOUSE
McCoy

ABAP features that makes your BW life easier

With every new ABAP release new functionality gets implemented. Most BI consultants forget that this gives you the ability to work more efficiently. Instead, they just use the same traditional statements that they are used to work with before. However, the BI consultant with an ABAP background is the consultant that tries to achieve the same goal with less code and better performance. In this blog, we give you an insight of handy ABAP (>= 7.4) features that make the life of a BW consultant easier.

INLINE DATA DECLARATIONS

One of the most interesting features is to use inline data declarations. This feature is implemented with ABAP release 7.4 and gives you the ability to use variables without defining them first. The advantage of the inline data declaration is that it automatically copies the right-side type properties as input for the newly defined variable.

Inline data declaration can be used with tables, work area’s (using DATA function) and field symbols (using FIELD-SYMBOL function). There are no restrictions when it comes to the use of the inline data declarations, it can also be consumed directly in any execution method like LOOP AT, FACTORY METHODS or as HELPER VARIABLES

More info: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abendata_inline.htm

CORRESPONDING operator

This function looks similar to the MOVE-CORRESPONDING ABAP statement but as addition, this operator has the ability to specify a field mapping. This could be handy when you require remapping of certain fields to different data types (think of DATS to CHAR) without looping over the internal table first.

More info: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenconstructor_expr_corresponding.htm

FILTER operator

Filtering tables using the delete statement is a common thing to do within BW, especially filtering out invalid records in the source package. But what if you want to filter out values that are compounded?

Cleaning an internal table using the delete statement actually threats the table as a whole and is not evaluating every record individually. Evaluating record individually is what you require when you want to delete records that are compounded. If this is your requirement then you can use the FILTER operator.

This operator is meant to filter internal tables by evaluating multiple columns at once. In the example below, we filter out deleted PO items from the source package using the hashed table that is filled earlier using the SELECT statement.

More info: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenconstructor_expression_filter.htm

FOR operator

With the introduction of ABAP 7.4 we also have the ability to use the FOR operator instead of LOOP. Basically, both are the same but the FOR operator achieves the same goal in less code.

In some cases, the FOR operator (especially when nothing fancy is required) is desired over the LOOP statement (as it is more readable). In the example below two examples are written. The first example is directly storing the output of the FOR loop into a new internal table and the second example is using the FOR operator to directly create a range table using one single statement (which can be used for filtering out data later).

Conclusion

Concluding this technical blog, we see that ABAP is still evolving. With every release new functions are introduced that can be used within the BW system or any other NetWeaver system. Don’t stick to your old way of working but try to evolve as well. Try to keep up with the pace by keeping an eye on the  ABAP Release Changelog and start testing new functionality once it comes available.

Do you think after reading this blog your (or your customers) SAP Data Warehouse can be more efficient? Is it still based on old technical standards and you need help in improving this? Just gives us a call we can advise your company on how to technically improve your SAP Data Warehouse.