Move minus sign(-) from end to start of fieldSAP always stores negative numbers with the minus sign at the end of the value. This can cause problems when extracting out of SAP to external applications, for exampl excel expects the minus sign to be at the start of the value. Here is a simple bit of code to take the minus sign off the end and put it at the start. Please note variable being passed into this form needs to be of type char.
*&--------------------------------------------------------------*
*& Form move_minus_sign
*&-------------------------------------------------------------*
* Move minus sign from end to begining of number value
* i.e. from 100.00- to -100.00
*--------------------------------------------------------------*
* <--P_AMOUNT amount
*--------------------------------------------------------------*
FORM move_minus_sign CHANGING p_amount.
* check if negative amount
IF p_amount LT 0.
SHIFT p_amount RIGHT DELETING TRAILING '-'.
SHIFT p_amount LEFT DELETING LEADING ' '.
CONCATENATE '-' p_amount INTO p_amount.
ELSE.
SHIFT p_amount LEFT DELETING LEADING ' '.
ENDIF.
ENDFORM. " move_minus_sign
|
||||