<?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: Answer my question in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275212#M494686</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Both almost do the same thing. &lt;/P&gt;&lt;P&gt;Ex: variable declaration. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: lv_matnr type matnr,&lt;/P&gt;&lt;P&gt;        lv_matnr1 type matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But SAP now recomanded to use TYPE in case of LIKE. If you use LIKE you will get a error/worning in the extendad syntax check which will advice you to use type instead of like in the newer versions of SAP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to declare the table  we use type table of and while work area we use like line of.&lt;/P&gt;&lt;P&gt;Ex: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_mara type table of t_mara,&lt;/P&gt;&lt;P&gt;        wa_mara like line og it_mara.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 May 2007 09:40:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-29T09:40:05Z</dc:date>
    <item>
      <title>Answer my question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275207#M494681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Difference between Like and TYPE in ABAP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2007 09:30:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275207#M494681</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-29T09:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Answer my question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275208#M494682</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;&lt;/P&gt;&lt;P&gt;Diff bn TYPE N LIKE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through the link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE - Type is used to tell the system what is the type of data object(variable) you want to create .&lt;/P&gt;&lt;P&gt;LIKE: If there is already a data object declared and you want to declare a similar data object you can just refer to the previous data object using like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this thread.&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.sdn.sap.com/click.jspa?searchID=711746&amp;amp;messageID=2270752" target="test_blank"&gt;https://forums.sdn.sap.com/click.jspa?searchID=711746&amp;amp;messageID=2270752&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.sdn.sap.com/click.jspa?searchID=711746&amp;amp;messageID=512214" target="test_blank"&gt;https://forums.sdn.sap.com/click.jspa?searchID=711746&amp;amp;messageID=512214&lt;/A&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;Priyanka.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2007 09:32:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275208#M494682</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-29T09:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Answer my question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275209#M494683</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; i would suggest u have a proper subject to your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg: This would explain:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF struct,&lt;/P&gt;&lt;P&gt;         number_1 TYPE i,&lt;/P&gt;&lt;P&gt;         number_2 TYPE p DECIMALS 2,&lt;/P&gt;&lt;P&gt;       END OF struct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:  wa_struct TYPE struct,&lt;/P&gt;&lt;P&gt;       number    LIKE wa_struct-number_2,&lt;/P&gt;&lt;P&gt;       date      LIKE sy-datum,&lt;/P&gt;&lt;P&gt;       time      TYPE t,&lt;/P&gt;&lt;P&gt;       text      TYPE string,&lt;/P&gt;&lt;P&gt;       company   TYPE s_carr_id.&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;Bijal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2007 09:35:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275209#M494683</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-29T09:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Answer my question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275210#M494684</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 we use type it wll not allocate memory inmmediately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where as if we use like then it will allocate memory immediately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab like mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : itab-matnr type matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward with points if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2007 09:36:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275210#M494684</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-29T09:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Answer my question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275211#M494685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;Internal table declaration   
Declaring internal tables is an essential part of writing ABAP code as this is where most of the data retrieved 
from database tables will be stored. During the select statement you retrieve data from a database table into 
an internal table (multiple rows) or a work area or header line (single row).   
 
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZTYPES                                                      *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
REPORT  ZTYPES                                                  .

* Table declaration (old method)
DATA: BEGIN OF tab_ekpo OCCURS 0,             "itab with header line
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
 END OF tab_ekpo.

*Table declaration (new method)     "USE THIS WAY!!!
TYPES: BEGIN OF t_ekpo,
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
 END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
      wa_ekpo TYPE t_ekpo.                    "work area (header line)

* Build internal table and work area from existing internal table
DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
      wa_datatab LIKE LINE OF tab_ekpo.

* Build internal table and work area from existing internal table,
* adding additional fields
TYPES: BEGIN OF t_repdata.
        INCLUDE STRUCTURE tab_ekpo.  "could include EKKO table itself!!
TYPES: bukrs  TYPE ekpo-werks,
       bstyp  TYPE ekpo-bukrs.
TYPES: END OF t_repdata.
DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
      wa_repdata TYPE t_repdata.              
 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;girish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2007 09:39:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275211#M494685</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-29T09:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Answer my question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275212#M494686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Both almost do the same thing. &lt;/P&gt;&lt;P&gt;Ex: variable declaration. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: lv_matnr type matnr,&lt;/P&gt;&lt;P&gt;        lv_matnr1 type matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But SAP now recomanded to use TYPE in case of LIKE. If you use LIKE you will get a error/worning in the extendad syntax check which will advice you to use type instead of like in the newer versions of SAP. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to declare the table  we use type table of and while work area we use like line of.&lt;/P&gt;&lt;P&gt;Ex: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_mara type table of t_mara,&lt;/P&gt;&lt;P&gt;        wa_mara like line og it_mara.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2007 09:40:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275212#M494686</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-29T09:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Answer my question</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275213#M494687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use like when there is an existing data type and you want to refer to the existing one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXAMPLE : TYPES char1 type C&lt;/P&gt;&lt;P&gt;(Has to be a field from the ABAP dictionary)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXAMPLE : TYPES char2 LIKE char1&lt;/P&gt;&lt;P&gt;(NOTE : Here we can have ABAP dictionary types OR reference to a field created in the program)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here char2 is created like char1&lt;/P&gt;&lt;P&gt;However you CANNOT create cha2 type char1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2007 09:55:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/answer-my-question/m-p/2275213#M494687</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-29T09:55:53Z</dc:date>
    </item>
  </channel>
</rss>

