Sign reversal in end routine for all key figures of data package
I am searching for an efficient and scalable way to reverse the sign of every key figure, which occurs in the data package structure. This should be done in the end routine of a transformation.
Background: I want to do a loop-load on an InfoCube using Transformation/DTP. All key figures of the extracted data shall be reversed. Thus, I achieve a nullification in the InfoCube (MINUS plus PLUS gives ZERO).
Currently, I multiply every key figure field with -1 in the end routine (using very simple ABAP), which works fine. The coding looks as follows:
<SOURCE_FIELDS>-/BIC/ZCOGJBONU = <SOURCE_FIELDS>-/BIC/ZCOGJBONU * -1. <SOURCE_FIELDS>-/BIC/ZCOGMRABA = <SOURCE_FIELDS>-/BIC/ZCOGMRABA * -1. <SOURCE_FIELDS>-/BIC/ZCOGVVADJ = <SOURCE_FIELDS>-/BIC/ZCOGVVADJ * -1.
... and so on for the other key figures.
The negative thing about this static solution is, that this does not scale automatically, if new key figures are added to the cube for instance; you must need to adjust the routine in such cases.
I am searching for efficient ABAP code, which basically dynamically checks the structure of the DATA_PACKAKGE against key figure data types and automatically applies the multiplication with -1 for all of those key figure fields in the structure. That would be scalable, as it would not need to be adjusted, if the key figure number changes in the InfoCube.
Is there any function module from SAP, which can solve this problem? Has anyone of you written ABAP code, which provides a solution to this issue?
Thanks to any answers in advance.