2009 Mar 20 3:25 PM
HI folks,
I have an amount value as '449,00' in variable of char16 type. I need to convert that into a variable of type p length 13 decimal 2.........
Please help me out..........
thanks in advance
2009 Mar 20 3:41 PM
data: lv_dec type p decimals 2.
first split the number into two
split <number> at ',' into lv_char1 lv_char2.
lv_dec = lv_char1.
write:/ lv_dec.
answer:
lv_dec = 449.00
2009 Mar 20 3:28 PM
Try declaring a decimal type variable and moving the character to that variable....
2009 Mar 20 3:31 PM
Check this code which I wrote for you:
DATA: char TYPE char16 VALUE '449,00',
p(13) TYPE p DECIMALS 2.
REPLACE ALL OCCURRENCES OF ',' IN char WITH space.
p = char.
p = p / 100.
WRITE: p.
2009 Mar 20 3:35 PM
Hi,
Use FM CLSE_SELECT_USR01 and get user default decimal sign and separator.
Then replace user decimal sign with dot(.) and separator with space in character variable and condense and then move to your required variable.
Regards,
Raju.
2009 Mar 20 3:37 PM
try write statement.
suppose your char varriable is char and decimal variable is deci
try: write char to deci.
Kuntal
2009 Mar 20 3:41 PM
data: lv_dec type p decimals 2.
first split the number into two
split <number> at ',' into lv_char1 lv_char2.
lv_dec = lv_char1.
write:/ lv_dec.
answer:
lv_dec = 449.00