<?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: Pass Table to Class Methods in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396422#M815547</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;have anyone of you worked with Shared Memory Object Classes ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to store the table the way you have shown, its throwing a dump exception.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Feb 2008 15:41:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-22T15:41:19Z</dc:date>
    <item>
      <title>Pass Table to Class Methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396416#M815541</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 want to pass the Standard and Hashed Table to Methods of CLass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please provide a code snippet ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently it only has string as passed by value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Class code is :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

class ZCL_SHM definition
  public
  final
  create public .

public section.

    data STRING_ATTR type STRING .

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Theses Statements does not work :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data z_Table type any table.

data z_Table type Hashed Table. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 14:38:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396416#M815541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T14:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Table to Class Methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396417#M815542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please look at this example.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CLASS: c_biker DEFINITION DEFERRED,
       c_bicycle DEFINITION DEFERRED.

*-----------------------------------------------------------------------

CLASS c_team DEFINITION.
  PUBLIC SECTION.
    TYPES: biker_ref TYPE REF TO c_biker,
           biker_ref_tab TYPE STANDARD TABLE OF biker_ref
                                       WITH DEFAULT KEY,
           BEGIN OF status_line_type,
             flag(1)  TYPE c,
             text1(5) TYPE c,
             id       TYPE i,
             text2(7) TYPE c,
             text3(6) TYPE c,
             gear     TYPE i,
             text4(7) TYPE c,
             speed    TYPE i,
           END OF status_line_type.
    CLASS-METHODS: class_constructor.
    METHODS: constructor,
             create_team,
             selection,
             execution.
  PRIVATE SECTION.
    CLASS-DATA: team_members TYPE i,
                counter TYPE i.
    DATA: id TYPE i,
          status_line TYPE status_line_type,
          status_list TYPE SORTED TABLE OF status_line_type
                           WITH UNIQUE KEY id,
          biker_tab TYPE biker_ref_tab,
          biker_selection LIKE biker_tab,
          biker LIKE LINE OF biker_tab.
    METHODS: write_list.
ENDCLASS.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Naren Someneni on Feb 22, 2008 8:43 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 14:41:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396417#M815542</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T14:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Table to Class Methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396418#M815543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i wan to define a table so that i can store that in the public attribute by calling method and passing table to it .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;????&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 14:47:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396418#M815543</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T14:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Table to Class Methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396419#M815544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understood you correctly, you want to declare a table in public section and want to populate it in a method of that class?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 15:02:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396419#M815544</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T15:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Table to Class Methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396420#M815545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes. because other programs will send the table to the method of that class as a parameter and then this method will update its instance of table type that is declared in class definition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 15:04:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396420#M815545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T15:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Table to Class Methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396421#M815546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can't use generic types in the way you want to.  But there's a way round - pass references.  So in your class, you want an attribute to be a table that can be any kind of table and any structure.  What you do is instead have a class attribute my_table_ref TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you need to work out how to set the class attribute my_table_ref.  One way is to use a setter method, like SET_TABLE_REF, which has one importing parameter i_ref TYPE REF TO DATA.  Body is me-&amp;gt;my_table_ref = i_ref.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the program using the class, assuming you've defined a table somewhere "t_my_table", you can set the attribute like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: io TYPE REF TO myclass.
...
GET REFERENCE OF t_my_table INTO io-&amp;gt;my_table_ref.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you want to access the table within the class, you dereference to a field-symbol in the method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;my_table&amp;gt; TYPE ANY TABLE.
ASSIGN my_table_ref-&amp;gt;* TO &amp;lt;my_table&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then access &amp;lt;my_table&amp;gt; as you would any other dynamic table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;( Note - you can use generic table as IMPORTING and EXPORTING parameters of method.  Just not as attributes or RETURNING parameters - for those, you just need to pass the reference instead ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 15:14:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396421#M815546</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-02-22T15:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Table to Class Methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396422#M815547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;have anyone of you worked with Shared Memory Object Classes ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to store the table the way you have shown, its throwing a dump exception.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 15:41:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396422#M815547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T15:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Pass Table to Class Methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396423#M815548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seeing as you've said this question is answered, it's probably better to post a new one.  And give details of precisely what the dump is... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 17:20:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-table-to-class-methods/m-p/3396423#M815548</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-02-22T17:20:46Z</dc:date>
    </item>
  </channel>
</rss>

