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

currency format

Former Member
0 Likes
1,072

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..?

8 REPLIES 8
Read only

Former Member
0 Likes
986

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.

Read only

0 Likes
986

The currency is retrieved from the Database Table and it is dispalyed in the currency text field available in screen.

So wat to do..?

Read only

Former Member
0 Likes
986

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.

Read only

Former Member
0 Likes
986

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

Read only

nivin_varkey
Active Participant
0 Likes
986

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

Read only

0 Likes
986

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..?

Read only

0 Likes
986

hi pls explain the exact scenario and requirement..so that we can help further..

Read only

Former Member
0 Likes
986

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.