<?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: type &amp; like in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229381#M770331</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prasanth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE keyword is used to just define a field with same type of field specified (character, numeric etc)..It will not associate any of the attribute of target field.&lt;/P&gt;&lt;P&gt;f  LIKE f1 --&lt;/P&gt;&lt;P&gt;LIKE : Field f is created with the same field attribtues as the data object f1, which has already been declared. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example, if f1 has value range defined in it's domain, f will also get same value range associated with it ( of course f will have same type as f1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Jan 2008 05:18:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-09T05:18:32Z</dc:date>
    <item>
      <title>type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229377#M770327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Plz get me the differences between 'like' and 'type' statements&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:10:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229377#M770327</guid>
      <dc:creator>prasanth_kasturi</dc:creator>
      <dc:date>2008-01-09T05:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229378#M770328</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;see this thread.&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4281257"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:14:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229378#M770328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T05:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229379#M770329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="409304"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="477275"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:14:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229379#M770329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T05:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229380#M770330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prasanth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a simple main difference ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Type&lt;/STRONG&gt; : it will allocate memory during execution (object type).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Like&lt;/STRONG&gt; : it will allocate memory immediatly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---type will improve performance.&lt;/P&gt;&lt;P&gt;---p is packed type wherein we can restrict decimal values.&lt;/P&gt;&lt;P&gt;              var type p decimals 2.&lt;/P&gt;&lt;P&gt;---float can hold more value than packed data type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Reward if helpful.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thankyou,&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:17:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229380#M770330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T05:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229381#M770331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prasanth,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE keyword is used to just define a field with same type of field specified (character, numeric etc)..It will not associate any of the attribute of target field.&lt;/P&gt;&lt;P&gt;f  LIKE f1 --&lt;/P&gt;&lt;P&gt;LIKE : Field f is created with the same field attribtues as the data object f1, which has already been declared. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example, if f1 has value range defined in it's domain, f will also get same value range associated with it ( of course f will have same type as f1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mohaiyuddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:18:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229381#M770331</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T05:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229382#M770332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LIKE is used inorder to refer to a present object and to have the semantic definition of that object that is being refered to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE is used in declaring the object using an elementary data type or a data element which has the same semantic definition that is required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is good practice to use TYPE as much as possible when there is a possibility to avoid LIKE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE&lt;/P&gt;&lt;P&gt;You use the TYPE addition in various ABAP statements for defining data types and specifying the types of interface parameters or field symbols. The TYPE addition can have various meanings depending on the syntax and context. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIKE&lt;/P&gt;&lt;P&gt;You use the LIKE addition, similarly to the TYPE addition , in various ABAP statements for defining data types and specifying the types of interface parameters or field symbols. &lt;/P&gt;&lt;P&gt;it can be used in the same ABAP statements as the TYPE addition to refer to any data object &amp;lt;obj&amp;gt; that is already visible at that point in the program. The expression &amp;lt;obj&amp;gt; is either the name of the data object or the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You use LIKE to make the new object or type inherit the technical attributes of an existing data object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The LIKE Addition:&lt;/P&gt;&lt;P&gt;You use the LIKE addition, similarly to the TYPE addition, in various ABAP statements for defining data types and specifying the types of interface parameters or field symbols. The addition&lt;/P&gt;&lt;P&gt;LIKE &amp;lt;obj&amp;gt;&lt;/P&gt;&lt;P&gt;can be used in the same ABAP statements as the TYPE addition to refer to any data object &amp;lt;obj&amp;gt; that is already visible at that point in the program. The expression &amp;lt;obj&amp;gt; is either the name of the data object or the expression&lt;/P&gt;&lt;P&gt;LINE OF &amp;lt;table-object&amp;gt;&lt;/P&gt;&lt;P&gt;In this case, the LIKE addition describes the line type of a table object that is visible at that point in the program.&lt;/P&gt;&lt;P&gt;You use LIKE to make the new object or type inherit the technical attributes of an existing data object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The TYPE Addition:&lt;/P&gt;&lt;P&gt;You use the TYPE addition in various ABAP statements for defining data types and specifying the types of interface parameters or field symbols. The TYPE addition can have various meanings depending on the syntax and context.&lt;/P&gt;&lt;P&gt;Referring to Known Data Types You can use the addition&lt;/P&gt;&lt;P&gt;TYPE &amp;lt;type&amp;gt; to refer to any data type &amp;lt;type&amp;gt; that is already known at this point in the program. It can be used in any of the statements listed below. The expression &amp;lt;obj&amp;gt; is either the name of the data object or the expression&lt;/P&gt;&lt;P&gt;LINE OF &amp;lt;table-type&amp;gt; In this case, the TYPE addition describes the line type of a table type &amp;lt;table-type&amp;gt; that is visible at that point in the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3701261"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;use this links...&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;for like....&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/9b/239fa610de11d295390000e8353423/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/9b/239fa610de11d295390000e8353423/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer the links -&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="3578565"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2270752"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="655322"&gt;&lt;/A&gt;&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;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;Rewards if useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:24:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229382#M770332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T05:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229383#M770333</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;      TYPE, you assign datatype directly to the data object while declaring. &lt;/P&gt;&lt;P&gt;LIKE,you assign the datatype of another object to the declaring data object. The datatype is referenced indirectly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Type is a keyword used to refer to a data type whereas Like is a keyword used to copy the existing properties of already existing data object. &lt;/P&gt;&lt;P&gt;for defining data types and specifying the types of interface parameters or field symbols. The addition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIKE  is either the name of the data object or the expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you use LIKE to make the new object or type inherit the technical attributes of an existing data object. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ABAP Statements with LIKE References&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Definition of local types in a program using&lt;/P&gt;&lt;P&gt;TYPES  in the program, then in the ABAP Dictionary for a database table or flat structure with the same name. You can no longer use this kind of type reference in ABAP Objects classes. You should also avoid using the LIKE addition in other ABAP programs except to refer to data objects. To refer to data types, you should use the TYPE addition instead. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TYPE&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each ABAP program define its own data types using the statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES dtype &lt;A href="LIKE dobj"&gt;TYPE type&lt;/A&gt; ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and declare its own variables or instance attributes of classes using the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA var &lt;A href="{LIKE dobj}"&gt;{TYPE type}&lt;/A&gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the additions TYPE type and LIKE dobj are used in various ABAP statements. The additions can have various meanings, depending on the syntax and context.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Definition of local types in a program&lt;/P&gt;&lt;P&gt;·        Declaration of data objects&lt;/P&gt;&lt;P&gt;·        Dynamic creation of data object&lt;/P&gt;&lt;P&gt;·        Specification of the type of formal parameters in subroutines&lt;/P&gt;&lt;P&gt;·        Specification of the type of formal parameters in methods&lt;/P&gt;&lt;P&gt;·        Specification of the type of field symbols&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constructing New Data Types&lt;/P&gt;&lt;P&gt;The TYPE addition allows you to construct new data types in the TYPES, DATA; CONSTANTS; and STATICSstatements. In the TYPES statement, these are local data types in the program. In the other statements, they are attributes of new data objects, meaning that the newly defined data types are not free-standing. Rather, they are linked to database objects.This means that you can refer to them using the LIKEaddition, but not using TYPE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: shylaja puchala on Jan 9, 2008 6:29 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:29:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229383#M770333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T05:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229384#M770334</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;TYPE is used while refering to the data types and types declared using types statement, where as LIKE is used to refer to the data objects.&lt;/P&gt;&lt;P&gt;LIKE means the datatype of the variable is similar to the referenced variable.&lt;/P&gt;&lt;P&gt;TYPE means it is a predefined data type.&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/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;For TYPE&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;For LIKE&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/d3/2e974d35c511d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb367a358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb367a358411d1829f0000e829fbfe/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg:&lt;/P&gt;&lt;P&gt;DATA int TYPE i.&lt;/P&gt;&lt;P&gt;Here int is of integer data type.&lt;/P&gt;&lt;P&gt;DATA var LIKE int.&lt;/P&gt;&lt;P&gt;var IS a variable having same data type of int. which in turn is integer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can find these helpful when you reference database table variables... You need not know what is the datatype defined.&lt;/P&gt;&lt;P&gt;Also it adds to FLEXIBILITY.&lt;/P&gt;&lt;P&gt;Whenever you make changes to your database tables and fields,&lt;/P&gt;&lt;P&gt;that change is REFLECTED back to your program that is,&lt;/P&gt;&lt;P&gt;You need not change all your program code when you change your table fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Harini.S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:29:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229384#M770334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T05:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229385#M770335</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;The ABAP type concept distinguishes between data types and data objects.&lt;/P&gt;&lt;P&gt;o Data types are either defined locally in an ABAP program with TYPES&lt;/P&gt;&lt;P&gt;or globally in the ABAP Dictionary.&lt;/P&gt;&lt;P&gt;o Data objects reside in the internal mode of an ABAP program and are&lt;/P&gt;&lt;P&gt;declared prototypical with the statement DATA.&lt;/P&gt;&lt;P&gt;When you declare local program data types with TYPES or data objects with&lt;/P&gt;&lt;P&gt;DATA, the data type must be defined. To do this you can refer to already&lt;/P&gt;&lt;P&gt;existing types in addition to using type constructors, for example, TYPE&lt;/P&gt;&lt;P&gt;TABLE OF or TYPE REF TO. It is possible to refer to data types using the&lt;/P&gt;&lt;P&gt;TYPE addition and the data object using the LIKE addition. Furthermore,&lt;/P&gt;&lt;P&gt;type references are possible using TYPE and LIKE also during typing&lt;/P&gt;&lt;P&gt;interface parameters or field symbols.&lt;/P&gt;&lt;P&gt;o TYPE addition&lt;/P&gt;&lt;P&gt;With TYPE addition, you can refer either to local data types of the&lt;/P&gt;&lt;P&gt;same ABAP program or on global data types of the Dictionaries.&lt;/P&gt;&lt;P&gt;Local types mask global types that have the same names. When typing&lt;/P&gt;&lt;P&gt;the interface parameters or field symbols, a reference is also&lt;/P&gt;&lt;P&gt;possible to generic types ANY, ANY TABLE,INDEX TABLE, TABLE or&lt;/P&gt;&lt;P&gt;STANDARD TABLE, SORTED TABLE and HASHED TABLE.&lt;/P&gt;&lt;P&gt;o The LIKE addition&lt;/P&gt;&lt;P&gt;With the LIKE addition, you can refer to all visible data objects&lt;/P&gt;&lt;P&gt;at the ABAP program's positon in question. Only the declaration of&lt;/P&gt;&lt;P&gt;the data object must be known. In this case it is totally&lt;/P&gt;&lt;P&gt;irrelevant whether the data object already exists physically in&lt;/P&gt;&lt;P&gt;memory during the LIKE reference. Local data objects mask global&lt;/P&gt;&lt;P&gt;data objects that have the same name.&lt;/P&gt;&lt;P&gt;The semantic separation between data types and data objects is reflected by&lt;/P&gt;&lt;P&gt;the syntactic separation in ABAP between TYPE and LIKE. This separation&lt;/P&gt;&lt;P&gt;allows for separate namespaces for data types and data objects. Only for&lt;/P&gt;&lt;P&gt;reasons of compatibility with preceding releases, can you refer to flat&lt;/P&gt;&lt;P&gt;structures (see note 176336) in the ABAP Dictionary with the LIKE addition,&lt;/P&gt;&lt;P&gt;so to database tables and independent flat structures. The LIKE addition&lt;/P&gt;&lt;P&gt;first finds a data object on the local program and then in the ABAP&lt;/P&gt;&lt;P&gt;Dictionary it finds a database table or flat structure that has the same&lt;/P&gt;&lt;P&gt;name. The type reference on the ABAP Dictionary is no longer possible with&lt;/P&gt;&lt;P&gt;LIKE in the class of ABAP objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;vasavi.&lt;/P&gt;&lt;P&gt;reward if helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:35:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229385#M770335</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T05:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229386#M770336</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;The Statements TYPES and DATA &lt;/P&gt;&lt;P&gt;Each ABAP program define its own data types using the statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES dtype &lt;A href="LIKE dobj"&gt;TYPE type&lt;/A&gt; ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and declare its own variables or instance attributes of classes using the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA var &lt;A href="{LIKE dobj}"&gt;{TYPE type}&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;Within the program or a class, you can also define local data types and variables within procedures. Local variables in procedures obscure identically-named variables in the main program or class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When creating data types and data objects, there are a number of naming convention that also apply for other local program definitions, such as procedures. These are described in detail in the keyword documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Additions TYPE and LIKE&lt;/P&gt;&lt;P&gt;The additions TYPE type and LIKE dobj are used in various ABAP statements. The additions can have various meanings, depending on the syntax and context.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Definition of local types in a program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Declaration of data objects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Dynamic creation of data objects&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Specification of the type of formal parameters in subroutines&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Specification of the type of formal parameters in methods&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Specification of the type of field symbols&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constructing New Data Types&lt;/P&gt;&lt;P&gt;The TYPE addition allows you to construct new data types in the TYPES, DATA; CONSTANTS; and STATICSstatements. In the TYPES statement, these are local data types in the program. In the other statements, they are attributes of new data objects, meaning that the newly defined data types are not free-standing. Rather, they are linked to database objects.This means that you can refer to them using the LIKEaddition, but not using TYPE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To construct new data types, the addition TYPE can be used with the following type constructors:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Construction of reference types&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REF TO type|dobj&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Construction of structured data types&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BEGIN OF struc_type.&lt;/P&gt;&lt;P&gt;  ...&lt;/P&gt;&lt;P&gt;END OF struc_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        Construction of table types&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tabkind OF linetype &lt;A href="WITH key"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These data types only exist during the runtime of the ABAP program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Referring to Known Data Types or Data Objects&lt;/P&gt;&lt;P&gt;Using the additions TYPE or LIKE in the TYPESstatement, local data types in a program can be referred to known data types or data objects. This is mainly the case with user-defined elementary data types. If you declare variables using the additions TYPE type or LIKE dobj with statement DATA, the data type of var is already fully defined before the declaration is made.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The known types or data that are referred to must be visible at the point where the data type or variable is declared. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A known data type can be any of the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        A predefined ABAP type to which you refer using the TYPE addition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        An existing local data type in the program to which you refer using the TYPE addition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        The data type of a local data object in the program to which you refer using the LIKE addition&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        A data type in the ABAP Dictionary to which you refer using the TYPE addition. To ensure compatibility with earlier releases, it is still possible to use the LIKE addition to refer to database tables and flat structures in the ABAP Dictionary. However, you should use the TYPE addition in new programs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The LIKE addition takes its technical attributes from a visible data object. As a rule, you can use LIKE to refer to any object that has been declared using DATA or a similar statement, and is visible in the current context.  The data object only has to have been declared. It is irrelevant whether the data object already exists in memory when you make the LIKE reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        In principle, the local data objects in the same program are visible. As with local data types, there is a difference between local data objects in procedures and global data objects. Data objects defined in a procedure obscure other objects with the same name that are declared in the global declarations of the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;·        You can also refer to the data objects of other visible ABAP programs. These might be, for example, the visible attributes of global classes in class pools. If a global class cl_lobal has a public instance attribute or static attribute attr, you can refer to it as follows in any ABAP program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA dref TYPE REF TO cl_global.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:  f1 LIKE cl_global=&amp;gt;attr,&lt;/P&gt;&lt;P&gt;       f2 LIKE dref-&amp;gt;attr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can access the technical properties of an instance attribute using the class name and a reference variable without first having to create an object. The properties of the attributes of a class are not instance-specific and belong to the static properties of the class.&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 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;This example declares variables with reference to the internal type STRUCT in the program, a component of an existing data object wa_struct, the predefined data object SY-DATUM, the predefined ABAP type t and STRING, and the data element S_CARR_ID from the ABAP Dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Referring to Generic Data Types&lt;/P&gt;&lt;P&gt;If you refer to one of the generic predefined ABAP types of fixed length (c, n, p, x) in the TYPES or DATA statement, you must specify the undefined technical attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES|DATA var[(length)] TYPE type &lt;A href="DECIMALS dec"&gt;&lt;/A&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES|DATA var TYPE type &lt;A href="LENGTH len"&gt;&lt;/A&gt; &lt;A href="DECIMALS dec"&gt;&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;DATA: text1,&lt;/P&gt;&lt;P&gt;      text2 LENGTH 2,&lt;/P&gt;&lt;P&gt;      text3 TYPE c LENGTH 3,&lt;/P&gt;&lt;P&gt;      pack TYPE p DECIMALS 2 VALUE '1.225'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example creates three character variables with field lengths of one, two, and three bytes respectively, and a packed number variable with field length 8 bytes and two decimal places. If the attribute Fixed point arithmetic is set, the value of pack is 1.23.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example shows how to declare elementary data objects with reference to predefined ABAP types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROGRAM demo_elementary_data_objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA text1  TYPE c LENGTH 20.&lt;/P&gt;&lt;P&gt;DATA text2  TYPE string.&lt;/P&gt;&lt;P&gt;DATA number TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;text1 = 'The number'.&lt;/P&gt;&lt;P&gt;number = 100.&lt;/P&gt;&lt;P&gt;text2 = 'is an integer.'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: text1, number, text2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This program produces the following output on the screen:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The number              100 is an integer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this example, the data objects text1, text2 and number are declared with the DATA statement. The technical attributes are determined by referring to the predefined ABAP types c, string, and I. Values from unnamed literals are assigned to the data objects. The contents of the named data objects are displayed on the list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specifying a Start Value&lt;/P&gt;&lt;P&gt;When you declare an elementary fixed-length variable, the DATAstatement automatically fills it with the type-specific initial value as listed in the table in the Predefined ABAP Types section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, you can also specify a starting value of a fixed-length elementary variable (also within a structure declaration) using the VALUE addition in the DATAstatement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA var ... VALUE val|{IS INITIAL}.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specifying start values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: counter TYPE p VALUE 1,&lt;/P&gt;&lt;P&gt;      date    TYPE d VALUE '19980601',&lt;/P&gt;&lt;P&gt;      flag    TYPE n VALUE IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this data declaration, the character string flag contains its type specific&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initial value &amp;#145;0&amp;#146;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Renjith Michael.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 05:49:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-like/m-p/3229386#M770336</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-09T05:49:06Z</dc:date>
    </item>
  </channel>
</rss>

