<?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 Array Object in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/array-object/m-p/2593618#M593934</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just created a new class(A), now I need to create another class that has an array of the class (A). How can I do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10nks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gabriel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Aug 2007 16:24:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-06T16:24:23Z</dc:date>
    <item>
      <title>Array Object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/array-object/m-p/2593618#M593934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just created a new class(A), now I need to create another class that has an array of the class (A). How can I do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10nks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gabriel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 16:24:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/array-object/m-p/2593618#M593934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T16:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Array Object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/array-object/m-p/2593619#M593935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This what you are looking for?  LCL_B is a class with an attribute which is a table of refereces of LCL_A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;


report zrich_0001.


*---------------------------------------------------------------------*
*       CLASS lcl_a  DEFINTION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_a definition.
  public section.
    data: a_attribute type string.
    methods: constructor importing im_attr type string.
endclass.

*---------------------------------------------------------------------*
*       CLASS lcl_a IMPLEMENTATION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_a implementation.
  method constructor.
    a_attribute = im_attr.
  endmethod.
endclass.

*---------------------------------------------------------------------*
*       CLASS lcl_b  DEFINTION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_b definition.

  public section.
    data: o_list type table of ref to lcl_a.
    data: o_list_line like line of o_list.
    methods: add_to_list importing im_object type ref to lcl_a,
             write_list.

endclass.

*---------------------------------------------------------------------*
*       CLASS lcl_b  DEFINTION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_b implementation..

  method add_to_list.

    o_list_line = im_object.
    append o_list_line to o_list.

  endmethod.

  method write_list.

    loop at o_list into o_list_line.
      write:/ o_list_line-&amp;gt;a_attribute.
    endloop.

  endmethod.

endclass.


start-of-selection.

data: a_obj type ref to lcl_a.
data: b_obj type ref to lcl_b.


create object b_obj.

create object a_obj
      exporting im_attr = 'This is 1 object'.
call method b_obj-&amp;gt;add_to_list( a_obj ).

create object a_obj
      exporting im_attr = 'This is 2 object'.
call method b_obj-&amp;gt;add_to_list( a_obj ).

create object a_obj
      exporting im_attr = 'This is 3 object'.
call method b_obj-&amp;gt;add_to_list( a_obj ).


call method b_obj-&amp;gt;write_list( ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 17:28:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/array-object/m-p/2593619#M593935</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-08-06T17:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Array Object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/array-object/m-p/2593620#M593936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is OK for local classes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for repository classes, as each attribute must be typed with some type from the DDIC, you have to create a table type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go to SE11, create a new data type. Popup asks what you want to create: specify "table type". Next you have to provide the row type, there you put class name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your class B, create an attribute with type corresponding to your new table type&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Sep 2007 07:55:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/array-object/m-p/2593620#M593936</guid>
      <dc:creator>franois_henrotte</dc:creator>
      <dc:date>2007-09-04T07:55:12Z</dc:date>
    </item>
  </channel>
</rss>

