on 04-19-2006 10:46 AM
Hi all.
i have a basic abap query.
In a an interface function module I declared one field
like:
v1 like some table field,
v2 type some dataelement,
technically and functionally what is the difference between these two declarations.
thanks in advance,
Eswar.
HI
GOOD
YOU HAVE NOT CLEARLY MENTIONED YOUR QUERY
ANYWAY,I THINK YOU WANT TO KNOW THE DIFFERENCE BETWEEN LIKE AND TYPE STATEMENT.
LIKE->The LIKE Addition
You use the LIKE addition, similarly to the TYP E addition , in various ABAP statements for defining data types and specifying the types of interface parameters or field symbols. The addition
LIKE <obj>
can be used in the same ABAP statements as the TYPE addition to refer to any data object <obj> that is already visible at that point in the program. The expression <obj> is either the name of the data object or the expression
LINE OF <table-object>
In this case, the LIKE addition describes the line type of a table object that is visible at that point in the program.
You use LIKE to make the new object or type inherit the technical attributes of an existing data object
TYPE STATEMENT ->
TYPE-POOL
The introductory statement TYPE-POOL can only be used for type groups (type T programs). A program introduced with the TYPE-POOL statement can only contain global type definitions and constants declarations. The CLASS-POOL statement is generated automatically where required by the ABAP Dictionary - you should not insert it into programs manually.
Declarative Statements
These statements define data types or declare data objects which are used by the other statements in a program or routine. The collected declarative statements in a program or routine make up its declaration part.
Examples of declarative keywords:
TYPES, DATA, TABLES
THANKS
MRUTYUN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi friend,
this is khadar bacicully the difference b/w to is simple.
Both are keywords type refers to data types for type and size of memory,but like refers to existing variables
ex:data a type i.
data b like a.
HERE BOTK HAVE SAME VALUE.
THANQ.
SK.KHADAR BABU.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Eswar,
the basic difference between TYPE and LIKE is, that the related object for TYPE has to be another type (non-generic from the DDIC or a table field or a type defined behind TYPES in the program), whereas LIKE can be an arbitrary data object, which is declared at this point of the program.
Hope this helps
regards
Martin Lehmann
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The differenec will be that the second case will be faster for the reason that the system actually go to the table field and see what type it is and then allocate memory to your variable/interface parameter.
In the second case the system allocates the memory to that variable as per the data element it referred.
To sum up.
1st case indirect.
2nd case direct.
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.