Application Development 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: 

Need help in abap logic

Former Member
0 Kudos

Hi All,

I need to concatenate '$' sign to a currency field.

The code i am using is -

-


DATA L_TOTAL_PRICE TYPE CHAR15.

L_TOTAL_PRICE = W_CAT2_PRICE. " W_CAT2_PRICE is currency field and its (type is CRMT_NET_PRICE....(in CRM)

CONDENSE L_TOTAL_PRICE.

CONCATENATE W_DOLLAR L_TOTAL_PRICE INTO W_TOT_PRICE.

-


The problem i am facing is 'COMMAs' are getting omitted as i have taken L_TOTAL_PRICE TYPE CHAR15.

If I take L_TOTAL_PRICE TYPE P then it gives a dump as the '$' cannot be interpreted.

I want the output to be like $1,23,456.00 (with commas) and i am getting $123456.00 (without commas).

Please help guys !!!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Could you please try the following logic?

DATA L_TOTAL_PRICE TYPE CHAR15.

write w_cat2_price to l_total_price.

CONDENSE L_TOTAL_PRICE.

CONCATENATE W_DOLLAR L_TOTAL_PRICE INTO W_TOT_PRICE.

Thanks and Regards,

Suresh

6 REPLIES 6

Former Member
0 Kudos

Hi,

Could you please try the following logic?

DATA L_TOTAL_PRICE TYPE CHAR15.

write w_cat2_price to l_total_price.

CONDENSE L_TOTAL_PRICE.

CONCATENATE W_DOLLAR L_TOTAL_PRICE INTO W_TOT_PRICE.

Thanks and Regards,

Suresh

Former Member
0 Kudos

Hi,

Instead of


L_TOTAL_PRICE = W_CAT2_PRICE.

use,


WRITE: W_CAT2_PRICE to L_TOTAL_PRICE.

this will apply the user's decimal format.

Regards,

Nick

Former Member
0 Kudos

hi,

try this

write W_CAT2_PRICE to L_TOTAL_PRICE.

Regards

Milan

Former Member
0 Kudos

hi

use

write statment insted of assining W_CAT2_PRICE to L_TOTAL_PRICE .

~linganna

Former Member
0 Kudos

Hi,

Try the following code.

DATA W_TOT_PRICE TYPE STRING.

L_TOTAL_PRICE = W_CAT2_PRICE. " W_CAT2_PRICE is currency field and its (type is CRMT_NET_PRICE....(in CRM)

CONDENSE L_TOTAL_PRICE.

CONCATENATE W_DOLLAR L_TOTAL_PRICE INTO W_TOT_PRICE.

Just for displaying purpose, you can assign the variable as string into which the concatenated valuse is going to be stored.

Regards,

Vik

0 Kudos

DATA amt TYPE p DECIMALS 2.

amt = your amount

write AMOUNT to OUT currency 'USD'.

CONCATENATE '$' out INTO out.

CONDENSE out.