<?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: How to define internal table using types in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404840#M195534</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In simple words Internal tables are used to hold data at runtime. Consider I want to print a report for Plant data for Materials , this involves two tables MARA(General Material Data) and  MARC(Plant Data for Material). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is how we proceed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I declare a structure consisting of the fields i require to display form MARA and MARC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES :  BEGIN OF tp_final,
         matnr TYPE mara-matnr,
         mtart TYPE mara-mtart,
         werks TYPE marc-werks,
         pstat TYPE marc-pstat,
         END OF tp_final.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then refering to this structure I declare an Internal Table and a work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : t_report  TYPE STANDARD TABLE OF tp_final,
             wa_report TYPE tp_fianl. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In can now fetch the data from the tables and put it into this Internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  SELECT a~matnr a~mtart b~werks b~pstat
  INTO TABLE t_report
  FROM mara AS a INNER JOIN marc AS b
         ON a~matnr = b~matnr
      WHERE a~matnr IN s_matnr. " My select option for MATNR&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i can use the data in the Internal table using &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP t_report INTO wa_report.
" Process the data in wa_report.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;READ TABLE t_report INTO wa_report WITK KEY matnr = ...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &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;Arun Sambargi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Jun 2006 06:07:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-22T06:07:05Z</dc:date>
    <item>
      <title>How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404831#M195525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi good morning,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz explain me how to define internal table using types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;venkat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 04:25:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404831#M195525</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T04:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404832#M195526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The TYPES statement introduces user-defined data types . As with standard data types, you can use them when creating data objects and when assigning types to formal parameters and field symbols. User-defined data types are an essential component of the ABAP/4 type concept . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:&lt;/P&gt;&lt;P&gt;BEGIN OF TY_MARA,&lt;/P&gt;&lt;P&gt;MATNR TYPE MARA-MATNR,&lt;/P&gt;&lt;P&gt;MTART TYPE MARA-MTART,&lt;/P&gt;&lt;P&gt;MBRSH TYPE MARA-MBRSH,&lt;/P&gt;&lt;P&gt;MATKL TYPE MARA-MATKL,&lt;/P&gt;&lt;P&gt;END OF TY_MARA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB TYPE STANDARD TABLE OF TY_MARA WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To know more about TYPES, Just see the URL.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/types.htm" target="test_blank"&gt;http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/types.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 04:28:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404832#M195526</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T04:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404833#M195527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;TYPES : begin of t_mara,&lt;/P&gt;&lt;P&gt;        matnr type matnr,&lt;/P&gt;&lt;P&gt;        end of t_mara.&lt;/P&gt;&lt;P&gt;DATA : i_mara type standard table of t_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or in case of header line&lt;/P&gt;&lt;P&gt;DATA : i_mara type standard table of t_mara with header   line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you want to define work area.&lt;/P&gt;&lt;P&gt;DATA : wa_mara type t_mara.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 04:31:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404833#M195527</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T04:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404834#M195528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;here is an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*defining table type&lt;/P&gt;&lt;P&gt;types ty_mara type standard table of mara.&lt;/P&gt;&lt;P&gt;*defining internal table based on the above type&lt;/P&gt;&lt;P&gt;data itab type ty_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think you are brand new to ABAP.&lt;/P&gt;&lt;P&gt;Plz go thru the ABAP Documentatin under the below link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com" target="test_blank"&gt;http://help.sap.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Abdul Hakim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark all useful answers..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 04:31:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404834#M195528</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2006-06-22T04:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404835#M195529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES itabtype {TYPE tabkind OF linetype| &lt;/P&gt;&lt;P&gt;                LIKE tabkind OF lineobj}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      [WITH [UNIQUE|NON-UNIQUE] keydef] [INITIAL SIZE n]. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Defines the type itabtype for an internal table without header line in a program with table type tabkind and line type linetype (if you use a TYPE reference) or the type of the referred object lineobj (if you use a LIKE reference). Internal tables without a header line consist of any number of table lines, each of which has the structure defined by the line type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may also define a table key. If you do not, the system creates a generic table type with any key. You can use generic types to specify the type of generic subroutine parameters. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The UNIQUE and NON-UNIQUE additions allow you to specify whether a table with type itabtype may contain two or more records with the same key or not. The following rules apply: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STANDARD TABLE: &lt;/P&gt;&lt;P&gt;The key is always NON-UNIQUE by default. You cannot use the UNIQUE addition with a standard table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORTED TABLE: &lt;/P&gt;&lt;P&gt;There is no default setting for sorted tables. If you do not specify UNIQUE or NON-UNIQUE, the system creates a generic table type without a particular uniqueness attribute. You can use generic types to specify the types of generic subroutine parameters. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HASHED TABLE: &lt;/P&gt;&lt;P&gt;There is no default setting for hashed tables. However, you must define a UNIQUE key. The NON-UNIQUE addition is not permitted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The optional INITIAL SIZE addition allows you to specify how much memory should be allocated to the table when you create it. This corresponds to the OCCURS specification in variant 2 (see also Performance Notes for Internal Tables). The value n is not taken into consideration in the type check. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;The following type definitions define tables using the line type STRUC and the key NAME: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF STRUC, &lt;/P&gt;&lt;P&gt;         NAME(10) TYPE C, &lt;/P&gt;&lt;P&gt;         AGE      TYPE I, &lt;/P&gt;&lt;P&gt;       END   OF STRUC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: TAB1 TYPE STANDARD TABLE OF STRUC WITH DEFAULT KEY, &lt;/P&gt;&lt;P&gt;       TAB2 TYPE SORTED   TABLE OF STRUC &lt;/P&gt;&lt;P&gt;                                WITH NON-UNIQUE KEY NAME, &lt;/P&gt;&lt;P&gt;       TAB3 TYPE HASHED   TABLE OF STRUC WITH UNIQUE KEY NAME. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unlike the above types, the following types are generic. This means that you can use them to specify the type of a generic subroutine parameter, but not to create a table object uisng the DATA statement. The only exception to this is that the system allows you to use a generic standard table type in a DATA statement - the type description is completed automatically by the system according to the rules described under DATA. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: GEN_TAB1 TYPE STANDARD TABLE OF STRUC, &lt;/P&gt;&lt;P&gt;       GEN_TAB2 TYPE SORTED   TABLE OF STRUC WITH KEY NAME, &lt;/P&gt;&lt;P&gt;       GEN_TAB3 TYPE HASHED   TABLE OF STRUC. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following example shows the definition of a sorted table using a LIKE reference to the ABAP Dictionary structure SFLIGHT: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: FLTAB LIKE SORTED TABLE OF SFLIGHT &lt;/P&gt;&lt;P&gt;                  WITH NON-UNIQUE KEY CARRID CONNID FLDATE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 04:33:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404835#M195529</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T04:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404836#M195530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&amp;gt;First decalre Types which holds all required fileds&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Declaration of type for final data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;TYPES :&lt;/P&gt;&lt;P&gt;  BEGIN OF typ_final,&lt;/P&gt;&lt;P&gt;   matnr    TYPE  matnr,       " Material number&lt;/P&gt;&lt;P&gt;   meins    TYPE  meins,       " Unit of measure&lt;/P&gt;&lt;P&gt;   ferth    TYPE  ferth,       " Production/Inspection Memo(Can Code)&lt;/P&gt;&lt;P&gt;   werks    TYPE  werks_d,     " Plant&lt;/P&gt;&lt;P&gt;   bstrf    TYPE  bstrf,       " Rounding values&lt;/P&gt;&lt;P&gt;   maktx    TYPE  maktx,       " Material description&lt;/P&gt;&lt;P&gt;   umrez    TYPE  umrez,       " Cans per case&lt;/P&gt;&lt;P&gt;   umrez1   TYPE  umrez,       " Cans per pallet&lt;/P&gt;&lt;P&gt;   bmeng    TYPE  bmeng,       " BOM base quantity&lt;/P&gt;&lt;P&gt;   stlal    TYPE  stlal,       " alterantive BOM&lt;/P&gt;&lt;P&gt;   Pack     type  KLASSE_D,    " Packing Size&lt;/P&gt;&lt;P&gt;   Make     type  KLASSE_D,    " Make&lt;/P&gt;&lt;P&gt;   flag     TYPE  char1,       " flag for error&lt;/P&gt;&lt;P&gt;  END OF typ_final,&lt;/P&gt;&lt;P&gt;--&amp;gt;Then work area &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       Work area to hold all the fields&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;     wa_final   TYPE       typ_final,&lt;/P&gt;&lt;P&gt;--&amp;gt;Then Internal Table &lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Internal table to hold all the required data fields&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;     it_final  TYPE  STANDARD TABLE OF typ_final&lt;/P&gt;&lt;P&gt;                                           INITIAL SIZE 0.&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;Sridhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 04:33:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404836#M195530</guid>
      <dc:creator>sridharreddy_kondam</dc:creator>
      <dc:date>2006-06-22T04:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404837#M195531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Venkat,&lt;/P&gt;&lt;P&gt; Please check this out :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF ty_itab,&lt;/P&gt;&lt;P&gt;       f1,&lt;/P&gt;&lt;P&gt;       f2(10),&lt;/P&gt;&lt;P&gt;       f3(10),&lt;/P&gt;&lt;P&gt;       f4(10),&lt;/P&gt;&lt;P&gt;       END OF ty_itab.&lt;/P&gt;&lt;P&gt;DATA : itab TYPE TABLE OF ty_itab WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through this ,&lt;/P&gt;&lt;P&gt;To construct a new structure type in a program, use the following chained TYPES statement: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF &amp;lt;structure&amp;gt;,&lt;/P&gt;&lt;P&gt;                ..............&lt;/P&gt;&lt;P&gt;                &amp;lt;ti&amp;gt; ..., &lt;/P&gt;&lt;P&gt;                ..............&lt;/P&gt;&lt;P&gt;       END OF &amp;lt;structure&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This chained statement creates a structure containing all of the variables between&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES BEGIN OF &amp;lt;structure&amp;gt;. a nd TYPES END OF &amp;lt;structure&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that occur in the data types defined in &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES &amp;lt;ti&amp;gt;... .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The components &amp;lt;fi&amp;gt; can be elementary types, reference types, or, if you refer to known complex types, complex themselves. TYPES BEGIN OF... TYPES END OF blocks can also be nested, so you can create deep structure types. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The individual variables within a structure type are addressed in the program with a hyphen between the structure name and component name as follows: &amp;lt;structure&amp;gt;-&amp;lt;fi&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: spfli_type TYPE spfli,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       surname(20) TYPE c,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       BEGIN OF address,&lt;/P&gt;&lt;P&gt;             name       TYPE surname,&lt;/P&gt;&lt;P&gt;             street(30) TYPE c,&lt;/P&gt;&lt;P&gt;             city       TYPE spfli_type-cityfrom,&lt;/P&gt;&lt;P&gt;       END OF address,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       town TYPE address-city.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 04:44:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404837#M195531</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T04:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404838#M195532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   Have a look at the following good links-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapgenie.com/abap/tips/itab/Internal%20Table%2027-02-06.htm#DataType" target="test_blank"&gt;http://www.sapgenie.com/abap/tips/itab/Internal%20Table%2027-02-06.htm#DataType&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm" target="test_blank"&gt;http://www.sap-img.com/abap/what-are-different-types-of-internal-tables-and-their-usage.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark the useful answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tanuja.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 05:30:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404838#M195532</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T05:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404839#M195533</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;please look at my codes below. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="--------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Structures and internal tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="--------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_iloa,&lt;/P&gt;&lt;P&gt;        tplnr LIKE iloa-tplnr,     "Functional location&lt;/P&gt;&lt;P&gt;        anlnr LIKE iloa-anlnr,     "Main asset number&lt;/P&gt;&lt;P&gt;        iloan LIKE iloa-iloan,     "Location and account assignment&lt;/P&gt;&lt;P&gt;        swerk LIKE iloa-swerk,     "Maintenance plant&lt;/P&gt;&lt;P&gt;        stort LIKE iloa-stort,     "Location of maintenance object&lt;/P&gt;&lt;P&gt;       END OF t_iloa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_t499s,&lt;/P&gt;&lt;P&gt;        werks LIKE t499s-werks,    "Plant&lt;/P&gt;&lt;P&gt;        stand LIKE t499s-stand,    "Location&lt;/P&gt;&lt;P&gt;        ktext LIKE t499s-ktext,    "Text (40 characters)&lt;/P&gt;&lt;P&gt;       END OF t_t499s.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_equz,&lt;/P&gt;&lt;P&gt;        equnr LIKE equz-equnr,     "Equipment number&lt;/P&gt;&lt;P&gt;        hequi LIKE equz-hequi,     "Superior Equipment&lt;/P&gt;&lt;P&gt;        iloan LIKE equz-iloan,     "Location and account assignment&lt;/P&gt;&lt;P&gt;        iwerk LIKE equz-iwerk,     "Maintenance Planning Plant&lt;/P&gt;&lt;P&gt;       END OF t_equz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_equz2,&lt;/P&gt;&lt;P&gt;        iwerk LIKE equz-iwerk,     "Data origin indicator&lt;/P&gt;&lt;P&gt;       END OF t_equz2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_anlc,&lt;/P&gt;&lt;P&gt;        bukrs LIKE anlc-bukrs,     "Company Code&lt;/P&gt;&lt;P&gt;        anln1 LIKE anlc-anln1,     "Main asset number&lt;/P&gt;&lt;P&gt;        anln2 LIKE anlc-anln2,     "Asset sub-number&lt;/P&gt;&lt;P&gt;        gjahr LIKE anlc-gjahr,     "Fiscal year&lt;/P&gt;&lt;P&gt;        afabe LIKE anlc-afabe,     "Real depreciation area&lt;/P&gt;&lt;P&gt;        kansw LIKE anlc-kansw,     "Cumulative acquisition&lt;/P&gt;&lt;P&gt;        knafa LIKE anlc-knafa,     "Accumulated ordinary depreciation&lt;/P&gt;&lt;P&gt;        kaafa LIKE anlc-kaafa,     "Cumulative unplanned depreciation&lt;/P&gt;&lt;P&gt;        answl LIKE anlc-answl,     "Transactions for the year&lt;/P&gt;&lt;P&gt;        nafav LIKE anlc-nafav,     "Proportional accumulated&lt;/P&gt;&lt;P&gt;        nafag LIKE anlc-nafag,     "Ordinary dep. posted in the cur.year&lt;/P&gt;&lt;P&gt;        nafal LIKE anlc-nafal,     "Proportional ordinary depreciation&lt;/P&gt;&lt;P&gt;        aafav LIKE anlc-aafav,     "cumulative unplanned depreciation&lt;/P&gt;&lt;P&gt;        aafag LIKE anlc-aafag,     "Unplanned depr. posted for the year&lt;/P&gt;&lt;P&gt;        nafap LIKE anlc-nafap,     "Planned ordinary depr. for the year&lt;/P&gt;&lt;P&gt;        aafap LIKE anlc-aafap,     "Planned unplanned depr. for the year&lt;/P&gt;&lt;P&gt;       END OF t_anlc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_iflo,&lt;/P&gt;&lt;P&gt;        tplnr LIKE iflo-tplnr,     "Functional location&lt;/P&gt;&lt;P&gt;        pltxt LIKE iflo-pltxt,     "Description of functional location&lt;/P&gt;&lt;P&gt;       END OF t_iflo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_itob,&lt;/P&gt;&lt;P&gt;        anlnr LIKE itob-anlnr,     "Main asset number&lt;/P&gt;&lt;P&gt;        shtxt LIKE itob-shtxt,     "Description of technical object&lt;/P&gt;&lt;P&gt;       END OF t_itob.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_anla,&lt;/P&gt;&lt;P&gt;        anln1 LIKE anla-anln1,     "Main asset number&lt;/P&gt;&lt;P&gt;        anln2 LIKE anla-anln2,     "Asset sub-number&lt;/P&gt;&lt;P&gt;        ord42 LIKE anla-ord42,     "Asset Sub-Class&lt;/P&gt;&lt;P&gt;       END OF t_anla.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_finaltab,&lt;/P&gt;&lt;P&gt;        funcloc LIKE iloa-tplnr,&lt;/P&gt;&lt;P&gt;        asset_dum LIKE iloa-anlnr,&lt;/P&gt;&lt;P&gt;        asset LIKE iloa-anlnr,&lt;/P&gt;&lt;P&gt;        parent LIKE iloa-anlnr,&lt;/P&gt;&lt;P&gt;        asset_subnum(17) TYPE c,&lt;/P&gt;&lt;P&gt;        parent_subnum(17) TYPE c,&lt;/P&gt;&lt;P&gt;        accq_cost LIKE anlc-kansw,&lt;/P&gt;&lt;P&gt;        acc_dep LIKE anlc-kansw,&lt;/P&gt;&lt;P&gt;        asset_book_val LIKE anlc-kansw,&lt;/P&gt;&lt;P&gt;        location LIKE t499s-ktext,&lt;/P&gt;&lt;P&gt;        description LIKE itob-shtxt,&lt;/P&gt;&lt;P&gt;        asset_sub LIKE anla-ord42,&lt;/P&gt;&lt;P&gt;       END OF t_finaltab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_download,&lt;/P&gt;&lt;P&gt;        asset LIKE iloa-anlnr,&lt;/P&gt;&lt;P&gt;        parent LIKE iloa-anlnr,&lt;/P&gt;&lt;P&gt;        description LIKE itob-shtxt,&lt;/P&gt;&lt;P&gt;        asset_sub LIKE anla-ord42,&lt;/P&gt;&lt;P&gt;        location LIKE t499s-ktext,&lt;/P&gt;&lt;P&gt;        accq_cost LIKE anlc-kansw,&lt;/P&gt;&lt;P&gt;        acc_dep LIKE anlc-kansw,&lt;/P&gt;&lt;P&gt;        asset_book_val LIKE anlc-kansw,&lt;/P&gt;&lt;P&gt;       END OF t_download.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF t_equz_dum2,&lt;/P&gt;&lt;P&gt;        hequi LIKE equz-hequi,    "Superior Equipment&lt;/P&gt;&lt;P&gt;       END OF t_equz_dum2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_iloa TYPE SORTED TABLE OF t_iloa WITH HEADER LINE&lt;/P&gt;&lt;P&gt;                     WITH NON-UNIQUE KEY tplnr anlnr iloan,&lt;/P&gt;&lt;P&gt;      it_equz TYPE SORTED TABLE OF t_equz WITH HEADER LINE&lt;/P&gt;&lt;P&gt;                           WITH NON-UNIQUE KEY equnr hequi,&lt;/P&gt;&lt;P&gt;      it_equz2 TYPE STANDARD TABLE OF t_equz2 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      it_t499s TYPE SORTED TABLE OF t_t499s WITH HEADER LINE&lt;/P&gt;&lt;P&gt;                     WITH NON-UNIQUE KEY werks stand ktext,&lt;/P&gt;&lt;P&gt;      it_anlc TYPE STANDARD TABLE OF t_anlc WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      it_finaltab TYPE STANDARD TABLE OF t_finaltab WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      it_download TYPE STANDARD TABLE OF t_download WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      it_iflo TYPE SORTED TABLE OF t_iflo WITH HEADER LINE&lt;/P&gt;&lt;P&gt;                                 WITH NON-UNIQUE KEY tplnr,&lt;/P&gt;&lt;P&gt;      it_itob TYPE STANDARD TABLE OF t_itob WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      it_anla TYPE STANDARD TABLE OF t_anla WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_equz_dum1 TYPE SORTED TABLE OF t_equz WITH HEADER LINE&lt;/P&gt;&lt;P&gt;                                WITH NON-UNIQUE KEY equnr hequi,&lt;/P&gt;&lt;P&gt;      it_equz_dum2 TYPE STANDARD TABLE OF t_equz_dum2 WITH HEADER LINE.&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;P.S. Please award points if found useful:)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 05:35:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404839#M195533</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2006-06-22T05:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404840#M195534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In simple words Internal tables are used to hold data at runtime. Consider I want to print a report for Plant data for Materials , this involves two tables MARA(General Material Data) and  MARC(Plant Data for Material). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is how we proceed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I declare a structure consisting of the fields i require to display form MARA and MARC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES :  BEGIN OF tp_final,
         matnr TYPE mara-matnr,
         mtart TYPE mara-mtart,
         werks TYPE marc-werks,
         pstat TYPE marc-pstat,
         END OF tp_final.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then refering to this structure I declare an Internal Table and a work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : t_report  TYPE STANDARD TABLE OF tp_final,
             wa_report TYPE tp_fianl. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In can now fetch the data from the tables and put it into this Internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  SELECT a~matnr a~mtart b~werks b~pstat
  INTO TABLE t_report
  FROM mara AS a INNER JOIN marc AS b
         ON a~matnr = b~matnr
      WHERE a~matnr IN s_matnr. " My select option for MATNR&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i can use the data in the Internal table using &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP t_report INTO wa_report.
