<?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: Types statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045590#M1351516</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;As everyone has said case 2 is the right way.&lt;/P&gt;&lt;P&gt; In Case1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES it_kunnr TYPE standard table of t_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_kunnr type t_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;these two statements are wrong.  First one rong because 'Types ' statement is used to decalre local program types, which only have a defenition and no related object in Data Base.  Data statement is used to create objects in DB of a specific type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second statement is wrong because it only creates a DB object of structure type and not table type. &lt;/P&gt;&lt;P&gt;As suggested u can use occurs 0 additions but this is obsolete and not advisable anymore. This is because occurs 0 creates a table with a header line and header line concept is obsolete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best practise is to declare the Type using TYPES statement and the decalring table of that type using  "type [STANDARD/HASHED/SORTED] table of " addition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Aug 2009 11:23:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-04T11:23:02Z</dc:date>
    <item>
      <title>Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045579#M1351505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAP Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  I have some doubt on declaring Internal tables, could you tell me which case  case1 or case 2  is correct. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Case1&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;types: begin of t_kunnr,&lt;/P&gt;&lt;P&gt;           name1(30) type c,&lt;/P&gt;&lt;P&gt;           name2(30) type c,&lt;/P&gt;&lt;P&gt;           kunnr(10) type c,&lt;/P&gt;&lt;P&gt;       end of t_kunnr.&lt;/P&gt;&lt;P&gt;TYPES it_kunnr TYPE standard table of t_kunnr.&lt;/P&gt;&lt;P&gt;DATA: wa_kunnr TYPE t_kunnr.&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;DATA: it_kunnr type t_kunnr&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_kunnr-name1 = 'KK'.&lt;/P&gt;&lt;P&gt;wa_kunnr-name2 = 'MM'.&lt;/P&gt;&lt;P&gt;wa_kunnr-kunnr = '4999'.&lt;/P&gt;&lt;P&gt;append wa_kunnr to it_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_kunnr-name1 = 'KK1'.&lt;/P&gt;&lt;P&gt;wa_kunnr-name2 = 'MM1'.&lt;/P&gt;&lt;P&gt;wa_kunnr-kunnr = '4999'.&lt;/P&gt;&lt;P&gt;append wa_kunnr to it_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_kunnr-name1 = 'KK1'.&lt;/P&gt;&lt;P&gt;wa_kunnr-name2 = 'MM1'.&lt;/P&gt;&lt;P&gt;wa_kunnr-kunnr = '3999'.&lt;/P&gt;&lt;P&gt;append wa_kunnr to it_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_kunnr into wa_kunnr.&lt;/P&gt;&lt;P&gt;  write : / wa_kunnr-name1, wa_kunnr-kunnr.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;case2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of t_kunnr,&lt;/P&gt;&lt;P&gt;           name1(30) type c,&lt;/P&gt;&lt;P&gt;           name2(30) type c,&lt;/P&gt;&lt;P&gt;           kunnr(10) type c,&lt;/P&gt;&lt;P&gt;       end of t_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: wa_kunnr TYPE t_kunnr,&lt;/P&gt;&lt;P&gt;           &lt;STRONG&gt;it_kunnr TYPE STANDARD TABLE OF t_kunnr&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_kunnr-name1 = 'KK'.&lt;/P&gt;&lt;P&gt;wa_kunnr-name2 = 'MM'.&lt;/P&gt;&lt;P&gt;wa_kunnr-kunnr = '4999'.&lt;/P&gt;&lt;P&gt;append wa_kunnr to it_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_kunnr-name1 = 'KK1'.&lt;/P&gt;&lt;P&gt;wa_kunnr-name2 = 'MM1'.&lt;/P&gt;&lt;P&gt;wa_kunnr-kunnr = '4999'.&lt;/P&gt;&lt;P&gt;append wa_kunnr to it_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_kunnr-name1 = 'KK1'.&lt;/P&gt;&lt;P&gt;wa_kunnr-name2 = 'MM1'.&lt;/P&gt;&lt;P&gt;wa_kunnr-kunnr = '3999'.&lt;/P&gt;&lt;P&gt;append wa_kunnr to it_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_kunnr into wa_kunnr.&lt;/P&gt;&lt;P&gt;  write : / wa_kunnr-name1, wa_kunnr-kunnr.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:08:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045579#M1351505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045580#M1351506</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;Your case 2 is correct. If you declare as &lt;STRONG&gt;DATA: it_kunnr type t_kunnr.&lt;/STRONG&gt; it will be considered as a work area rather than a internal table . Also clear the internal table header after appending.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
