<?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: Call Function using DESTINATION in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235674#M1525474</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use variable instead of hard coded string with type rfcdest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Oct 2010 01:32:20 GMT</pubDate>
    <dc:creator>mvoros</dc:creator>
    <dc:date>2010-10-01T01:32:20Z</dc:date>
    <item>
      <title>Call Function using DESTINATION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235673#M1525473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Abapers, I'm needing some help here with RFCs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My destinations (SM59):&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="Courier" __jive_macro_name="font"&gt;ERP_100
ERP_120
ERP_130

PI_200
PI_300&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to call a function in PI from ERP. I'm doing in this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'pi_function_module' DESTINATION 'PI_200' ...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's working. But the destination can not be hard coded. With the program in ERP_100 (DEV) and ERP_120 (QAS) the destination is PI_200 (PI DEV) and with the program in ERP_130 (PRD) the destination is PI_300 (PI PRD).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I handle this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Charles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 00:56:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235673#M1525473</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-01T00:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Call Function using DESTINATION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235674#M1525474</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use variable instead of hard coded string with type rfcdest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 01:32:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235674#M1525474</guid>
      <dc:creator>mvoros</dc:creator>
      <dc:date>2010-10-01T01:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Call Function using DESTINATION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235675#M1525475</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Martin, I know I need to use a variable of the type rfcdest-rfcdest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the problem is to get the value automatically. I was thinking of something to bring me that value, maybe a function that returns the destination for the actual environment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for try to help. If you have any other idea let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Charles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 01:49:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235675#M1525475</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-01T01:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Call Function using DESTINATION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235676#M1525476</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;it depends on your logic. For example you can create a custom table where you will store correct RFC destination. You will have to maintain it in each system. Another approach could be to derive RFC destination from system ID. Something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
IF sy-sysid EQ 'PRD'.
  dest = 'XXX'.
ELSE.
  dest = 'YYY'.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously, a solution with table is more flexible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 02:13:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235676#M1525476</guid>
      <dc:creator>mvoros</dc:creator>
      <dc:date>2010-10-01T02:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Call Function using DESTINATION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235677#M1525477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Charles,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer [this|&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5281135"&gt;&lt;/A&gt;; thread. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I quote the last post by Micky Oestreich - "This solely depends on the naming conventions you are using. Since the name of the RFC destination is arbitrary, there is 'no' way of determining the name of the destination."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, your design approach could either be by building a customizing table where you maintain the destination values or use a 'CASE' statement in your code before calling the remote function module....something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA:
  lv_own_system  TYPE logsys,
  lv_rfcdest     TYPE rfcdest.

CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
  IMPORTING
    own_logical_system             = lv_own_system
  EXCEPTIONS
    own_logical_system_not_defined = 1
    OTHERS                         = 2.

IF sy-subrc NE 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

CASE lv_own_system.
  WHEN 'ERP_100' or 'ERP_120'.
     lv_rfcdest = 'PI_200'.
  WHEN 'ERP_130'.
    lv_rfcdest = 'PI_300'.
  WHEN OTHERS.
      
ENDCASE.

"Now call the remote function
CALL FUNCTION 'pi_function_module' DESTINATION lv_rfcdest ...

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Sougata.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 02:17:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235677#M1525477</guid>
      <dc:creator>Sougata</dc:creator>
      <dc:date>2010-10-01T02:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Call Function using DESTINATION</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235678#M1525478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you &lt;STRONG&gt;Martin Voros&lt;/STRONG&gt; and &lt;STRONG&gt;Sougata&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was just thinking in 'custom table' but wondering a better way to do this. I'll probably go with the table solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Charles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 02:33:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-using-destination/m-p/7235678#M1525478</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-01T02:33:55Z</dc:date>
    </item>
  </channel>
</rss>

