While sending data to external systems via OpenHub or Analysis Process Design (APD), if there are negative numbers in the extracted data, the minus sign is positioned after the number in the output file. However, we want the minus sign to be positioned before the number.
When the data is copied from the OpenHub interface, it is copied from the display in the internal format directly to the string that is finally written to the file. In the internal display of a negative number, the minus sign is displayed after the number.
SAP Note : 856619
For example : – 9.21 would be stored in SAP as 9.21– ( Minus sign at the end) . This also gets transferred to external system or file.
Changing OpenHub field setting from Internal to External does not help. However, we can put a simple two line to code to get around this issue.
Field for which you expect a negative sign to occur put the below code in Field Routine / End Routine of Transformation. For my scenario it is 0NETVAL_INV ( Net Value Invoiced ) .
Field Routine :
IF SOURCE_FIELDS–NETVAL_INV IS NOT INITIAL.
RESULT = SOURCE_FIELDS–NETVAL_INV .
IF RESULT < 0 .
SHIFT RESULT RIGHT CIRCULAR .
CONDENSE RESULT NO–GAPS .
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS> WHERE NETVAL_INV < 0 .
SHIFT <RESULT_FIELDS>–NETVAL_INV RIGHT CIRCULAR .
CONDENSE <RESULT_FIELDS>–NETVAL_INV NO–GAPS .
You can have multiple variation of these codes based on your scenario and number of fields you want to change the sign for . Basic ABAP Key word here is
SHIFT RIGHT CIRCULAR , which moves the minus sign in a circular fashion and bring to the front. Then you condense the field to delete the gap between the number and the minus sign at the left.
Alternatively we can create a function module in BW system by copying CLOI_PUT_SIGN_IN_FRONT from ECC ( not sure why this is not available in BW by default ) and then call this function module. However, as the code is very simple , I would prefer to put it in routine.