‎2009 Feb 23 10:35 AM
Hi,
In my code am retriving one value with select statement..
that value I am getting is with minus sign..
i need to cange it to positive...
can you suggest the best syntax as per performance.....?
‎2009 Feb 23 10:38 AM
Hi Shruthi,
Use:
value = value * -1.
Or
value1 = ABS(value).
Regards,
Nitin.
Edited by: Nitin Karamchandani on Feb 23, 2009 11:39 AM
‎2009 Feb 23 10:36 AM
‎2009 Feb 23 10:37 AM
hi.....
for this thing if you are getting the value in data object W_VALUE
GO FOR FOLLOWING STATMENT BEFORE YOU GO FOR DISPLAY OR PROCESSING THIS WILL GIVE YOU A VALUE WITHOUT SIGN IF ANY IS THERE
W_VALUE = ABS( W_VALUE ).
REGARDS
Edited by: Mohit Kumar on Feb 23, 2009 11:37 AM
‎2009 Feb 23 10:38 AM
‎2009 Feb 23 10:38 AM
Hi Shruthi,
Use:
value = value * -1.
Or
value1 = ABS(value).
Regards,
Nitin.
Edited by: Nitin Karamchandani on Feb 23, 2009 11:39 AM
‎2009 Feb 23 10:44 AM
Hi,
Please Test the following Sample Code and try to use ABS rather than multiply by -1 if you need all the Values Positive because if you will use Multiply by -1 it will convert your Positive Values to Minus Too.
DATA: BEGIN OF it OCCURS 5,
amount TYPE i,
END OF it.
it-amount = '75'.
APPEND it TO it.
it-amount = '-12'.
APPEND it TO it.
it-amount = '-20'.
APPEND it TO it.
it-amount = '55'.
APPEND it TO it.
LOOP AT it into it.
it-amount = abs( it-amount ).
MODIFY it from it.
WRITE: / it-amount.
ENDLOOP.Kind Regards,
Faisal
‎2009 Feb 23 10:53 AM
‎2009 Feb 23 10:40 AM
‎2009 Feb 23 10:42 AM
‎2009 Feb 23 10:42 AM