<?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: creating a simple RFC - basic help guidance required in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864266#M1137332</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use Table option in FM insted of Export. &lt;/P&gt;&lt;P&gt;and append the data to table inbetween Select...Endselect to the table which you want to Export.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make the Fm as RFC.... you need to check the option Remote-Eanbled Module in FM attributes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Nov 2008 09:24:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-11-19T09:24:42Z</dc:date>
    <item>
      <title>creating a simple RFC - basic help guidance required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864262#M1137328</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;this is going to be a simple answer and I am sure there are lots of links out there but I cant find them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been asked to create an RFC that takes in data runs a query and then returns the records. In this example I have been asked to pass in a WERKS(Plant) field and then return all the associated LGORT(Stor Loc).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have done some resaech and found that the table I need is T001L but I am having trouble getting the RFC to work correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created an import field of WERKS and created a RETURN_VALUES (new structure). I have attached the simple code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However when I run this code only the last record is returned in the results. When I debug this it adds all the records to the structure but seems to be overwriting the value each time. Sure this is something to do with loops. Maybe I shouldn't be using a structure - perhaps an internal table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One more note is that this will be executed from a remote system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION Z_MDM_LU_STOR_LOCS.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(PLANT) TYPE  WERKS
*"  EXPORTING
*"     VALUE(RETURN_VALUES) LIKE  ZMDM_STORLOC STRUCTURE  ZMDM_STORLOC
*"----------------------------------------------------------------------

SELECT LGORT FROM T001L
         INTO RETURN_VALUES-LGORT
         WHERE WERKS LIKE PLANT.
ENDSELECT.

ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2008 09:12:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864262#M1137328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-19T09:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: creating a simple RFC - basic help guidance required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864263#M1137329</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;SELECT LGORT FROM T001L&lt;/P&gt;&lt;P&gt;         INTO RETURN_VALUES-LGORT&lt;/P&gt;&lt;P&gt;         WHERE WERKS LIKE PLANT.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are correct .. you have to use internal table to get multiple records..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select LGORT from T001L into table RETURN_VALUES where WERKS = PLANT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2008 09:21:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864263#M1137329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-19T09:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: creating a simple RFC - basic help guidance required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864264#M1137330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;CODE&gt;
&amp;gt; FUNCTION Z_MDM_LU_STOR_LOCS.
&amp;gt; *"----------------------------------------------------------------------
&amp;gt; *"*"Local interface:
&amp;gt; *"  IMPORTING
&amp;gt; *"     VALUE(PLANT) TYPE  WERKS
&amp;gt; *"  EXPORTING
&amp;gt; *"     VALUE(RETURN_VALUES) LIKE  ZMDM_STORLOC STRUCTURE  ZMDM_STORLOC
&amp;gt; *"----------------------------------------------------------------------
&amp;gt; 
&amp;gt; SELECT LGORT FROM T001L
&amp;gt;          INTO RETURN_VALUES-LGORT
&amp;gt;          WHERE WERKS LIKE PLANT.
&amp;gt; ENDSELECT.
&amp;gt; 
&amp;gt; ENDFUNCTION.
&amp;gt; &lt;/CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not an RFC problem; an ABAP understanding problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT... ENDSELECT is a &lt;STRONG&gt;loop&lt;/STRONG&gt;.  So first time through the loop, return_values-lgort will be given the first value from the db.  Second time through, that's be overwritten by the second value retrieved from the db.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you've defined the exporting parameter "return_values" it is a structure, not a table.  So it will, and can, only have one value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You want SELECT INTO TABLE.  And, IIRC, for an RFC fm, you need to use the TABLES FM parameter.  Read the ABAP help for these for more details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2008 09:23:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864264#M1137330</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-11-19T09:23:45Z</dc:date>
    </item>
    <item>
      <title>Re: creating a simple RFC - basic help guidance required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864265#M1137331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are using a workarea , workarea can hold only one record thats why you have the last record.Use an internal table.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;SELECT LGORT FROM T001L&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;INTO TABLE&lt;/STRONG&gt; RETURN_VALUES-LGORT&lt;/P&gt;&lt;P&gt;         WHERE WERKS LIKE PLANT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2008 09:24:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864265#M1137331</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-19T09:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: creating a simple RFC - basic help guidance required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864266#M1137332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use Table option in FM insted of Export. &lt;/P&gt;&lt;P&gt;and append the data to table inbetween Select...Endselect to the table which you want to Export.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make the Fm as RFC.... you need to check the option Remote-Eanbled Module in FM attributes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2008 09:24:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864266#M1137332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-19T09:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: creating a simple RFC - basic help guidance required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864267#M1137333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Please change PLANT TYPE WERKS to WERKS_D.&lt;/P&gt;&lt;P&gt;and try this option&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION Z_MDM_LU_STOR_LOCS.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(PLANT) TYPE  WERKS_D&lt;/P&gt;&lt;P&gt;*"  EXPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(RETURN_VALUES) LIKE  ZMDM_STORLOC STRUCTURE  ZMDM_STORLOC&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;DATA : IT_RETURN_VALUES TYPE TABLE OF ZMDM_STORLOC STRUCTURE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REFRESH : IT_RETURN_VALUES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT LGORT INTO TABLE IT_RETURN_VALUES FROM T001L WHERE WERKS = PLANT.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;RETURN_VALUES[] =  IT_RETURN_VALUES[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Madhan D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2008 09:32:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864267#M1137333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-19T09:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: creating a simple RFC - basic help guidance required</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864268#M1137334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Final code was&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION Z_MDM_LU_STOR_LOCS.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(PLANT) TYPE  WERKS_D&lt;/P&gt;&lt;P&gt;*"  TABLES&lt;/P&gt;&lt;P&gt;*"      RETURN_VALUES STRUCTURE  ZMDM_STORLOC&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT LGORT LGOBE FROM T001L&lt;/P&gt;&lt;P&gt;                   INTO TABLE RETURN_VALUES&lt;/P&gt;&lt;P&gt;                   WHERE WERKS = PLANT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks people &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2008 09:57:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-a-simple-rfc-basic-help-guidance-required/m-p/4864268#M1137334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-19T09:57:39Z</dc:date>
    </item>
  </channel>
</rss>

