<?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: How to return an internal table with methods ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-return-an-internal-table-with-methods/m-p/4596354#M1083658</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to create a table type for your table GP1_PRODUCTS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use &lt;STRONG&gt;global class&lt;/STRONG&gt; (created in SE24), than:&lt;/P&gt;&lt;P&gt;Create a Table Type in SE11&lt;/P&gt;&lt;P&gt;Go to SE11, Enter a name like ZPRODUCTS in the Data Type&lt;/P&gt;&lt;P&gt;There will be popup when you press the Create button to decide a type. Select the Table Type&lt;/P&gt;&lt;P&gt;Enter  GP1_PRODUCTS  in the Line Type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* method declaration
  methods GET_PRODUCT_LIST
    returning
      value(PRODUCTS) type ZPRODUCTS.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use &lt;STRONG&gt;local class&lt;/STRONG&gt;:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: ty_products type standard table of GP1_PRODUCTS..

* method declaration
  methods GET_PRODUCT_LIST
    returning
      value(PRODUCTS) type ty_products
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Oct 2008 19:08:42 GMT</pubDate>
    <dc:creator>naimesh_patel</dc:creator>
    <dc:date>2008-10-13T19:08:42Z</dc:date>
    <item>
      <title>How to return an internal table with methods ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-return-an-internal-table-with-methods/m-p/4596353#M1083657</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 am an Java programmer and very new to ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I return a internal table with a method? I have the table GP1_PRODUCTS and want to return a copy of this table as an internal table called PRODUCTS.&lt;/P&gt;&lt;P&gt;Here is my code that does not work: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;class PRODUCTS definition
  public
  final
  create public .

public section.
*"* public components of class PRODUCTS
*"* do not include other source files here!!!

  methods GET_PRODUCT_LIST
    returning
      value(PRODUCTS) type GP1_PRODUCTS .
protected section.
*"* protected components of class PRODUCTS
*"* do not include other source files here!!!
private section.
*"* private components of class PRODUCTS
*"* do not include other source files here!!!
ENDCLASS.



CLASS PRODUCTS IMPLEMENTATION.


* &amp;lt;SIGNATURE&amp;gt;---------------------------------------------------------------------------------------+
* | Instance Public Method PRODUCTS-&amp;gt;GET_PRODUCT_LIST
* +-------------------------------------------------------------------------------------------------+
* | [&amp;lt;-()] PRODUCTS                       TYPE        GP1_PRODUCTS
* +--------------------------------------------------------------------------------------&amp;lt;/SIGNATURE&amp;gt;
method GET_PRODUCT_LIST.


 DATA: it_products TYPE STANDARD TABLE OF GP1_PRODUCTS.


 select * from GP1_PRODUCTS into table it_products.

 PRODUCTS = it_products.


endmethod.
ENDCLASS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2008 18:59:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-return-an-internal-table-with-methods/m-p/4596353#M1083657</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-13T18:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to return an internal table with methods ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-return-an-internal-table-with-methods/m-p/4596354#M1083658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to create a table type for your table GP1_PRODUCTS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use &lt;STRONG&gt;global class&lt;/STRONG&gt; (created in SE24), than:&lt;/P&gt;&lt;P&gt;Create a Table Type in SE11&lt;/P&gt;&lt;P&gt;Go to SE11, Enter a name like ZPRODUCTS in the Data Type&lt;/P&gt;&lt;P&gt;There will be popup when you press the Create button to decide a type. Select the Table Type&lt;/P&gt;&lt;P&gt;Enter  GP1_PRODUCTS  in the Line Type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* method declaration
  methods GET_PRODUCT_LIST
    returning
      value(PRODUCTS) type ZPRODUCTS.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use &lt;STRONG&gt;local class&lt;/STRONG&gt;:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: ty_products type standard table of GP1_PRODUCTS..

* method declaration
  methods GET_PRODUCT_LIST
    returning
      value(PRODUCTS) type ty_products
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2008 19:08:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-return-an-internal-table-with-methods/m-p/4596354#M1083658</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2008-10-13T19:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to return an internal table with methods ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-return-an-internal-table-with-methods/m-p/4596355#M1083659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, that works fine!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2008 19:25:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-return-an-internal-table-with-methods/m-p/4596355#M1083659</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-13T19:25:03Z</dc:date>
    </item>
  </channel>
</rss>

