<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic CALL FUNCTION 'READ_EXCHANGE_RATE' in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-read-exchange-rate/m-p/2911772#M685174</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;What does this function do?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Oct 2007 08:44:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-18T08:44:52Z</dc:date>
    <item>
      <title>CALL FUNCTION 'READ_EXCHANGE_RATE'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-read-exchange-rate/m-p/2911772#M685174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;What does this function do?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2007 08:44:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-read-exchange-rate/m-p/2911772#M685174</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-18T08:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: CALL FUNCTION 'READ_EXCHANGE_RATE'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-read-exchange-rate/m-p/2911773#M685175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;directly us this FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: t_er        TYPE tcurr-ukurs,&lt;/P&gt;&lt;P&gt;        t_ff        TYPE tcurr-ffact,&lt;/P&gt;&lt;P&gt;        t_lf        TYPE tcurr-tfact,&lt;/P&gt;&lt;P&gt;        t_vfd       TYPE datum,&lt;/P&gt;&lt;P&gt;        ld_erate(12)   TYPE c.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'READ_EXCHANGE_RATE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      CLIENT                  = SY-MANDT&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      date                    = p_date&lt;/P&gt;&lt;P&gt;      foreign_currency        = p_fcurr&lt;/P&gt;&lt;P&gt;      local_currency          = p_tcurr&lt;/P&gt;&lt;P&gt;      TYPE_OF_RATE            = 'M'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      EXACT_DATE              = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   IMPORTING&lt;/P&gt;&lt;P&gt;      exchange_rate           = t_er&lt;/P&gt;&lt;P&gt;      foreign_factor          = t_ff&lt;/P&gt;&lt;P&gt;      local_factor            = t_lf&lt;/P&gt;&lt;P&gt;      valid_from_date         = t_vfd&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      DERIVED_RATE_TYPE       =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      FIXED_RATE              =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      OLDEST_RATE_FROM        =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   EXCEPTIONS&lt;/P&gt;&lt;P&gt;     no_rate_found           = 1&lt;/P&gt;&lt;P&gt;     no_factors_found        = 2&lt;/P&gt;&lt;P&gt;     no_spread_found         = 3&lt;/P&gt;&lt;P&gt;     derived_2_times         = 4&lt;/P&gt;&lt;P&gt;     overflow                = 5&lt;/P&gt;&lt;P&gt;     zero_rate               = 6&lt;/P&gt;&lt;P&gt;     OTHERS                  = 7&lt;/P&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please give me reward points..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2007 08:47:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-read-exchange-rate/m-p/2911773#M685175</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-18T08:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: CALL FUNCTION 'READ_EXCHANGE_RATE'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-read-exchange-rate/m-p/2911774#M685176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Currency Convertion (i.e. from EUR to GBP)&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: gd_fcurr TYPE tcurr-fcurr,&lt;/P&gt;&lt;P&gt;gd_tcurr TYPE tcurr-tcurr,&lt;/P&gt;&lt;P&gt;gd_date TYPE sy-datum,&lt;/P&gt;&lt;P&gt;gd_value TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gd_fcurr = 'EUR'.&lt;/P&gt;&lt;P&gt;gd_tcurr = 'GBP'.&lt;/P&gt;&lt;P&gt;gd_date = sy-datum.&lt;/P&gt;&lt;P&gt;gd_value = 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM currency_conversion USING gd_fcurr&lt;/P&gt;&lt;P&gt;gd_tcurr&lt;/P&gt;&lt;P&gt;gd_date&lt;/P&gt;&lt;P&gt;CHANGING gd_value.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Convert value to Currency value &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form currency_conversion&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;P_GD_FCURR text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*--&amp;gt;P_GD_TCURR text&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;--&amp;gt;P_GD_DATE text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;&amp;lt;--P_GD_VALUE text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM currency_conversion USING p_fcurr&lt;/P&gt;&lt;P&gt;p_tcurr&lt;/P&gt;&lt;P&gt;p_date&lt;/P&gt;&lt;P&gt;CHANGING p_value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: t_er TYPE tcurr-ukurs,&lt;/P&gt;&lt;P&gt;t_ff TYPE tcurr-ffact,&lt;/P&gt;&lt;P&gt;t_lf TYPE tcurr-tfact,&lt;/P&gt;&lt;P&gt;t_vfd TYPE datum,&lt;/P&gt;&lt;P&gt;ld_erate(12) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'READ_EXCHANGE_RATE'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;CLIENT = SY-MANDT&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;date = p_date&lt;/P&gt;&lt;P&gt;foreign_currency = p_fcurr&lt;/P&gt;&lt;P&gt;local_currency = p_tcurr&lt;/P&gt;&lt;P&gt;TYPE_OF_RATE&lt;/P&gt;&lt;P&gt;= 'M'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXACT_DATE = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;exchange_rate = t_er&lt;/P&gt;&lt;P&gt;foreign_factor = t_ff&lt;/P&gt;&lt;P&gt;local_factor = t_lf&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;valid_from_date = t_vfd&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;DERIVED_RATE_TYPE&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;=&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;FIXED_RATE&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;=&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;OLDEST_RATE_FROM &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no_rate_found = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no_factors_found = 2&lt;/P&gt;&lt;P&gt;no_spread_found&lt;/P&gt;&lt;P&gt;= 3&lt;/P&gt;&lt;P&gt;derived_2_times&lt;/P&gt;&lt;P&gt;= 4&lt;/P&gt;&lt;P&gt;overflow = 5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zero_rate = 6&lt;/P&gt;&lt;P&gt;OTHERS = 7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ld_erate = t_er / ( t_ff / t_lf ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_value = p_value * ld_erate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDFORM. " currency_conversion&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FWOS_CURRENCY_DECIMALS_READ &lt;/P&gt;&lt;P&gt;CONVERT_TO_LOCAL_CURRENCY &lt;/P&gt;&lt;P&gt;CONVERT_TO_FOREIGN_CURRENCY &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the currency amounts are stored in SAP tables as CURR(n,2) (the same as DEC(n,2)). So before any arithmetic operation value should be adjusted using the real decimals number for the given currency (stored in TCURX). &lt;/P&gt;&lt;P&gt;Conversion Rates by type and date are stored in TCURR (+factors). Standard type is M. Date is stored in inverted format (the most recent date has the numerically smallest value). ABAP code to convert dates: &lt;/P&gt;&lt;P&gt;convert date p_date into inverted-date w_date. &lt;/P&gt;&lt;P&gt;convert inverted-date w_date into date p_date. &lt;/P&gt;&lt;P&gt;the only difference between CONVERT_TO_LOCAL_CURRENCY and CONVERT_TO_FOREIGN_CURRENCY seems to be the following: &lt;/P&gt;&lt;P&gt;Foreign currency is TCURR-FCURR (From Currency) &lt;/P&gt;&lt;P&gt;Local Currency is TCURR-TCURR (To Currency) &lt;/P&gt;&lt;P&gt;So result will be slightly different for the both functions (two rates stored in the TCURR: e.g. JPY-&amp;gt;USD rate is 0.00880, USD-&amp;gt;JPY rate is 122.00000). Better to use CONVERT_TO_LOCAL_CURRENCY, because multiplication is more exact operation than division. &lt;/P&gt;&lt;P&gt;Both conversion functions can return also selected rate and factors&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2007 08:54:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-read-exchange-rate/m-p/2911774#M685176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-18T08:54:14Z</dc:date>
    </item>
  </channel>
</rss>

