2005 Dec 07 1:02 PM
hi all,
I have an amount in a char or string field. On any calculation(even absolute) on that field the decimal value is lost or shifted on either side.
I need this field as char only because I'm concatenating it with a sign.
pls suggest a solution.
Thanks in advance,
Archana
hi all,
I have an amount in a char or string field. On any calculation(even absolute) on that field the decimal value is lost or shifted on either side.
I need this field as char only because I'm concatenating it with a sign.
pls suggest a solution.
Thanks in advance,
Archana
2005 Dec 07 1:07 PM
Hi Archana!
How about using field = field * -1 for switching the sign. In output you have several options in write ... using edit mask to place a sign and the decimals.
Regards,
Christian
2005 Dec 07 1:12 PM
Hi Archana,
First do the required calculations not necesary to define as string. While concatenating into another string, simply pass that value into a string type variable. And finally concatenate those 2 strings into the final one.
Regards,
Sudhakar.
2005 Dec 07 1:18 PM
and just by the way:
Until last week I never tried but this works!!!
variable = - variable.
Might be faster than
variable = variable * -1.
2005 Dec 07 1:17 PM
Initially declare the field as AMOUNT field.
Do, the necessary calculations on the field. Finally move this data into a char field and u can concatenate the '-' value to the char field.
Hope this helps U.
Pl. award appropriate points.
2005 Dec 07 1:21 PM
Hi Archana,
You can convert the String field to char by FM CHAR_FLTP_CONVERSION and then perform the calculations. After the calculations you can again convert the Floating field to char field by using FM FLTP_CHAR_CONVERSION.
Lokesh
Pls. Reward appropriate points.
2005 Dec 07 1:27 PM
Hi,
For putting '-'sign in front of amount you can use
FM 'CLOI_PUT_SIGN_IN_FRONT'.
Always refer currency field with write.
WRITE:/ sum_it-dwrbtr currency bkpf_it-waers.
and remaining manipulation you can do as usual before write statement.
Can i know for which currencies the decimal is lost.
Thanks.
2005 Dec 07 1:58 PM
Hi Deepak,
initially I have this value in a string field...but as soon as I transfer it into an amount field, the decimal value gets lost or is shifted (as though divided by ten or hundred)...so I actually don reach the stage to reverse the sign...
and I have tried all the above but nothing is working...
pls help...this is very unusual...
2005 Dec 07 2:04 PM
Hi,
Change your CHAR field to
Data: amnt like bseg-wrbtr.(example).
So that you can do what ever manipulations you want.As i said you need to refer currency field while write statement.
When comes to Decimal for JPY and KOR you wont find Decimals for this currencies.
I hope this will help u.
Thanks.
If this helps u reward with points.
2005 Dec 07 3:12 PM
Hi Archana!
You need a conversion from string to number - this would even happen implicit in calculation.
Please try further with FM CHAR_FLTP_CONVERSION (or make some own coding like shift left, replace ',.'...). Only in case of correct conversion all the other hints can help.
Regards,
Christian
2005 Dec 07 3:55 PM
first move the string to a variable with type p decimals 2 , carry out the calculations and move back the result to the string.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |