<?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 Newbie Question - How to Return a Table Structure from a Function in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266971#M1018166</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have defined a table structure ni the Data Dictionary, and would like to create a function which returns "TABLE OF my_structure".  How do I do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Walter (ABAP newbie)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Aug 2008 11:16:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-07T11:16:36Z</dc:date>
    <item>
      <title>Newbie Question - How to Return a Table Structure from a Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266971#M1018166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have defined a table structure ni the Data Dictionary, and would like to create a function which returns "TABLE OF my_structure".  How do I do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Walter (ABAP newbie)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 11:16:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266971#M1018166</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-07T11:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Question - How to Return a Table Structure from a Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266972#M1018167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try FM 'GET_FIELDTAB'&lt;/P&gt;&lt;P&gt;REPORT ZEXAMPLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF FIELDINFO OCCURS  0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        INCLUDE STRUCTURE DFIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: END OF FIELDINFO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS TABNAME LIKE  SUBDFIES-TABNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GET_FIELDTAB'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          TABNAME             = TABNAME&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          FIELDTAB            = FIELDINFO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     EXCEPTIONS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          INTERNAL_ERROR      = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          NO_TEXTS_FOUND      = 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          TABLE_HAS_NO_FIELDS = 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          TABLE_NOT_ACTIV     = 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          OTHERS              = 5.&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;  WRITE:/ 'Structure of', TABNAME,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        / 'Field Name', 20 'Field Type', 40 'Field Size'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ULINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT FIELDINFO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   WRITE:/ FIELDINFO-FIELDNAME, 20 FIELDINFO-INTTYPE, 40 FIELDINFO-LENG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE:/ 'Error retrieving field data'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 11:22:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266972#M1018167</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-07T11:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Question - How to Return a Table Structure from a Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266973#M1018168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joyjit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your quick response, but there is something I don't understand.  When I create a new function, I have options of adding parameters of type "importing", "exporting", or "return". I do not see a parameter of type "table" - so I don't understand how you use the "TABLE" parameter in your example code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please explain further?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Walter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 11:36:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266973#M1018168</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-07T11:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Question - How to Return a Table Structure from a Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266974#M1018169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think u r creating a function module..right? in SE37 goto import tab and define the TABNAME field like:&lt;/P&gt;&lt;P&gt;TABNAME LIKE SUBDFIES-TABNAME&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then goto Tables tab and define the table FIELDINFO.&lt;/P&gt;&lt;P&gt;Ans in Source code section call the FM&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GET_FIELDTAB'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABNAME = TABNAME&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELDTAB = FIELDINFO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTERNAL_ERROR = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NO_TEXTS_FOUND = 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLE_HAS_NO_FIELDS = 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLE_NOT_ACTIV = 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OTHERS = 5.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 11:42:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266974#M1018169</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-07T11:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Question - How to Return a Table Structure from a Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266975#M1018170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To clarify - this is not part of a function module, I have created a class, and want to add a function to the class which returns a table of something. I want to create the table inside the function, and pass it to the calling code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Aug 2008 11:48:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/newbie-question-how-to-return-a-table-structure-from-a-function/m-p/4266975#M1018170</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-07T11:48:09Z</dc:date>
    </item>
  </channel>
</rss>

