<?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: diff bet  type &amp; like in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653657#M290174</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sanjeev,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. &lt;/P&gt;&lt;P&gt;For all practical purposes there are the same. The only additional advantage with types is that you can define your own types(including complex ones) in the data dictionary and reuse them accross various programs. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But within a program if two variables are defined one using LIKE and another using TYPE, both referring to the same field, then there is no difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I include a type pool within a program, then I can define my variables only using TYPE to refer to any type defined in that pool. I cannot use LIKE in this scenario. Also, if I want to use native types like C, N, etc, I cannot use LIKE there either. I can use LIKE ABC only if ABC is in the database or if ABC is defined previously in the same program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can use TYPE ABC, if ABC is defined in database as a TYPE and included in the program with the statement TYPE-POOLS. I can use it, if it is the native types. I can use it, if it is already defined in the dictionary as a structure/table or structure/table field, or even if it is defined as a data element or a domain. So I can declare a variable V_BUKRS TYPE BUKRS, but I cannot define a variable V_BUKRS LIKE BUKRS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I intend to use V_BUKRS to store company code, I will prefer to declare it as V_BUKRS LIKE T001-BUKRS, only because if tomorrow for some reason, the definition of T001-BUKRS changes to a data element for example, BUKRS_N(say DEC 4) instead of the data element BUKRS(CHAR 4) that it refers to now, I don't have to change my programs because I am referring to the table field and inhereting its properties. Whereas, had I declared my V_BUKRS TYPE BUKRS and the table now changed to BUKRS_N, I will be forced to change my program as there will be a type incompatability.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. try this code (just copy paste)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report abc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : char50(50) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt; type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : d1 type c, "--- native&lt;/P&gt;&lt;P&gt;d2 type n, "--- native&lt;/P&gt;&lt;P&gt;d25 type char50 , "----&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt; User defined data type&lt;/P&gt;&lt;P&gt;d3 type bukrs, "---- data element / domain&lt;/P&gt;&lt;P&gt;d4 type persno, "---- data element / domain&lt;/P&gt;&lt;P&gt;d5 type t001, "---- table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;d99 type c&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*l1 like c "----&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; Not Allowed&lt;/P&gt;&lt;P&gt;*l2 like n "----&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; Not Allowed&lt;/P&gt;&lt;P&gt;*l25 like char50 , "----&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt; User defined data type&lt;/P&gt;&lt;P&gt;*l3 like bukrs "----&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; Not Allowed&lt;/P&gt;&lt;P&gt;*l4 like persno, "----&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; Not Allowed&lt;/P&gt;&lt;P&gt;l5 like t001 , "---- table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l99 like pa0001&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;I hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Nov 2006 07:38:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-16T07:38:33Z</dc:date>
    <item>
      <title>diff bet  type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653653#M290170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt; what is the difference between declaring a variable using type and like.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 07:05:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653653#M290170</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T07:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: diff bet  type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653654#M290171</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;when u r referring to a datatype then use type declaartion,when u  r referring to any data base object,then use the like statement.&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;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 07:10:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653654#M290171</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2006-11-16T07:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: diff bet  type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653655#M290172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sanjeev,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. When you take reference of objects that occupies memory ( data elements,variables decalared with DATA) then use LIKE and when you are taking ref. to a elementry data types(C,I,D,T...) or to a variables decalared with TYPES statement then we use TYPE&lt;/P&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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 07:24:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653655#M290172</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T07:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: diff bet  type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653656#M290173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out this thread ..&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="2246521"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 07:35:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653656#M290173</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T07:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: diff bet  type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653657#M290174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sanjeev,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. &lt;/P&gt;&lt;P&gt;For all practical purposes there are the same. The only additional advantage with types is that you can define your own types(including complex ones) in the data dictionary and reuse them accross various programs. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But within a program if two variables are defined one using LIKE and another using TYPE, both referring to the same field, then there is no difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I include a type pool within a program, then I can define my variables only using TYPE to refer to any type defined in that pool. I cannot use LIKE in this scenario. Also, if I want to use native types like C, N, etc, I cannot use LIKE there either. I can use LIKE ABC only if ABC is in the database or if ABC is defined previously in the same program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can use TYPE ABC, if ABC is defined in database as a TYPE and included in the program with the statement TYPE-POOLS. I can use it, if it is the native types. I can use it, if it is already defined in the dictionary as a structure/table or structure/table field, or even if it is defined as a data element or a domain. So I can declare a variable V_BUKRS TYPE BUKRS, but I cannot define a variable V_BUKRS LIKE BUKRS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I intend to use V_BUKRS to store company code, I will prefer to declare it as V_BUKRS LIKE T001-BUKRS, only because if tomorrow for some reason, the definition of T001-BUKRS changes to a data element for example, BUKRS_N(say DEC 4) instead of the data element BUKRS(CHAR 4) that it refers to now, I don't have to change my programs because I am referring to the table field and inhereting its properties. Whereas, had I declared my V_BUKRS TYPE BUKRS and the table now changed to BUKRS_N, I will be forced to change my program as there will be a type incompatability.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. try this code (just copy paste)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report abc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : char50(50) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt; type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : d1 type c, "--- native&lt;/P&gt;&lt;P&gt;d2 type n, "--- native&lt;/P&gt;&lt;P&gt;d25 type char50 , "----&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt; User defined data type&lt;/P&gt;&lt;P&gt;d3 type bukrs, "---- data element / domain&lt;/P&gt;&lt;P&gt;d4 type persno, "---- data element / domain&lt;/P&gt;&lt;P&gt;d5 type t001, "---- table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;d99 type c&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*l1 like c "----&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; Not Allowed&lt;/P&gt;&lt;P&gt;*l2 like n "----&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; Not Allowed&lt;/P&gt;&lt;P&gt;*l25 like char50 , "----&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt; User defined data type&lt;/P&gt;&lt;P&gt;*l3 like bukrs "----&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; Not Allowed&lt;/P&gt;&lt;P&gt;*l4 like persno, "----&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; Not Allowed&lt;/P&gt;&lt;P&gt;l5 like t001 , "---- table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l99 like pa0001&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;I hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit M.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 07:38:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653657#M290174</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T07:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: diff bet  type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653658#M290175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;look this to get some idea...&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 - Simple Field Definitions &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variants: &lt;/P&gt;&lt;P&gt;1. DATA f.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. DATA f(len).&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;Variant 1 &lt;/P&gt;&lt;P&gt;DATA f. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additions: &lt;/P&gt;&lt;P&gt;1. ... TYPE type &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. ... LIKE f1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. ... TYPE LINE OF itabtype&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. ... LIKE LINE OF itab&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. ... TYPE REF TO cif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. ... TYPE REF TO DATA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. ... VALUE lit &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;8. ... DECIMALS n&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;9. ... READ-ONLY&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;In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See New Naming Convention. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Creates an internal field f in the program with default length. If you do not specify a data type, the object assumes the default type C. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A type name can be up to 30 characters long. The name may only consist of alphanumeric characters and the underscore character. It may not consist entirely of digits. Special characters such as German umlauts are not allowed. As well as these characters, certain special characters are used internall. However, these should not be used in application programs. SPACE is a reserved name, and cannot therefore be used. Furthermore, you should not use a field in a statement if it has the same name as one of the additions of the keyword (for example: PERFORM SUB USING CHANGING.). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Recommendations for Type Names: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Always start the name with a letter. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the underscore to separate compound names (for example, NEW_PRODUCT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additional help &lt;/P&gt;&lt;P&gt;Variables &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 1 &lt;/P&gt;&lt;P&gt;... TYPE type &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;Creates the field f with the type type. The type can be one of the predefined types listed below, one of your own that you defined in the same program using TYPES, or a global type stored in the ABAP Dictionary The default length SL of the field f depends on its data type type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Type   Description of type        SL     Initial value &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    C     Character                  1      Space &lt;/P&gt;&lt;P&gt;    N     Numeric string             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     Byte (hexadecimal)         1      X'00' &lt;/P&gt;&lt;P&gt;    I     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;  STRING  String         Variable empty string &lt;/P&gt;&lt;P&gt;XSTRING  byte sequence (XString) Variable  empty X string &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;DATA NUMBER TYPE I. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field NUMBER is created with type I, and can then be used in the program. In particular, you can assign numeric values to the field and use it to perform calculations (ABAP numeric types). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 2 &lt;/P&gt;&lt;P&gt;... LIKE f1 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See LIKE references to ABAP Dictionary types not allowed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Creates the field f with the same field attributes as the data object (already defined) f1. You can use this technique for any data type (fields, parameters, structures) as long as the data object is fully typed. &lt;/P&gt;&lt;P&gt;f1 can be any ABAP Dictionary reference. &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;DATA TABLE_INDEX LIKE SY-TABIX. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLE_INDEX now has the same attributes as SY-TABIX (the index field for internal tables). &lt;/P&gt;&lt;P&gt;&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;You should use this addition wherever possible. If the type of a field to which you have referred changes, the ABAP runtime system automatically adopts the change in all fields defined with reference to it. It also avoids unnecessary and unwanted conversions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 3 &lt;/P&gt;&lt;P&gt;... TYPE LINE OF itabtype &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;The type itabtype must be the type of an internal table. The system creates a data object with the line type of the specified table type. &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;TYPES TAB_TYPE TYPE STANDARD TABLE OF I WITH NON-UNIQUE &lt;/P&gt;&lt;P&gt;                    DEFAULT KEY INITIAL SIZE 10. &lt;/P&gt;&lt;P&gt;DATA  TAB_WA   TYPE LINE OF TAB_TYPE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data object TAB_WA now has the same attributes as a line of the table type TAB_TYPE - in this case, type I. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 4 &lt;/P&gt;&lt;P&gt;... LIKE LINE OF itab &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See LIKE references to ABAP Dictionary types not allowed. &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 system creates a data object with the line type of the specified table. &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;DATA TAB    TYPE STANDARD TABLE OF I WITH NON-UNIQUE &lt;/P&gt;&lt;P&gt;                 DEFAULT KEY INITIAL SIZE 10. &lt;/P&gt;&lt;P&gt;DATA TAB_WA LIKE LINE OF TAB. &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 data object TAB_WA now has the same attributes as a line of the table TAB (in this case, type I). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 5 &lt;/P&gt;&lt;P&gt;... TYPE REF TO cif &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;Declares the data object f as a reference variable in ABAP Objects, where cif is a class or interface. Reference variables contain references(pointers) to objects. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you specify a reference variable with reference to a class, it can contain references to objects in that class. If you specify a reference variables with reference to an interface, it can contain references to objects whose class implements the interface. &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;Objects (instances of class) can only be addressed using reference variables. For information about creating objects, see CREATE OBJECT. &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;INTERFACE i1. &lt;/P&gt;&lt;P&gt;  METHODS m1. &lt;/P&gt;&lt;P&gt;ENDINTERFACE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS c1 DEFINITION. &lt;/P&gt;&lt;P&gt;  PUBLIC SECTION. &lt;/P&gt;&lt;P&gt;    INTERFACES i1. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS c1 IMPLEMENTATION. &lt;/P&gt;&lt;P&gt;  METHOD i1~m1. &lt;/P&gt;&lt;P&gt;    ... &lt;/P&gt;&lt;P&gt;  ENDMETHOD. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: o1 TYPE REF TO c1, &lt;/P&gt;&lt;P&gt;      o2 TYPE REF TO c1, &lt;/P&gt;&lt;P&gt;      ir TYPE REF TO i1. &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;P&gt;CREATE OBJECT o1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;o2 = o1. &lt;/P&gt;&lt;P&gt;ir = o1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additional help &lt;/P&gt;&lt;P&gt;Object Handling &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 6 &lt;/P&gt;&lt;P&gt;... TYPE REF TO 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;Effect &lt;/P&gt;&lt;P&gt;Declares the data object f as a reference variable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reference variables contain references (pointers) to data objects. &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;DATA: numref     TYPE REF TO DATA, &lt;/P&gt;&lt;P&gt;      number     TYPE I VALUE 123. &lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fs&amp;gt; TYPE ANY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GET REFERENCE OF number INTO numref. &lt;/P&gt;&lt;P&gt;ASSIGN numref-&amp;gt;* TO &amp;lt;fs&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;This example creates a reference to the data object number. It is then assigned to the field symbol &amp;lt;fs&amp;gt; using the dereferencing operator -&amp;gt;*. It is now possible to work with the field symbol in the normal way. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 7 &lt;/P&gt;&lt;P&gt;... VALUE lit &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;Instead of its initial value (indicated in the above table), the field f takes as its starting value the value of the literal lit. You may also specify a constant, or the addition IS INITIAL, in which case, the system uses the initial value for the data type of the object. This is particularly important when you use the CONSTANTS statement, since you must always use the VALUE addition. &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;DATA: NUMBER      TYPE I        VALUE 123, &lt;/P&gt;&lt;P&gt;      FLAG                      VALUE 'X', &lt;/P&gt;&lt;P&gt;      TABLE_INDEX LIKE SY-TABIX VALUE 45. &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 example creates a field NUMBER with type I. Instead of its initial value (0), it is created withe the starting value 123. The field FLAG with type C (length 1) now has the contents 'X'; TABLE_INDEX has the value 45, since the field SY-TABIX is a numeric field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 8 &lt;/P&gt;&lt;P&gt;... DECIMALS 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;This addition only applies to field type P. The field has n decimal places for calculations and display, where n can be between 0 and 14. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you create a new program, "Fixed point arithmetic" is set by default. If you deselect this option, the DECIMALS specification does not apply to calculations, but only to display. In this case, you as the programmer are responsible for ensuring that you calculate correctly with decimals by multiplying or dividing by the relevant power of ten (COMPUTE). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should always work with fixed point arithmetic, because the intermediate results of calculations (division!) are also calculated to the greatest possible accuracy (31 decimal places). &lt;/P&gt;&lt;P&gt;For hints on when to use the fixed point type P or the floating point type F, see "ABAP Number Types". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 9 &lt;/P&gt;&lt;P&gt;... READ-ONLY &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;You can only use this addition in the public visibility section (PUBLIC SECTION) of a class declaration (see CLASS) or in an interface definition (see INTERFACE). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The READ-ONLY addition makes a public attribute, declared in a DATA statement, readable from outside the class, but only modifiable by methods of the class. &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;When inheritance is introduced, the READ-ONLY addition will also be permitted in the protected area. Subclasses of a class will then be able to change the READ-ONLY attributes in the public section, but not those in the protected section. &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;&lt;/P&gt;&lt;P&gt;CLASS C1 DEFINITION. &lt;/P&gt;&lt;P&gt;  PUBLIC SECTION. &lt;/P&gt;&lt;P&gt;    DATA A VALUE 'X' READ-ONLY. &lt;/P&gt;&lt;P&gt;    METHODS M. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA O TYPE REF TO C1. &lt;/P&gt;&lt;P&gt;CREATE OBJECT O. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD O-&amp;gt;M. &lt;/P&gt;&lt;P&gt;WRITE O-&amp;gt;A. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS C1 IMPLEMENTATION. &lt;/P&gt;&lt;P&gt;  METHOD M. &lt;/P&gt;&lt;P&gt;    A = 'Y'. &lt;/P&gt;&lt;P&gt;  ENDMETHOD. &lt;/P&gt;&lt;P&gt;ENDCLASS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attribute A of class C1 can only be read from outside the class. To change it, you need a method from the same 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;Additional help &lt;/P&gt;&lt;P&gt;Classes &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variant 2 &lt;/P&gt;&lt;P&gt;DATA f(len). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additions: &lt;/P&gt;&lt;P&gt;As in variant 1 &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;Creates field f with the length len. &lt;/P&gt;&lt;P&gt;You can only use this variant with type C, N, P, and X fields. Fields with other types can only be created in their default length (see table under "Effects" of variant 1). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See Wrong length specified in declaration. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The maximum permitted length of a field depends on its type: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Type  Permitted length &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;Each byte can store one character, or two decimal or hexadecimal digits. In a P field, one half-byte is reserved for the plus or minus sign. Consequently, a P field with length 3 can contain up to 5 digits, while an X field with length 3 can contain 6. Both have the output length 6. &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;Ramesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 07:46:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653658#M290175</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T07:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: diff bet  type &amp; like</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653659#M290176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi thanks for making me clear in this concept&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 09:03:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/diff-bet-type-like/m-p/1653659#M290176</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T09:03:14Z</dc:date>
    </item>
  </channel>
</rss>

