<?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: Type ANY in Class Attribute in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682412#M1291563</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Murali&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One possible workaround would be to use a DATA object instead of the untyped TABLE parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
" Example: Class attribute (e.g. MDO_DATA) is used for reading

" Fill the attribute within one of your class methods:
METHOD xyz.
  ...
  GET REFERENCE OF lt_knb1 INTO me-&amp;gt;mdo_data.
ENDMETHOD.


" Read the class attribute:
FIELD-SYMBOLS:
  &amp;lt;lt_itab&amp;gt;      TYPE TABLE.

  ASSIGN go_myclass-&amp;gt;mdo_data-&amp;gt;* TO &amp;lt;lt_itab&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same way can be used the other way around to fill the class attribute:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:
  lt_knb1   TYPE STANDARD TABLE OF knb1.

  SELECT * FROM knb1 INTO TABLE lt_knb1.

  GET REFERENCE OF lt_knb1 INTO go_myclass-&amp;gt;mdo_data.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 May 2009 07:44:23 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2009-05-25T07:44:23Z</dc:date>
    <item>
      <title>Type ANY in Class Attribute</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682409#M1291560</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;SAP doesnt allow me to declare a class attribute with Type - STANDARD TABLE or ANY TABLE. However, it allows me to use them in the parameters of their methods. Is there any work around to achieve this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Murali.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 06:21:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682409#M1291560</guid>
      <dc:creator>Murali_Shanmu</dc:creator>
      <dc:date>2009-05-25T06:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Type ANY in Class Attribute</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682410#M1291561</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;SAP doesnot allow generic types for attributes of classes is because these attributes will be used in the methods of the classes and it would not give a clear picture to the methods of which type they are referring to....&lt;/P&gt;&lt;P&gt;Using generic types as an attribute leads to confusion, so the best way to use generic type is to pass them using the parameters of the methods rather than declaring them as an attribute of the class....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 07:26:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682410#M1291561</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T07:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Type ANY in Class Attribute</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682411#M1291562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create an attribute of type REF TO DATA.  eg. &lt;STRONG&gt;p_anything&lt;/STRONG&gt; TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can have a method which takes an &lt;STRONG&gt;importing&lt;/STRONG&gt; parameter (&lt;STRONG&gt;changing&lt;/STRONG&gt; if you're going to change it) of TYPE ANY.  e.g. &lt;STRONG&gt;i_something&lt;/STRONG&gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the method &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;GET REFERENCE OF i_something INTO me-&amp;gt;p_anything.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now, in another method if you need to do something with the data, use &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;l_something&amp;gt; TYPE ANY.

ASSIGN me-&amp;gt;p_anything-&amp;gt;* TO &amp;lt;l_something&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field symbol &lt;STRONG&gt;&amp;lt;l_something&amp;gt;&lt;/STRONG&gt; contains the same data as what was in &lt;STRONG&gt;i_something&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use this technique frequently.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 07:41:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682411#M1291562</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-05-25T07:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Type ANY in Class Attribute</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682412#M1291563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Murali&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One possible workaround would be to use a DATA object instead of the untyped TABLE parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
" Example: Class attribute (e.g. MDO_DATA) is used for reading

" Fill the attribute within one of your class methods:
METHOD xyz.
  ...
  GET REFERENCE OF lt_knb1 INTO me-&amp;gt;mdo_data.
ENDMETHOD.


" Read the class attribute:
FIELD-SYMBOLS:
  &amp;lt;lt_itab&amp;gt;      TYPE TABLE.

  ASSIGN go_myclass-&amp;gt;mdo_data-&amp;gt;* TO &amp;lt;lt_itab&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same way can be used the other way around to fill the class attribute:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:
  lt_knb1   TYPE STANDARD TABLE OF knb1.

  SELECT * FROM knb1 INTO TABLE lt_knb1.

  GET REFERENCE OF lt_knb1 INTO go_myclass-&amp;gt;mdo_data.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 07:44:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682412#M1291563</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2009-05-25T07:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: Type ANY in Class Attribute</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682413#M1291564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 10:18:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682413#M1291564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-25T10:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Type ANY in Class Attribute</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682414#M1291565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot people.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2009 06:06:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682414#M1291565</guid>
      <dc:creator>Murali_Shanmu</dc:creator>
      <dc:date>2009-05-28T06:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Type ANY in Class Attribute</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682415#M1291566</link>
      <description>&lt;P&gt;This worked for me. First create class attribute with TYPE REF TO DATA (in our case attribute name is &lt;STRONG&gt;mp_test&lt;/STRONG&gt; ).&lt;/P&gt;&lt;P&gt;Then in setter method do this (parameter it_table is TYPE ANY TABLE.):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS:
   &amp;lt;lt_table&amp;gt; TYPE ANY TABLE.
CREATE DATA mp_test LIKE it_table.
ASSIGN mp_test-&amp;gt;* TO &amp;lt;lt_table&amp;gt;.
IF sy-subrc = 0.
  &amp;lt;lt_table&amp;gt; = it_table.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then in anywhere else you can access &lt;STRONG&gt;mp_test &lt;/STRONG&gt;like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS:
   &amp;lt;lt_table&amp;gt; TYPE ANY TABLE.
ASSIGN me-&amp;gt;mp_test-&amp;gt;* TO &amp;lt;lt_table&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Mar 2023 12:28:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682415#M1291566</guid>
      <dc:creator>former_member1250348</dc:creator>
      <dc:date>2023-03-27T12:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Type ANY in Class Attribute</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682416#M1291567</link>
      <description>&lt;P&gt;So you are basically using dereferencing which  &lt;SPAN class="mention-scrubbed"&gt;matthew.billingham&lt;/SPAN&gt; posted in the first/best answer way back in 2009. Thanks for raising zombies!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 12:58:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any-in-class-attribute/m-p/5682416#M1291567</guid>
      <dc:creator>ChrisSolomon</dc:creator>
      <dc:date>2023-03-27T12:58:56Z</dc:date>
    </item>
  </channel>
</rss>

