<?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: code reduction in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047967#M88459</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;I think you can try using the FM Read_exchange_rate . This can be called only once to get the exchange rate for the currencies which can then be used to calculate the values of the two fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kalpana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Nov 2005 10:17:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-11-23T10:17:42Z</dc:date>
    <item>
      <title>code reduction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047963#M88455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have two fields which contains JPY currency.&lt;/P&gt;&lt;P&gt;I want to convert into USD using function module.I have coded two times for two fields.Is there any way to write one time to get currencies for two fields?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if t_bill-WAERK ne 'USD'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;for JPY&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    if t_bill-WAERK eq 'JPY'.&lt;/P&gt;&lt;P&gt;      t_bill-NETWR = t_bill-NETWR * 100.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*for netwr&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        CLIENT           = SY-MANDT&lt;/P&gt;&lt;P&gt;        DATE             = t_bill-FKDAT&lt;/P&gt;&lt;P&gt;        FOREIGN_AMOUNT   = t_bill-NETWR&lt;/P&gt;&lt;P&gt;        FOREIGN_CURRENCY = t_bill-WAERK&lt;/P&gt;&lt;P&gt;        LOCAL_CURRENCY   = 'USD'&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        LOCAL_AMOUNT     = v_bilamt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*for netpr&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        CLIENT           = SY-MANDT&lt;/P&gt;&lt;P&gt;        DATE             = t_bill-FKDAT&lt;/P&gt;&lt;P&gt;        FOREIGN_AMOUNT   = t_bill-NETPR&lt;/P&gt;&lt;P&gt;        FOREIGN_CURRENCY = t_bill-WAERK&lt;/P&gt;&lt;P&gt;        LOCAL_CURRENCY   = 'USD'&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        LOCAL_AMOUNT     = v_tp.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    v_bilamt = t_bill-netwr.&lt;/P&gt;&lt;P&gt;    v_tp = t_bill-netpr.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points guaranteed&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;kaki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2005 09:55:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047963#M88455</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-23T09:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: code reduction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047964#M88456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Pass your currency in an itab then use the below code.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt; Call the FM.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2005 09:57:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047964#M88456</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2005-11-23T09:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: code reduction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047965#M88457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;YOu cannot reduce the number of times the FM is beign called. You can reduce the length of the code by writing a Perform for the function call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perfrom Change_currency using t_bill-NETWR t_bill-waerk&lt;/P&gt;&lt;P&gt;                        changing v_bilamt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perfrom Change_currency using t_bill-NETpr t_bill-waerk&lt;/P&gt;&lt;P&gt;                        changing v_tp.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2005 10:04:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047965#M88457</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-23T10:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: code reduction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047966#M88458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;if t_bill-WAERK ne 'USD'.
* for JPY
if t_bill-WAERK eq 'JPY'.
t_bill-NETWR = t_bill-NETWR * 100.
endif.

*for netwr
perform convert_currency using t_bill-fkdat
                               t_bill-netwr
                               t_bill-waerk
                         changing v_bilamt.

*for netpr
perform convert_currency using t_bill-fkdat
                               t_bill-netpr
                               t_bill-waerk
                         changing v_tp.
else.
v_bilamt = t_bill-netwr.
v_tp = t_bill-netpr.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;form convert_currency using fkdate type sy-datum
                            price type netpr
                            waerk type waerk
                       changing val type netpr.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
DATE = fkdate
FOREIGN_AMOUNT = price
FOREIGN_CURRENCY = WAERK
LOCAL_CURRENCY = 'USD'
IMPORTING
LOCAL_AMOUNT = val.
endform.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2005 10:11:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047966#M88458</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-23T10:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: code reduction</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047967#M88459</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;I think you can try using the FM Read_exchange_rate . This can be called only once to get the exchange rate for the currencies which can then be used to calculate the values of the two fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kalpana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2005 10:17:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-reduction/m-p/1047967#M88459</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-23T10:17:42Z</dc:date>
    </item>
  </channel>
</rss>

