Scenario:

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.

Reason:

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.



Work around: 

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_FIELDSNETVAL_INV IS NOT INITIAL.
         RESULT
= SOURCE_FIELDSNETVAL_INV .
        
IF RESULT < 0 .
          
SHIFT RESULT RIGHT CIRCULAR  .
          
CONDENSE RESULT NOGAPS .
       
ENDIF.
    ENDIF.




End Routine:


________________________________________________________________________________


LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS> WHERE NETVAL_INV < 0 .
 

   SHIFT <RESULT_FIELDS>NETVAL_INV RIGHT CIRCULAR  .
  
CONDENSE <RESULT_FIELDS>NETVAL_INV  NOGAPS .


ENDLOOP.



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.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Amit Ghildyal

    Very good article, it will help a great deal while loading the data to external systems correctly and will save a lot of time and manual effort in correcting the data every time.

    Great

    Thanks.

    (0) 

Leave a Reply