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

Issue regarding currency conversion

Former Member
0 Likes
1,598

Hi Experts,

I'm having issue with currency conversion. Default report output values are displaying in 'EURO' and I had created a toolabar with currency conversion buttons. When this button is selected, values has to be changed into user select currency like INR, USD, AUD. Here im triggering with issues, all the values are converted into 0's. Total value is only converting for first time. From next time. its not converting. I'm using FM's CONVERT_FOREIGN_TO_FOREIGN_CUR,CONVERT_TO_LOCAL_CURRENCY,READ_EXCHANGE_RATE.

Please provide ur solutions to solve the issue.

Thanks and Regards,

Bharat

Hi Experts,

I'm having issue with currency conversion. Default report output values are displaying in 'EURO' and I had created a toolabar with currency conversion buttons. When this button is selected, values has to be changed into user select currency like INR, USD, AUD. Here im triggering with issues, all the values are converted into 0's. Total value is only converting for first time. From next time. its not converting. I'm using FM's CONVERT_FOREIGN_TO_FOREIGN_CUR,CONVERT_TO_LOCAL_CURRENCY,READ_EXCHANGE_RATE.

Please provide ur solutions to solve the issue.

Thanks and Regards,

Bharat

11 REPLIES 11
Read only

Former Member
0 Likes
1,544

Check this wiki : https://wiki.sdn.sap.com/wiki/display/Snippets/FMCurrencyConversion

Read only

0 Likes
1,544

Hi All,

Need solution for the above issue.

Br,

Bharat

Read only

Subhankar
Active Contributor
0 Likes
1,544

Hi ,

You can use this block of code..It is used in our project.

data : l_rate type ukurs_curr, "Exchange rate

l_rate_type type kurst_curr, "Type of rate

l_l_fact type i, "Local factor

l_f_fact type i. "Foreign factor

  • check local currency ,foreign currency local amount are not initial

check foreign_currency is not initial and

local_currency is not initial and

local_amount is not initial.

  • Calculate exchange rate

if local_currency = 'MXN' and foreign_currency = 'USD'.

l_rate_type = 'MXNT'.

else.

l_rate_type = 'M'.

endif.

*Call FUNCTION module to get exchange rate

call function 'READ_EXCHANGE_RATE'

exporting

date = sy-datum

foreign_currency = local_currency

local_currency = foreign_currency

type_of_rate = l_rate_type

importing

exchange_rate = l_rate

foreign_factor = l_f_fact

local_factor = l_l_fact

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.

if l_rate le 0.

l_rate = l_rate * -1.

endif.

  • Foreign amount

if l_rate_type = 'MXNT'.

foreign_amount = local_amount / l_rate .

else.

foreign_amount = local_amount * l_rate .

endif.

endif.

Read only

Former Member
0 Likes
1,544

As per my understanding, when the button is pressed the amounts in all the line items will be converted to the desired currency. Are you getting the 0s for all line items? Could you describe the issue more precisely or share the code?

Read only

0 Likes
1,544

Hi,

Initial report output values are displaying in 'EUR'. In the output,when i'm click currency conversion button. all the values are displaying in 0's.

Br,

Bharat

Read only

0 Likes
1,544

erm, well most obviously there is something not working as intended in your coding. Tho we cant approve that or pinpoint the part of coding which **** up unless we see the coding.

Read only

0 Likes
1,544

What he said.

As long as we don;t see your coding we can only guess: maybe you're calling the functions improperly? Maybe there's no exchange rate set up? Maybe there are but not valid? Maybe you're using the wrong currency units?

Read only

0 Likes
1,544

Hello Barat,

Could you share the code, which gets executed when you press the currency conversion button?

Read only

Former Member
0 Likes
1,544

Hi,

Call the that Function module in the LOOP.

Read only

Former Member
0 Likes
1,544

Please clarify whether it's a problem with conversion. Check the internal table in debugging mode after pressing the currency conversion button to confirm the prices have been converted to the required currency.

Read only

Former Member
0 Likes
1,544

thanks