types: begin of t_kunnr,
name1(30) type c,
name2(30) type c,
kunnr(10) type c,
end of t_kunnr.

DATA: wa_kunnr TYPE t_kunnr,
it_kunnr TYPE STANDARD TABLE OF t_kunnr.

wa_kunnr-name1 = 'KK'.
wa_kunnr-name2 = 'MM'.
wa_kunnr-kunnr = '4999'.
append wa_kunnr to it_kunnr.
clear it_kunnr.

wa_kunnr-name1 = 'KK1'.
wa_kunnr-name2 = 'MM1'.
wa_kunnr-kunnr = '4999'.
append wa_kunnr to it_kunnr.
clear it_kunnr.

wa_kunnr-name1 = 'KK1'.
wa_kunnr-name2 = 'MM1'.
wa_kunnr-kunnr = '3999'.
append wa_kunnr to it_kunnr.
clear it_kunnr.

loop at it_kunnr into wa_kunnr.
write : / wa_kunnr-name1, wa_kunnr-kunnr.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:11:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045580#M1351506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045581#M1351507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;case 2 is correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:11:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045581#M1351507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045582#M1351508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;case2  is correct&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:12:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045582#M1351508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045583#M1351509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Case 2 is correct. &lt;/P&gt;&lt;P&gt;Because in case 1 , you are overriting table declartion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:12:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045583#M1351509</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045584#M1351510</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;If you need to declare Internal Tables, use DATA Statement.&lt;/P&gt;&lt;P&gt;You are declarinf Types and not Internal Tables.&lt;/P&gt;&lt;P&gt;Uou need to add OCCUR Clause to declare internal table, other wise it works like a work area only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data : begin of t_kunnr occurs 0,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;kunnr like kna1-kunnr,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;name1 like kna1-name1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;end of t_kunnr.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds,&lt;/P&gt;&lt;P&gt;Anil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:13:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045584#M1351510</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045585#M1351511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thanks for your replies,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you explain me  how case1 is correct one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:15:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045585#M1351511</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045586#M1351512</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;case 2 is correct way to declare the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Ashu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:16:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045586#M1351512</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045587#M1351513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sorry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for above reply, Could you explain me how &lt;STRONG&gt;case 2&lt;/STRONG&gt; declaration is correct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:17:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045587#M1351513</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045588#M1351514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Case 2 is suggestable&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in case1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES it_kunnr TYPE standard table of t_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this means u r declaring the structure again using TYPES. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ajay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:20:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045588#M1351514</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045589#M1351515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all your replies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:20:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045589#M1351515</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045590#M1351516</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;As everyone has said case 2 is the right way.&lt;/P&gt;&lt;P&gt; In Case1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES it_kunnr TYPE standard table of t_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_kunnr type t_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;these two statements are wrong.  First one rong because 'Types ' statement is used to decalre local program types, which only have a defenition and no related object in Data Base.  Data statement is used to create objects in DB of a specific type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second statement is wrong because it only creates a DB object of structure type and not table type. &lt;/P&gt;&lt;P&gt;As suggested u can use occurs 0 additions but this is obsolete and not advisable anymore. This is because occurs 0 creates a table with a header line and header line concept is obsolete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best practise is to declare the Type using TYPES statement and the decalring table of that type using  "type [STANDARD/HASHED/SORTED] table of " addition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:23:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045590#M1351516</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Types statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045591#M1351517</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;Case 2 is correct,  Why becuase in case 1 your creating Type it_kunnr is not treating as an internal table but you are trying to append to it.   So internal table always should be Data type only.&lt;/P&gt;&lt;P&gt;&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;Ganesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 11:40:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/types-statement/m-p/6045591#M1351517</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T11:40:19Z</dc:date>
    </item>
  </channel>
</rss>

