‎2008 Jul 03 7:08 AM
hi all,
how to convert string to amount field
Thanks in Advance
‎2008 Jul 03 7:12 AM
hi bala,
this can be easily achieved.
first move the amount in string field to type p field and then write the type p field to a type c field with currency addition.
data: amt(20) .
data: pamt(16) type p decimals 2 .
data: camt(30) .
amt = '12345678.80' .
pamt = amt .
write pamt to camt currency 'USD' .
check out the above sample code.
or
you can use the code explained here in this thread
or check out this thread
Regards
Anup.
‎2008 Jul 03 7:12 AM
‎2008 Jul 03 7:33 AM
Please do it in this way
data:
l_field TYPE string,
l_amount TYPE TSLVT12.
l_field = '1234156345655'.
CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'
EXPORTING
string = l_field
DECIMAL_SEPARATOR =
THOUSANDS_SEPARATOR =
WAERS = 'USD '
IMPORTING
BETRG = l_amount
EXCEPTIONS
CONVERT_ERROR = 1
OTHERS = 2
.