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

Comma in currency and quantity fields

Former Member
0 Likes
4,678

I have a character field and a currency field (kwert). How to modify these fields in such a way so that I get commas in them on the output?

I am doing them on sapscript.

Thanks a lot,

Krishen

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,714

Hi,

Check this example..

DATA: V_CURR TYPE KONV-KWERT.

DATA: V_CHAR(17).

V_CURR = '12000.00'.

WRITE: V_CURR TO V_CHAR.

Use the character variable V_CHAR in your sapscript..It will have commas..

Thanks,

Naren

8 REPLIES 8
Read only

Former Member
0 Likes
2,714

change it to type P format.

data: curr type p decimals 3.
data:kwert type kwert.

curr = kwert.
write: curr.

and than use this variable into sapscript.

kishan negi

Read only

0 Likes
2,714

It does n't seem to work. Any other suggestions please?

Thanks.

Read only

0 Likes
2,714

Hi!

You may try the WRITE command somehow like this:

WRITE lv_kwert TO lv_char USING EDIT MASK '___,___,___'

Check the help for other WRITE options also, there are many useful formatting options in it.

Regards

Tamá

Read only

Former Member
0 Likes
2,714

Try this:

split char_field at '.' into lv1 lv2.

concatenate lv1 ',' lv2 into lv_char.

split curr_field at '.' into lv1 lv2.

concatenate lv1 ',' lv2 into lv_curr.

make sure you define the variables lv1 and lv2 as char fields.

Rewards if Helpful

Viky

Read only

Former Member
0 Likes
2,715

Hi,

Check this example..

DATA: V_CURR TYPE KONV-KWERT.

DATA: V_CHAR(17).

V_CURR = '12000.00'.

WRITE: V_CURR TO V_CHAR.

Use the character variable V_CHAR in your sapscript..It will have commas..

Thanks,

Naren

Read only

0 Likes
2,714

Hi Naren,

Thank you very much!

What if i dont want those decimals and 00 after the result?

For example, from 12,000.00 , I am looking for only 12,000

Thanks again.

Read only

0 Likes
2,714

All you need to do now is to add the DECIMALS 0 to the WRITE statement.



DATA: V_CURR TYPE KONV-KWERT.

DATA: V_CHAR(17).

V_CURR = '12000.00'.

WRITE: V_CURR TO V_CHAR decimals 0.


Regards,

RIch Heilman

Read only

Former Member
0 Likes
2,714

Hi,

Open Transaction SU3. Click on tab named DEFAULTS.

choose the decimal type on the right side of the screen. Save the User settings.

Now run your program and check whether you are able to view the values with commas.

Regards,

Vara