<?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 Re: Currency Conversion in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137282#M113499</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While displaying use :&lt;/P&gt;&lt;P&gt;Write : &amp;lt;b&amp;gt;p_amt1 currency p_curr1&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: w_dec1 like tcurx-currdec,
w_amt like ekpo-netwr,
w_rate like tcurr-ukurs,
w_fact1 like tcurr-ffact,
w_fact2 like tcurr-ffact.
 
 
parameters:
p_curr1 like tcurc-waers default 'USD',
p_amt1 like ekpo-netwr default '100',
p_curr2 like tcurc-waers default 'JPY',
pdate like sy-datum default sy-datum.
 
end-of-selection.
  write:
  / 'Entered:',
  / ' from currency:', p_amt1 currency p_curr1, p_curr1, '&amp;lt;-', p_amt1,
  / ' to currency :', p_curr2,
  / ' on :', pdate.
  CALL FUNCTION 'FWOS_CURRENCY_DECIMALS_READ'
    EXPORTING
      I_CURRENCY         = p_curr1
    IMPORTING
      E_DECIMALS         = w_dec1
    EXCEPTIONS
      I_CURRENCY_INITIAL = 1
      OTHERS             = 2.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    w_dec1 = 2.
  ENDIF.
  p_amt1 = p_amt1 * 10 ** ( w_dec1 - 2 ).
  write:
  / 'after adjusting using currency decimals:',
  / ' from currency', p_amt1 currency p_curr1, p_curr1,
  '&amp;lt;-', p_amt1, '(', w_dec1, ')'.
 
  CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
  EXPORTING
* CLIENT = SY-MANDT
  DATE = pdate
  FOREIGN_CURRENCY = p_curr2
  LOCAL_AMOUNT = p_amt1
  LOCAL_CURRENCY = p_curr1
* RATE = 0
* TYPE_OF_RATE = 'M'
* READ_TCURR = 'X'
  IMPORTING
  EXCHANGE_RATE = w_rate
  FOREIGN_AMOUNT = w_amt
  FOREIGN_FACTOR = w_fact1
  LOCAL_FACTOR = w_fact2
* EXCHANGE_RATEX =
* DERIVED_RATE_TYPE =
* FIXED_RATE =
  EXCEPTIONS
  NO_RATE_FOUND = 1
  OVERFLOW = 2
  NO_FACTORS_FOUND = 3
  NO_SPREAD_FOUND = 4
  DERIVED_2_TIMES = 5
  OTHERS = 6.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    write: / 'Conversion to for.curr. failed:',
    p_curr1, '-&amp;gt;', p_curr2, 'err.code=', sy-subrc.
  ELSE.
    write: / 'to For.curr:', p_amt1 currency p_curr1, p_curr1, '-&amp;gt;',
    w_amt currency p_curr2, p_curr2,
    '(', w_rate, ')', w_fact1, w_fact2.
  ENDIF.
 
  CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
  EXPORTING
* CLIENT = SY-MANDT
  DATE = pdate
  FOREIGN_AMOUNT = p_amt1
  FOREIGN_CURRENCY = p_curr1
  LOCAL_CURRENCY = p_curr2
* RATE = 0
* TYPE_OF_RATE = 'M'
* READ_TCURR = 'X'
  IMPORTING
  EXCHANGE_RATE = w_rate
  FOREIGN_FACTOR = w_fact1
  LOCAL_AMOUNT = w_amt
  LOCAL_FACTOR = w_fact2
* EXCHANGE_RATEX =
* FIXED_RATE =
* DERIVED_RATE_TYPE =
  EXCEPTIONS
  NO_RATE_FOUND = 1
  OVERFLOW = 2
  NO_FACTORS_FOUND = 3
  NO_SPREAD_FOUND = 4
  DERIVED_2_TIMES = 5
  OTHERS = 6.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    write: / 'Conversion to loc.curr. failed:',
    p_curr1, '-&amp;gt;', p_curr2, 'err.code=', sy-subrc.
  ELSE.
    write: / 'to Loc.curr:', p_amt1 currency p_curr1, p_curr1, '-&amp;gt;',
    w_amt currency p_curr2, p_curr2,
    '(', w_rate, ')', w_fact1, w_fact2.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Feb 2006 10:40:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-02-24T10:40:44Z</dc:date>
    <item>
      <title>Currency Conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137279#M113496</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;I'm displaying a currency field amount,&lt;/P&gt;&lt;P&gt;In display the field amount is showing as 900,&lt;/P&gt;&lt;P&gt;where as internally when i use the same field for division it's value is being considered as 9.0 &amp;amp; hence getting some wrong values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to over come this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raghavendra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2006 10:33:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137279#M113496</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-24T10:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Currency Conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137280#M113497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for few countries the database stores the fields which out considering the decimnal amounts.it might be reason.&lt;/P&gt;&lt;P&gt;or otherwise just see that field in debugging before it gets displayed because the code may be in such a way that it removes the decimal point before outputting&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2006 10:34:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137280#M113497</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-24T10:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Currency Conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137281#M113498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;there might problem with system (decimal notation)&lt;/P&gt;&lt;P&gt;check in sytem--&amp;gt;owndata&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2006 10:38:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137281#M113498</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-24T10:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Currency Conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137282#M113499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While displaying use :&lt;/P&gt;&lt;P&gt;Write : &amp;lt;b&amp;gt;p_amt1 currency p_curr1&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: w_dec1 like tcurx-currdec,
