Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

string to amount

Former Member
0 Likes
1,502

hi all,

how to convert string to amount field

Thanks in Advance

3 REPLIES 3
Read only

Former Member
0 Likes
1,386

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.

Read only

former_member182371
Active Contributor
0 Likes
1,386

Hi,

try with fm HRCM_STRING_TO_AMOUNT_CONVERT

Best regards.

Read only

Subhankar
Active Contributor
0 Likes
1,386

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

.