<?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: Table with objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238138#M1011831</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Trivenn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First a remark to your coding sample:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
my_belnr type ref to table of &amp;lt;other_calss&amp;gt; .  " Syntax incorrect -&amp;gt; guess you mean a table type of references
wa_belnr type ref to &amp;lt;other_class&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If my assumption is correct (see comment above) then you can access your instances quite easily:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
" Assumpting: the instances collected in the itab have a public key attribute BELNR.

" Recommendation: your naming conventions are a mess -&amp;gt; use better ones:

DATA: lt_account     TYPE &amp;lt;table type with line type: REF TO &amp;lt;account class&amp;gt;,
          lo_account     TYPE REF TO &amp;lt;account class&amp;gt;.

" LOOP statement:
LOOP AT lt_account INTO lo_account
                               WHERE ( table_line-&amp;gt;belnr = &amp;lt;...&amp;gt; ).
...
ENDLOOP.

" READ statement:
READ TABLE lt_account INTO lo_account
          WITH KEY table_line-&amp;gt;belnr = &amp;lt;...&amp;gt;.
...
&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>Thu, 31 Jul 2008 06:33:45 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2008-07-31T06:33:45Z</dc:date>
    <item>
      <title>Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238134#M1011827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have internla table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my_belnr type ref to table of &amp;lt;other_calss&amp;gt; .&lt;/P&gt;&lt;P&gt;wa_belnr type ref to &amp;lt;other_class&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now after i have different instances of belnr's appened in my_belnr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How is it possible to acess this my_belnr table with key?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement that i haev to &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at my_belnr into wa_belnr with key :  ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one explain me if it possible at all ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2008 05:33:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238134#M1011827</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-31T05:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238135#M1011828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;  I didn't get your question. If you are appending instances in your internal table, then what is the need of key in that table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2008 06:00:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238135#M1011828</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-31T06:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238136#M1011829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe BELNR is some kind of account number ... so it must be unique identifier...&lt;/P&gt;&lt;P&gt;(Basically there should be a unique identifierr.. lets say it is ACC_NO )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So try out this ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at my_belnr into wa_belnr where object-&amp;gt;acc_no = &amp;lt;your value&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here .. object is the field in the internal table where the object ref is stored ..&lt;/P&gt;&lt;P&gt;and Assumption is that ACC_NO is public ... so object-&amp;gt;acc_no can be accessed..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheeres&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2008 06:11:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238136#M1011829</guid>
      <dc:creator>former_member69765</dc:creator>
      <dc:date>2008-07-31T06:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238137#M1011830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tm,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;EM&gt;have a requirement that i haev to&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;loop at my_belnr into wa_belnr with key : ....&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is no such syntex we have in SAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think you need to loop then use read for reading my_belnr.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2008 06:19:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238137#M1011830</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-31T06:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238138#M1011831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Trivenn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First a remark to your coding sample:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
my_belnr type ref to table of &amp;lt;other_calss&amp;gt; .  " Syntax incorrect -&amp;gt; guess you mean a table type of references
wa_belnr type ref to &amp;lt;other_class&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If my assumption is correct (see comment above) then you can access your instances quite easily:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
" Assumpting: the instances collected in the itab have a public key attribute BELNR.

" Recommendation: your naming conventions are a mess -&amp;gt; use better ones:

DATA: lt_account     TYPE &amp;lt;table type with line type: REF TO &amp;lt;account class&amp;gt;,
          lo_account     TYPE REF TO &amp;lt;account class&amp;gt;.

" LOOP statement:
LOOP AT lt_account INTO lo_account
                               WHERE ( table_line-&amp;gt;belnr = &amp;lt;...&amp;gt; ).
...
ENDLOOP.

" READ statement:
READ TABLE lt_account INTO lo_account
          WITH KEY table_line-&amp;gt;belnr = &amp;lt;...&amp;gt;.
...
&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>Thu, 31 Jul 2008 06:33:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238138#M1011831</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-07-31T06:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238139#M1011832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Herr Schieferstein,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vielen Danke.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I apologise for not putting the code in the question properly and not correct question either. i wanted to generalize the question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;well my requirement is that i have to read the table my_belnr which is attribute of a class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can i read it like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table lt_account into lo_account with key (belnr) ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2008 07:04:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238139#M1011832</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-31T07:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238140#M1011833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Trivenn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No need to apologize for anything.&lt;/P&gt;&lt;P&gt;However, I still do not fully understand the typing and contents of your itab my_belnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps you can paste your coding. Then it should become clear.&lt;/P&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>Thu, 31 Jul 2008 07:21:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238140#M1011833</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-07-31T07:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238141#M1011834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;

method CONSTRUCTOR.

DATA: ls_record type /evuit/exch_vbel.
DATA: ls_beleg type ref to /evuit/exch_prd_vert_nn_belgv2.

   my_header = i_header.
	
	LOOP AT i_records INTO ls_Record.
	   ls_beleg = me-&amp;gt;FACTORY_BELEG( i_record  = l_record ).
	   APPEND ls_beleg TO my_belege.
	ENDLOOP.
endmethod.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
method send.

DATA: Ls_beleg type ref to /evuit/exch_prd_vert_nn_belgv2.

read table my_beleg into ls_beleg with key u_status = co_avis .


endmethod.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Trivenn Mudivar on Jul 31, 2008 10:20 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Trivenn Mudivar on Jul 31, 2008 10:21 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2008 08:18:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238141#M1011834</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-31T08:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238142#M1011835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Trivenn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The definition of my_belege is still missing yet it should be clear how it looks like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
method send.

" NOTE: Assuming that U_STATUS is a PUBLIC instance attribute you should be able to write:
 
DATA: Ls_beleg type ref to /evuit/exch_prd_vert_nn_belgv2.
&amp;lt;span style="color:red"&amp;gt;
  READ TABLE my_beleg INTO ls_beleg
    WITH KEY table_line-&amp;gt;u_status = co_avis.
&amp;lt;/span&amp;gt;
 
endmethod.

&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>Thu, 31 Jul 2008 08:22:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238142#M1011835</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-07-31T08:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Table with objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238143#M1011836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Uwe, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Now i understand that my_beleg must have public attribute u_status. and that this status must be filled by the constructor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Jul 2008 08:27:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-with-objects/m-p/4238143#M1011836</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-31T08:27:59Z</dc:date>
    </item>
  </channel>
</rss>

