‎2008 Jan 21 11:14 AM
Hi,
when i enter the amount as 100 the screen takes it as 100,00.
How do i change the currency format..? Plz suggest me..?
‎2008 Jan 21 11:29 AM
Hi tharani,
when declaring the currency variable..declare it as decimal 0...example:
cur TYPE p DECIMALS 0 value '123456'. then it wont show a comma at output.
plz follow the below link,surely it helps..
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba1ef35c111d1829f0000e829fbfe/content.htm
pls revert back for more quiries..
pls reward if helps..
regards,
Dinesh.
‎2008 Jan 21 11:44 AM
The currency is retrieved from the Database Table and it is dispalyed in the currency text field available in screen.
So wat to do..?
‎2008 Jan 21 12:16 PM
Hi Tharani,
I' ve got some cool ideas from the FM HRCM_STRING_TO_AMOUNT_CONVERT.
The working solution is the following:
DATA: gv_amount_char1(20),
gv_amount_char2(20),
gv_packed TYPE p DECIMALS 2.
MOVE '123456.78' TO gv_amount_char1.
CLEAR: gv_amount_char2, gv_packed.
MOVE gv_amount_char1 TO gv_packed.
WRITE gv_packed TO gv_amount_char2.
kindly reward if found helpful.
cheers,
Hema.
‎2008 Jan 21 12:57 PM
hi tharani,
Below is the code for converting currency values from one currency to another. For demonstration purposes
this example converts 10 euros into GBP. Please note when you display this value you may first need to
convert it from its internal SAP value to the proper external display value
DATA: gd_fcurr TYPE tcurr-fcurr,
gd_tcurr TYPE tcurr-tcurr,
gd_date TYPE sy-datum,
gd_value TYPE i.
gd_fcurr = 'EUR'.
gd_tcurr = 'GBP'.
gd_date = sy-datum.
gd_value = 10.
PERFORM currency_conversion USING gd_fcurr
gd_tcurr
gd_date
CHANGING gd_value.
Convert value to Currency value
&----
*& Form currency_conversion
&----
text
----
-->P_GD_FCURR text
-->P_GD_TCURR text
-->P_GD_DATE text
<--P_GD_VALUE text
----
FORM currency_conversion USING p_fcurr
p_tcurr
p_date
CHANGING p_value.
DATA: t_er TYPE tcurr-ukurs,
t_ff TYPE tcurr-ffact,
t_lf TYPE tcurr-tfact,
t_vfd TYPE datum,
ld_erate(12) TYPE c.
CALL FUNCTION 'READ_EXCHANGE_RATE'
EXPORTING
CLIENT = SY-MANDT
date = p_date
foreign_currency = p_fcurr
local_currency = p_tcurr
TYPE_OF_RATE = 'M'
EXACT_DATE = ' '
IMPORTING
exchange_rate = t_er
foreign_factor = t_ff
local_factor = t_lf
valid_from_date = t_vfd
DERIVED_RATE_TYPE =
FIXED_RATE =
OLDEST_RATE_FROM =
EXCEPTIONS
no_rate_found = 1
no_factors_found = 2
no_spread_found = 3
derived_2_times = 4
overflow = 5
zero_rate = 6
OTHERS = 7
.
IF sy-subrc EQ 0.
ld_erate = t_er / ( t_ff / t_lf ).
p_value = p_value * ld_erate.
ENDIF.
ENDFORM. " currency_conversion
with regards,
asif
‎2008 Jan 22 12:10 PM
Hi tharani..
just pass he currency reference to the said amount field ..decimals will be shown properly..
Edited by: Nivin Joseph Varkey on Jan 22, 2008 1:11 PM
‎2008 Jan 22 12:34 PM
if i specify the reference to the field it showing the amount available in internal table by default.. so only i hv changed it to numc.
so wat to do in this case..?
‎2008 Jan 22 1:04 PM
hi pls explain the exact scenario and requirement..so that we can help further..
‎2008 Jan 22 12:37 PM
HI THARANI,
CHECK THIS
DATA: gd_fcurr TYPE tcurr-fcurr,
gd_tcurr TYPE tcurr-tcurr,
gd_date TYPE sy-datum,
gd_value TYPE i.
gd_fcurr = 'EUR'.
gd_tcurr = 'GBP'.
gd_date = sy-datum.
gd_value = 10.
PERFORM currency_conversion USING gd_fcurr
gd_tcurr
gd_date
CHANGING gd_value.
Convert value to Currency value
&----
*& Form currency_conversion
&----
text
----
-->P_GD_FCURR text
-->P_GD_TCURR text
-->P_GD_DATE text
<--P_GD_VALUE text
----
FORM currency_conversion USING p_fcurr
p_tcurr
p_date
CHANGING p_value.
DATA: t_er TYPE tcurr-ukurs,
t_ff TYPE tcurr-ffact,
t_lf TYPE tcurr-tfact,
t_vfd TYPE datum,
ld_erate(12) TYPE c.
CALL FUNCTION 'READ_EXCHANGE_RATE'
EXPORTING
CLIENT = SY-MANDT
date = p_date
foreign_currency = p_fcurr
local_currency = p_tcurr
TYPE_OF_RATE = 'M'
EXACT_DATE = ' '
IMPORTING
exchange_rate = t_er
foreign_factor = t_ff
local_factor = t_lf
valid_from_date = t_vfd
DERIVED_RATE_TYPE =
FIXED_RATE =
OLDEST_RATE_FROM =
EXCEPTIONS
no_rate_found = 1
no_factors_found = 2
no_spread_found = 3
derived_2_times = 4
overflow = 5
zero_rate = 6
OTHERS = 7
.
IF sy-subrc EQ 0.
ld_erate = t_er / ( t_ff / t_lf ).
p_value = p_value * ld_erate.
ENDIF.
ENDFORM. " currency_conversion
See the below link for explanation and a Program
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/fmCurrencyConversion&
with regards ,
asif.