‎2008 May 11 9:17 AM
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
‎2008 May 11 9:22 AM
System-->User Profile --> own data ..
In the Defaults tab .. change the Decimal Notification to 1 234 567,89
‎2008 May 11 9:23 AM
Or else use write to statement. This will add the thousand separator on its own.
WRITE numfield TO charfield.Regards,
Santosh
‎2008 May 11 11:00 AM
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
‎2008 May 11 11:51 AM
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
‎2008 May 11 12:23 PM
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.
‎2008 May 11 3:32 PM
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