w_amt like ekpo-netwr,
w_rate like tcurr-ukurs,
w_fact1 like tcurr-ffact,
w_fact2 like tcurr-ffact.
 
 
parameters:
p_curr1 like tcurc-waers default 'USD',
p_amt1 like ekpo-netwr default '100',
p_curr2 like tcurc-waers default 'JPY',
pdate like sy-datum default sy-datum.
 
end-of-selection.
  write:
  / 'Entered:',
  / ' from currency:', p_amt1 currency p_curr1, p_curr1, '&amp;lt;-', p_amt1,
  / ' to currency :', p_curr2,
  / ' on :', pdate.
  CALL FUNCTION 'FWOS_CURRENCY_DECIMALS_READ'
    EXPORTING
      I_CURRENCY         = p_curr1
    IMPORTING
      E_DECIMALS         = w_dec1
    EXCEPTIONS
      I_CURRENCY_INITIAL = 1
      OTHERS             = 2.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    w_dec1 = 2.
  ENDIF.
  p_amt1 = p_amt1 * 10 ** ( w_dec1 - 2 ).
  write:
  / 'after adjusting using currency decimals:',
  / ' from currency', p_amt1 currency p_curr1, p_curr1,
  '&amp;lt;-', p_amt1, '(', w_dec1, ')'.
 
  CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
  EXPORTING
* CLIENT = SY-MANDT
  DATE = pdate
  FOREIGN_CURRENCY = p_curr2
  LOCAL_AMOUNT = p_amt1
  LOCAL_CURRENCY = p_curr1
* RATE = 0
* TYPE_OF_RATE = 'M'
* READ_TCURR = 'X'
  IMPORTING
  EXCHANGE_RATE = w_rate
  FOREIGN_AMOUNT = w_amt
  FOREIGN_FACTOR = w_fact1
  LOCAL_FACTOR = w_fact2
* EXCHANGE_RATEX =
* DERIVED_RATE_TYPE =
* FIXED_RATE =
  EXCEPTIONS
  NO_RATE_FOUND = 1
  OVERFLOW = 2
  NO_FACTORS_FOUND = 3
  NO_SPREAD_FOUND = 4
  DERIVED_2_TIMES = 5
  OTHERS = 6.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    write: / 'Conversion to for.curr. failed:',
    p_curr1, '-&amp;gt;', p_curr2, 'err.code=', sy-subrc.
  ELSE.
    write: / 'to For.curr:', p_amt1 currency p_curr1, p_curr1, '-&amp;gt;',
    w_amt currency p_curr2, p_curr2,
    '(', w_rate, ')', w_fact1, w_fact2.
  ENDIF.
 
  CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
  EXPORTING
* CLIENT = SY-MANDT
  DATE = pdate
  FOREIGN_AMOUNT = p_amt1
  FOREIGN_CURRENCY = p_curr1
  LOCAL_CURRENCY = p_curr2
* RATE = 0
* TYPE_OF_RATE = 'M'
* READ_TCURR = 'X'
  IMPORTING
  EXCHANGE_RATE = w_rate
  FOREIGN_FACTOR = w_fact1
  LOCAL_AMOUNT = w_amt
  LOCAL_FACTOR = w_fact2
* EXCHANGE_RATEX =
* FIXED_RATE =
* DERIVED_RATE_TYPE =
  EXCEPTIONS
  NO_RATE_FOUND = 1
  OVERFLOW = 2
  NO_FACTORS_FOUND = 3
  NO_SPREAD_FOUND = 4
  DERIVED_2_TIMES = 5
  OTHERS = 6.
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    write: / 'Conversion to loc.curr. failed:',
    p_curr1, '-&amp;gt;', p_curr2, 'err.code=', sy-subrc.
  ELSE.
    write: / 'to Loc.curr:', p_amt1 currency p_curr1, p_curr1, '-&amp;gt;',
    w_amt currency p_curr2, p_curr2,
    '(', w_rate, ')', w_fact1, w_fact2.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2006 10:40:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137282#M113499</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-24T10:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Currency Conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137283#M113500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currencies like JAPANIES, KORIEN there will be no Decimals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use you code like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab.&lt;/P&gt;&lt;P&gt;    read table bkpf_it with key&lt;/P&gt;&lt;P&gt;           bukrs = itab-bukrs&lt;/P&gt;&lt;P&gt;           belnr = itab-belnr&lt;/P&gt;&lt;P&gt;           gjahr = itab-gjahr binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write:/ itab-dwrbtr currency bkpf_it-waers,&lt;/P&gt;&lt;P&gt;        itab-cwrbtr currency bkpf_it-waers.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above code shows the sample code which will take care of the decimal part along with currencies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;If this helps you reward with points.&lt;/P&gt;&lt;P&gt;If the issue is solved close the thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: KDeepak&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2006 10:58:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137283#M113500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-24T10:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Currency Conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137284#M113501</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;I used the bapi,  BAPI_CURRENCY_CONV_TO_EXTERNAL to convert from currency format to internal one &amp;amp; later made use of the returned value for calculations &amp;amp; now the problem is solved,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all your responses&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raghavendra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2006 11:09:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/currency-conversion/m-p/1137284#M113501</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-24T11:09:56Z</dc:date>
    </item>
  </channel>
</rss>

