2007 Apr 17 1:23 PM
Hi everybody.
I need to convert a currency value with comma (decimal separator) and dot (thausands separator) like
1000.50 -
> 1.000,50
Hope you could help me. see you
2007 Apr 17 1:26 PM
Hi,
No need to code anything. Just change the settings.
System -> User Profile -> Own data and change the decimal notation as per your requirement.
Click on SAVE.
Close the session.
Best regards,
Prashant
2007 Apr 17 1:26 PM
change the default settings in SU01 , it should work
Goto SU01
Giver ur username , then display button
Goto the defaults tab and change it
2007 Apr 17 1:29 PM
Hai,
Use these:
CONVERT_TO_FOREIGN_CURRENCY Convert local currency to foreign currency.
CONVERT_TO_LOCAL_CURRENCY Convert from foreign currency to local currency
Reward points if it helps you.
Regds,
Rama chary.Pammi
2007 Apr 17 1:31 PM
Hi,
Use the function module <b>WLF_CURRENCY_DECIMAL_JUSTIFY</b> to get the value which you are asking ..
Pass the same Currency values to I_CURR_NEW and I_CURR_OLD.
CAL FUNCTION WLF_CURRENCY_DECIMAL_JUSTIFY
EXPORTING
I_CURR_NEW = 'INR'
I_CURR_OLD = 'INR'
I_AMOUNT_OLD = '1000.50'
IMPORTING
E_AMOUNT_NEW = new_amount.
Now this New_amount will have 1.000,50
Regards
Sudheer
2007 Apr 18 10:17 AM
Hi everybody,
Do you know any fuction module which convert a curency type, for example WERTV8 into a string type?
I have this code:
<i>
data: l_moneda_in TYPE WERTV8, l_moneda_out TYPE WERTV8.
data: l_in(18) TYPE c, l_out(18) type c.
l_in = '1000.50'.
l_moneda_in = l_in.
CALL FUNCTION 'WLF_CURRENCY_DECIMAL_JUSTIFY'
EXPORTING
i_curr_new = 'INR'
i_curr_old = 'INR'
i_amount_old = l_moneda_in
IMPORTING
E_AMOUNT_NEW = l_moneda_out
.
write: l_moneda_out.
l_out = l_moneda_out.
write: l_out.
</i>
I need the correct value '1.000,50' in the l_out variable but although l_moneda_out write the correct value when I try to write l_out is incorrect.
Thanks in advance.
2007 Apr 17 1:32 PM
2007 Apr 17 1:32 PM
Hi ,
You have to use, transaction CONVERT_TO_LOCAL_CURRENCY.
See this code for more detail.
----
----
DATA: l_toval LIKE bseg-wrbtr,
l_fromval LIKE bseg-wrbtr.
DATA: l_tocurr LIKE bkpf-waers,
l_fromcurr LIKE bkpf-waers VALUE 'USD'.
DATA: l_exchrate LIKE tcurr-ukurs.
get amount in other currency
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
client = sy-mandt
date = sy-datum
foreign_amount = l_fromval
foreign_currency = l_tocurr
local_currency = l_fromcurr
IMPORTING
exchange_rate = l_exchrate
local_amount = l_toval
EXCEPTIONS
no_rate_found = 1
overflow = 2
no_factors_found = 3
no_spread_found = 4
derived_2_times = 5
OTHERS = 6.
----
----
If this doesn't resolve your issue or if you do not wnat to add extra code, try this
THIS PROCEDURE IS BY CHANGING SETTINGS :
In your user profile, change the decimal format you are currently using.
System->User Profile->Own data.
Go to defaults tab and then change your decimal notation.
THIS PROCEDURE IS WITHOUT CHANGING DEFAULT SETTINGS:
Check this sample code.
Report YH642_TEST.
TABLES:
mard.
DATA : W_mard_labst type p decimals 3,
w_dt1(18).
data:
W_N TYPE I.
SELECT SINGLE * FROM MARD INTO MARD WHERE LABST = '10000.00'.
WRITE: mard-labst .
W_mard_labst = mard-labst.
WRITE:/ W_mard_labst .
w_dt1 = w_mard_labst .
write W_mard_labst to w_dt1.
W_N = STRLEN( W_DT1 ).
W_N = W_N - 4.
OR, Try this method.
REPLACE ALL OCCURRENCES OF ',' IN W_DT1 WITH '.' .
REPLACE ALL OCCURRENCES OF '.'
IN SECTION OFFSET W_N LENGTH 4 OF W_DT1 WITH ','.
WRITE: / W_DT1.
Hope this resolves your query.
Reward all the helpful answers.
Regards
2007 Apr 17 1:35 PM
Hi
No Need to write an extra code just said Patil above. Change the following settings
System -> User Profile -> Own data and change the decimal notation as per your requirement.
After that log off the SAP and relogin into SAP.
Your Problem is solved.
2007 Apr 17 1:36 PM
hi miguel,
try this function module
CALL FUNCTION <b>WLF_CURRENCY_DECIMAL_JUSTIFY</b>
EXPORTING
I_CURR_NEW = 'LKR'
I_CURR_OLD = 'LKR'
I_AMOUNT_OLD = '1000.50'
IMPORTING
E_AMOUNT_NEW = amount.
amount will have the required output format....
hope this helps u...
reward points if useful
Thanks
Ginni
2007 Apr 17 1:43 PM
you can use WRITE to convert the currency value .....
[]'s
Ander.