" Process the data in wa_report.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;READ TABLE t_report INTO wa_report WITK KEY matnr = ...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &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;Arun Sambargi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 06:07:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404840#M195534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T06:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404841#M195535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Venkat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to declare the internl table, always first declare the types and then using that declare your internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types:&lt;/P&gt;&lt;P&gt;======&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF &amp;lt;ty_itab&amp;gt;,&lt;/P&gt;&lt;P&gt;         MATNR LIKE MARA-MATNR,&lt;/P&gt;&lt;P&gt;         FLAG  TYPE C,&lt;/P&gt;&lt;P&gt;TYPES: END OF&amp;lt;ty_itab&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table Decl:&lt;/P&gt;&lt;P&gt;===================  &lt;/P&gt;&lt;P&gt;DATA: wa_itab type ty_itab,&lt;/P&gt;&lt;P&gt;      gt_itab like standard table of wa_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the best way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regs,&lt;/P&gt;&lt;P&gt;Venkat Ramanan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 06:12:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404841#M195535</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T06:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to define internal table using types</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404842#M195536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai Venkat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see the following Code &amp;amp; Links&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/types.htm" target="test_blank"&gt;http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/types.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Table Declaration *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;TABLES: mara,&lt;/P&gt;&lt;P&gt;marc,&lt;/P&gt;&lt;P&gt;mard.&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Types Declaration *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF typ_mara,&lt;/P&gt;&lt;P&gt;matnr TYPE mara-matnr, "Material Number"&lt;/P&gt;&lt;P&gt;mbrsh TYPE mara-mbrsh, "Industrial Sector"&lt;/P&gt;&lt;P&gt;mtart TYPE mara-mtart, "Material Type"&lt;/P&gt;&lt;P&gt;meins TYPE mara-meins, "Base Unit of Measure"&lt;/P&gt;&lt;P&gt;END OF typ_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF typ_makt,&lt;/P&gt;&lt;P&gt;matnr TYPE makt-matnr, "Material Number"&lt;/P&gt;&lt;P&gt;maktx TYPE makt-maktx, "Material Description"&lt;/P&gt;&lt;P&gt;END OF typ_makt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF typ_marc,&lt;/P&gt;&lt;P&gt;matnr TYPE marc-matnr, "Material Number"&lt;/P&gt;&lt;P&gt;werks TYPE marc-werks, "Plant Number"&lt;/P&gt;&lt;P&gt;END OF typ_marc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF typ_mard,&lt;/P&gt;&lt;P&gt;matnr TYPE marc-matnr, "Material Number"&lt;/P&gt;&lt;P&gt;werks TYPE marc-werks, "Plant Number"&lt;/P&gt;&lt;P&gt;lgort TYPE mard-lgort, "Storage Location"&lt;/P&gt;&lt;P&gt;END OF typ_mard.&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Intrnal tables Declaration *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;DATA: it_mara TYPE STANDARD TABLE OF typ_mara WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: it_makt TYPE STANDARD TABLE OF typ_makt WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: it_marc TYPE STANDARD TABLE OF typ_marc WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: it_mard TYPE STANDARD TABLE OF typ_mard WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have Look Bellow&lt;/P&gt;&lt;P&gt;Variants&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. TYPES typ. &lt;/P&gt;&lt;P&gt;2. TYPES typ(len). &lt;/P&gt;&lt;P&gt;3. TYPES: BEGIN OF rectyp, &lt;/P&gt;&lt;P&gt;... &lt;/P&gt;&lt;P&gt;END OF rectyp. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;The TYPES statement introduces user-defined data types . As with standard data types, you can use them when creating data objects and when assigning types to formal parameters and field symbols. User-defined data types are an essential component of the ABAP/4 type concept . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variant 1&lt;/P&gt;&lt;P&gt;TYPES f. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. ... TYPE typ1 &lt;/P&gt;&lt;P&gt;2. ... LIKE f &lt;/P&gt;&lt;P&gt;3. ... TYPE typ1 OCCURS n &lt;/P&gt;&lt;P&gt;4. ... LIKE f OCCURS n &lt;/P&gt;&lt;P&gt;5. ... TYPE LINE OF itabtyp &lt;/P&gt;&lt;P&gt;6. ... LIKE LINE OF itab &lt;/P&gt;&lt;P&gt;7. ... DECIMALS n &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Creates a new type. If the TYPE addition is not used, the new type points to the standard type C . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The type name typ can be up to 30 characters long. Apart from the special characters '(', ')', '+', '.', ',', ':', '-', '&amp;lt;' and '&amp;gt;', you can use any characters. Numbers are allowed, but the name cannot consist of numbers alone. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Recommendations for type names: &lt;/P&gt;&lt;P&gt;Always use a letter as the first character. &lt;/P&gt;&lt;P&gt;Use the underscore as the link in multiple word names (e.g. NEW_PRODUCT ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 1&lt;/P&gt;&lt;P&gt;... TYPE typ1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Defines the new type with the type typ1 . typ1 can be one of the predefined types specified below or a type you define yourself with TYPES . &lt;/P&gt;&lt;P&gt;The length (SL) of the type typ is the same as the type typ1 . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Type Description Std len. Initial value &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C Text (character) 1 Blank &lt;/P&gt;&lt;P&gt;N Numeric text 1 '00...0' &lt;/P&gt;&lt;P&gt;D Date (YYYYMMDD) 8 '00000000' &lt;/P&gt;&lt;P&gt;T Time (HHMMSS) 6 '000000' &lt;/P&gt;&lt;P&gt;X Hexadecimal 1 X'00' &lt;/P&gt;&lt;P&gt;I Whole number (integer) 4 0 &lt;/P&gt;&lt;P&gt;P Packed number 8 0 &lt;/P&gt;&lt;P&gt;F Floating point number 8 '0.0' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES NUMBER TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This defines the type NUMBER NUMBER with the type I . It can then be used in the program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes&lt;/P&gt;&lt;P&gt;The data type I is the whole number type for the hardware you are using. Its value range is -2*&lt;STRONG&gt;31 to 2&lt;/STRONG&gt;*31-1 (-2.147.483.648 to 2.147.483.647). &lt;/P&gt;&lt;P&gt;While type P is used for money amount fields, you should use type I for number fields, index fields, position specifications, etc. &lt;/P&gt;&lt;P&gt;Apart from zero, type F allows you to display positive and negative numbers in the range from 1E-307 to 1E+307 with 15 decimal places. (The ABAP/4 processor uses the floating point operations of the relevant hardware and does not attempt to standardize them.) Floating point literals must be enclosed in quotation marks. The standard output length is 22. &lt;/P&gt;&lt;P&gt;Input in type F fields can be formatted differently: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Decimal number with or without sign, with or without decimal point. &lt;/P&gt;&lt;P&gt;In the form E, where the mantissa is a decimal number and the exponent can be specified with or without a sign. (Examples of floating point literals: '1', '-12.34567', '-765E-04', '1234E5', '&lt;EM&gt;12E&lt;/EM&gt;34', '+12.3E-4', '1E160'). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Floating point arithmetic is fast on our hardware platforms. It is ideal when you require a large value range and can take rounding errors into account when making calculations. Such rounding errors can occur when converting from external (decimal) format to internal format (base 2 or 16) or vice-versa (see ABAP/4 number types ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 2&lt;/P&gt;&lt;P&gt;... LIKE f &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Defines the type typ with the type of the field f . f may be a database field or an already defined internal field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES TABLE_INDEX_TYP LIKE SY-TABIX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The type TABLE_INDEX_TYP now points to the type of the field SY-TABIX (index for internal tables). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note&lt;/P&gt;&lt;P&gt;This addition is useful in a number of cases, since any field type changes are automatically known to the program. Also, any unnecessary and unwanted conversions are not performed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 3&lt;/P&gt;&lt;P&gt;... TYPE typ1 OCCURS n &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Defines the type of an internal table without a header line. An internal table without a header line consists of any number of table lines that have the same structure as that specified by TYPE . &lt;/P&gt;&lt;P&gt;You fill and process an internal table with statements such as APPEND , READ TABLE , LOOP and SORT . &lt;/P&gt;&lt;P&gt;The OCCURS parameter n specifies how many table lines of storage is required. This storage reservation process does not happen until the first line is inserted in the table. The value n of the OCCURS specification has no effect on type checking, i.e. data objects which have types with different OCCURS specifications are type-compatible. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: TAB_TYPE TYPE I OCCURS 20. &lt;/P&gt;&lt;P&gt;DATA: TAB TYPE TAB_TYPE, &lt;/P&gt;&lt;P&gt;TAB_WA TYPE I. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAB_WA = 1. &lt;/P&gt;&lt;P&gt;APPEND TAB_WA TO TAB. &lt;/P&gt;&lt;P&gt;TAB_WA = 2. &lt;/P&gt;&lt;P&gt;APPEND TAB_WA TO TAB. &lt;/P&gt;&lt;P&gt;The internal table TAB now consists of two table entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 4&lt;/P&gt;&lt;P&gt;... LIKE f OCCURS n &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Defines the type of an internal table without a header line. This table consists of any number of table lines which have the structure specified by the data object f . Processing is the same as for addition 3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:  BEGIN OF PERSON,&lt;/P&gt;&lt;P&gt;         NAME(20),&lt;/P&gt;&lt;P&gt;         AGE TYPE I,&lt;/P&gt;&lt;P&gt;       END OF PERSON.&lt;/P&gt;&lt;P&gt;TYPES  TYPE_PERSONS LIKE PERSON OCCURS 20.&lt;/P&gt;&lt;P&gt;DATA   PERSONS TYPE TYPE_PERSONS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERSON-NAME = 'Michael'.&lt;/P&gt;&lt;P&gt;PERSON-AGE  = 25.&lt;/P&gt;&lt;P&gt;APPEND PERSON TO PERSONS.&lt;/P&gt;&lt;P&gt;PERSON-NAME = 'Gabriela'.&lt;/P&gt;&lt;P&gt;PERSON-AGE  = 22.&lt;/P&gt;&lt;P&gt;APPEND PERSON TO PERSONS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The internal table PERSONS now consists of two table entries. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 5&lt;/P&gt;&lt;P&gt;... TYPE LINE OF itabtyp &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;The specified type itabtyp must be the type of an internal table with or without a header line. The statement creates a type corresponding to the line type of the specified table type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES TAB_TYP TYPE I OCCURS 10.&lt;/P&gt;&lt;P&gt;TYPES MY_TYPE TYPE LINE OF TAB_TYP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The type MY_TYPE now has the same attributes as a line of the table type TAB_TYP and is thus type I . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 6&lt;/P&gt;&lt;P&gt;... LIKE LINE OF itab &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;The data object itab must be an internal table with or without a header line. The statement defines a type which corresponds to the line type of the specified table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA  TAB TYPE I OCCURS 10.&lt;/P&gt;&lt;P&gt;TYPES MY_TYPE LIKE LINE OF TAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The type MY_TYPE now has the same attributes as the line type of the table TAB and thus has the type I . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 7&lt;/P&gt;&lt;P&gt;... DECIMALS n &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;This addition only makes sense with the field type P . When making calculations and outputting data, a field of this type has n decimal places. n must be a value between 0 and 14. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Normally, the attribute for fixed point arithmetic is set with newly created programms. If you switch this attribute off, the DECIMALS -specification is taken into account on output, but not when making calculations. In this case, the programmer must take care that the decimal point is in the right place by multiplying or dividing (COMPUTE ) by the appropriate power of ten. &lt;/P&gt;&lt;P&gt;When making calculations, you should always have fixed point arithmetic switched on. Then, even intermediate results (division!) are calculated with the greatest possible accuracy (31 decimal places). &lt;/P&gt;&lt;P&gt;To decide whether the fixed point type P or the floating point type F is more suitable, see also "ABAP/4 number types ". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variant 2&lt;/P&gt;&lt;P&gt;TYPES typ(len). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similar to variant 1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Creates the type typ with the length len . &lt;/P&gt;&lt;P&gt;This variant should only be used with the types C , N , P and X . Other types can only be created in the standard length (see table under effect of variant 1). &lt;/P&gt;&lt;P&gt;The permitted lengths depend on the type being pointed to: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Type Permitted lengths &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C 1 - 65535 &lt;/P&gt;&lt;P&gt;N 1 - 65535 &lt;/P&gt;&lt;P&gt;P 1 - 16 &lt;/P&gt;&lt;P&gt;X 1 - 65535 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note&lt;/P&gt;&lt;P&gt;For each byte, you can display one character, two decimal digits or two hexadecimal digits. With P fields, one place is reserved for the leading sign, so that a P field of the length 3 can contain 5 digits, while an X field of the length 3 can contain 6 digits. Both have an output length of 6. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variant 3&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF rectyp, &lt;/P&gt;&lt;P&gt;... &lt;/P&gt;&lt;P&gt;END OF rectyp. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt;&lt;P&gt;Defines the field string type rectyp by grouping together all fields of the type rectyp defined between " BEGIN OF rectyp " and " END OF rectyp ". Each name is prefixed by " rectyp- ". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF PERSON,&lt;/P&gt;&lt;P&gt;         NAME(20) TYPE C,&lt;/P&gt;&lt;P&gt;         AGE      TYPE I,&lt;/P&gt;&lt;P&gt;       END   OF PERSON.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Sreenivasulu P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 06:32:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-define-internal-table-using-types/m-p/1404842#M195536</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T06:32:02Z</dc:date>
    </item>
  </channel>
</rss>

