<?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 ANY TABLE to class method by value in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221508#M136588</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i didnt mean type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;attribute should be instance, public, type ref to data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Mar 2006 06:53:36 GMT</pubDate>
    <dc:creator>athavanraja</dc:creator>
    <dc:date>2006-03-14T06:53:36Z</dc:date>
    <item>
      <title>Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221501#M136581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am facing a situation in which i am not able to use an internal table passed by value to a method of a class. I prefer to use pass-by-value in the constructor when i create the class , but I am not able to store the table in the class object for it to be accessed by other methods of the class. If i create a DATA reference it becomes null after the contructor method ends as the variable gets destroyed. Pls help. Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 06:07:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221501#M136581</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-14T06:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221502#M136582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI anand&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you post the code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;try passing the contents of the internal table.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;kishore&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Harikishore Sreenivasulu&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 06:23:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221502#M136582</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-14T06:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221503#M136583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code in the constructor of the class which "CHANGES" parameter "it_table TYPE ANY TABLE" passed as a value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE DATA p_recordset LIKE it_table.&lt;/P&gt;&lt;P&gt;  GET REFERENCE OF it_table INTO p_recordset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_recordset is of "TYPE REF TO DATA".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The use of p_recordset-&amp;gt;* works fine in the constructor method. But becomes null in any other method in the class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem does not occur when i pass p_recordset as a reference. I understand the reason why its null but i want the "it_table" to be passed as value only. Is there any alternative??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 06:36:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221503#M136583</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-14T06:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221504#M136584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the variable p_recordset has to be declared in the attributes of the class as instance and public attribute&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 06:41:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221504#M136584</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-03-14T06:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221505#M136585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Durairaj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not allowed to declare a class attribute of "TYPE ANY TABLE".. If that could be done i wouldn't have had any problem at all...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 06:44:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221505#M136585</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-14T06:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221506#M136586</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;Declare it is a STATIC variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THanks,&lt;/P&gt;&lt;P&gt;Ramakrishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 06:47:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221506#M136586</guid>
      <dc:creator>venkata_ramisetti</dc:creator>
      <dc:date>2006-03-14T06:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221507#M136587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ramakrishna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even that would not help cuz attributes can be declared TYPE ANY TABLE be it instance or static..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further, the purpose of this global class doesnot allow the field p_recordset to be made static..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 06:51:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221507#M136587</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-14T06:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221508#M136588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i didnt mean type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;attribute should be instance, public, type ref to data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 06:53:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221508#M136588</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-03-14T06:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221509#M136589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;Dont pass the table as pass by value or pass by refrence to constructor.&lt;/P&gt;&lt;P&gt;if you decleare the table in the public section of the class the constructor will automatically recognize the internal table.&lt;/P&gt;&lt;P&gt;please refer the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class lcl_class1 definition.&lt;/P&gt;&lt;P&gt;Public section.&lt;/P&gt;&lt;P&gt;*tables mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of ty_itab,&lt;/P&gt;&lt;P&gt;matnr type mara-matnr,&lt;/P&gt;&lt;P&gt;end of ty_itab,&lt;/P&gt;&lt;P&gt;ty_i_itab type standard table of ty_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab type standard table of ty_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;methods constructor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;methods display_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class lcl_class1 implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method constructor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr from mara into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;method display_matnr.&lt;/P&gt;&lt;P&gt;data : l_itab type ty_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into l_itab.&lt;/P&gt;&lt;P&gt;write / l_itab-matnr.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : o_class1 type ref to lcl_class1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;create object o_class1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call method o_class1-&amp;gt;display_matnr.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this solves your problem.If the problem still remains,Please send me the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Anil Kumar K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 08:10:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221509#M136589</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-14T08:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221510#M136590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi anil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use it in the global class. Its not related to a dictionary table. I want to define a type and pass an internal table of that type..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 08:14:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221510#M136590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-14T08:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Pass ANY TABLE to class method by value</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221511#M136591</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;Look at this program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  zaustin_calsstest1.

*---------------------------------------------------------------------*
*       CLASS C_COUNTER DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS c_counter DEFINITION.

  PUBLIC SECTION.
    METHODS: constructor IMPORTING value(tk) TYPE REF TO data,
             print_contents.

  PRIVATE SECTION.
    DATA count TYPE i.
    DATA itabk TYPE REF TO data.

ENDCLASS.                    "C_COUNTER DEFINITION

*---------------------------------------------------------------------*
*       CLASS C_COUNTER IMPLEMENTATION
*---------------------------------------------------------------------*
CLASS c_counter IMPLEMENTATION.

  METHOD constructor.
    itabk = tk.
  ENDMETHOD.                    "CONSTRUCTOR

  METHOD print_contents.
    FIELD-SYMBOLS : &amp;lt;fs&amp;gt; TYPE ANY TABLE.
    FIELD-SYMBOLS : &amp;lt;fc&amp;gt; TYPE line.
    FIELD-SYMBOLS : &amp;lt;fk&amp;gt; TYPE ANY.
    DATA retval LIKE sy-subrc VALUE '0'.
    ASSIGN itabk-&amp;gt;* TO &amp;lt;fs&amp;gt;.
    LOOP AT &amp;lt;fs&amp;gt; ASSIGNING &amp;lt;fc&amp;gt;.
      retval = '0'.
      WHILE retval = '0'.
        ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;fc&amp;gt; TO &amp;lt;fk&amp;gt;.
        retval = sy-subrc.
        WRITE &amp;lt;fk&amp;gt;.

      ENDWHILE.
      SKIP.
    ENDLOOP.
  ENDMETHOD.                    "print_contents

ENDCLASS.                    "C_COUNTER IMPLEMENTATION
*---------------------------------------------------------------------*


DATA count  TYPE REF TO c_counter.
DATA count_value TYPE i.
DATA itab LIKE vbak OCCURS 0.
DATA ktab TYPE REF TO data.


START-OF-SELECTION.
  SELECT * INTO TABLE itab FROM vbak UP TO 5 ROWS.
  GET REFERENCE OF itab[] INTO ktab.

  CREATE OBJECT count EXPORTING tk = ktab .
  CALL METHOD count-&amp;gt;print_contents.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solves your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;austin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ps : reward points if usefull&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Mar 2006 09:45:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pass-any-table-to-class-method-by-value/m-p/1221511#M136591</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-14T09:45:30Z</dc:date>
    </item>
  </channel>
</rss>

