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

amount field with thousand separator

Former Member
0 Likes
20,576

Hi friends,

i want to display amount field (5794.00)with thousand separator as (5,794.00).

i defined amount field as character data type for my requirement.

user want to see this value with thousan separator.

Please help me hoe can i get thousand separator.

Thanks

ramesh

6 REPLIES 6
Read only

Former Member
0 Likes
7,931

System-->User Profile --> own data ..

In the Defaults tab .. change the Decimal Notification to 1 234 567,89

Read only

Former Member
0 Likes
7,931

Or else use write to statement. This will add the thousand separator on its own.


WRITE numfield TO charfield.

Regards,

Santosh

Read only

0 Likes
7,931

Hi

as you said i used write v_amt_comma to v_amt.

i am getting ouput as 000000000005792.it should be 5,792.00

please help me

thanks

Read only

Former Member
0 Likes
7,931

Hi,

Try like this,

data: a(15) type c,

b type ekpo-netpr.

a = '5794.00'.

b = a.

write:/ b. 'I got output as 5,794.00

Reward points if useful.

Regards,

s.senthil kumar

Read only

vinod_vemuru2
Active Contributor
7,931

Hi Ramesh,

When u get the amount from database table definitely it will be of type curr. What u have to do is directly write that currency field to ur character variable. no need of numeric variable.

eg: LOOP AT itab INTO wa.

CLEAR w_amount.

WRITE wa-wrbtr TO w_amount.

ENDLOOP.

Above statement will write the thousand seperator as per the user settings.

If u always want to have 2 decimals then use addition DECIMALS.

WRITE wa-wrbtr TO w_amount DECIMALS 2.

So no need of numeric field.

Thanks,

Vinod.

Read only

Former Member
0 Likes
7,931

Hi Ramesh,

There is two functions for converting display currentcy

CURRENCY_AMOUNT_SAP_TO_DISPLAY

Convert currency value from value stored in SAP to displayed currency

CURRENCY_AMOUNT_DISPLAY_TO_SAP

Convert currency value from displayed currency value to value stored in SAP

Try below,

  • DATA declaration

*----


  • WMTO_S-AMOUNT = Type DEC :: length 15 :: Deciamls 4

parameter: p_discur like TCURC-WAERS, "Display currency

p_intval like WMTO_S-AMOUNT. "Internal Amount

data: gd_disval like WMTO_S-AMOUNT. "Display Amount

************************************************************************

*Start-of-selection.

START-OF-SELECTION.

CALL FUNCTION 'CURRENCY_AMOUNT_SAP_TO_DISPLAY'

EXPORTING

currency = p_discur

amount_internal = p_intval

IMPORTING

AMOUNT_DISPLAY = gd_disval

EXCEPTIONS

INTERNAL_ERROR = 1

OTHERS = 2.

IF sy-subrc EQ 0.

  • You are now able to manipulate the returned value.

  • I.e. Convert it to GBP

  • Without using this function module you would only be manipulating the

  • SAP stored value, which is often missing a number of zeroes.

  • I.e. 28000 JPY is stored within SAP as 280.

ENDIF.

************************************************************************

*End-of-selection.

END-OF-SELECTION.

write:/(30) 'Value stored in SAP:', p_intval,

/(30) 'Displayed currency:', p_discur,

/(30) 'Ammount is displayed Currency:', gd_disval.

Hope it help

Wiparat