‎2008 Mar 26 5:40 AM
Hi All,
I have a concern on the declaration of Internal tables:
As per my knowledge, i can declare the internal table in the following ways :
1. Data : Begin of Internal table name occurs 0,
field 1, field 2, field 3...
End of Internal table name.
2. Types : Begin of structure name,
field names,
end of structure name.
Data : Internal table name type standard table of structure name,
workarea type internal table name.
Now can I create a Internal table without DATA statement directly i.e., by using Types statement can i create a Internal table or not?
Please clarify..
‎2008 Mar 26 6:23 AM
yes but best way to do this is
TYPES: BEGIN OF t_ekko,
bukrs TYPE bukrs,
lifnr TYPE lifnr,
rlwrt TYPE rlwrt,
ebeln TYPE ebeln,
aedat TYPE aedat,
END OF t_ekko.
DATA: w_ekko TYPE t_ekko,
i_ekko TYPE TABLE OF t_ekko.
it will improve ur efficiency.
‎2008 Mar 26 5:44 AM
hi,
Yes you can do that
types : begin of <str>,
fld1,
fld2,
fld3,
end of <str>.
data itab *type* str occurs o with header line.You can only use like this
the difference is
DATA -> LIKE
TYPES -> TYPE
Regards,
V.Balaji
Reward if Usefull...
‎2008 Mar 26 5:44 AM
Types mean indicating the characteristic of the data. Only if u create a data variable you can hold data.
‎2008 Mar 26 5:44 AM
By using TYPE statement we are not actually creating internal table, it is like defining the structure. We use the definition later and define internal table with DATA statement. Memory allocation happens only with variables are defined with DATA statement.
‎2008 Mar 26 5:45 AM
Hi,
By using types u declare the structure that cant contain data, means it doesn't have body or hat for containig data .
that u have to define using data statement .
reward if doubt is clear
‎2008 Mar 26 5:45 AM
yes u can, see the below example:
TYPES : BEGIN OF ty_lfa1 ,
lifnr TYPE lfa1-lifnr ,
name1 TYPE lfa1-name1 ,
END OF ty_lfa1 .
DATA : i_lfa1 TYPE STANDARD TABLE OF ty_lfa1 ,
w_lfa1 TYPE ty_lfa1.
‎2008 Mar 26 5:46 AM
Hi,
U cannot create any data-obj using only types statement
u hav to either use data / create data statements......
Cheers,
jose.
‎2008 Mar 26 5:47 AM
Hi
you cannot create internal tables without using data.you can create structure by using types then you write data for creating internal table for that structure.
for example...
*................structure declaration
types:begin of st_kna1,
kunnr type kunnr,
name1 type name1_gp,
land1 type land1_gp,
end of st_kna1.
*...............work area , internal table declaration
data:wa_kna1 type st_kna1,
it_kna1 type standard table of st_kna1.
‎2008 Mar 26 5:49 AM
Hi Ramesh,
Yes u can create an internal table using TYPES.Try below
statement.
TYPES BEGIN OF struc_type.
...
{TYPES dtype ...} | {INCLUDE {TYPE|STRUCTURE} ...}.
...
TYPES END OF struc_type.
Regards
Lakshman
‎2008 Mar 26 5:52 AM
Hi,
So i can create an Internal table with out Data statement.am i correct?
‎2008 Mar 26 6:00 AM
U have to use Data statement to create an internal table ..
Using types UR just declaring the structure .. and not internal table ..
‎2008 Mar 26 6:10 AM
Thanks for the information.
still i have the following concern: see, when ever we use occurs statement then it indicates Internal table.
But here if we use Types and Data statment, we are not using occurs statement. then how do we know whether this is an internal table or not?
for ex 😕
Types : Begin of Structure,
fields,
End of Structure.
Data : Internal table type table type of structure.
here in the above statement, we are not using the occurs statement. now how the system is allocating the memory to the table? Please clarify/.
‎2008 Mar 26 6:14 AM
Considering your example:
Types : Begin of Structure, " Just a plain Definition
fields,
End of Structure.
Data : Internal table type table type of structure." Internal table declaration. Note the TYPE TABLE in the definition
DATA: WA type structure. " This is like the Work Area/ Header
‎2008 Mar 26 6:18 AM
Hi,
see data statement is mandatory to declare an int-table
1) data : begin of itab occurs 0 ,
............
end of itab.
2) data itab type table of srtuc.
3) data itab type tab_type. ( here tab_type is a table type ex 'SOLI_TAB' see this in SE11).
also check the syntax of create data statement in keyword help F1.....
Cheers,
jose.
‎2008 Mar 26 6:33 AM
Hi ramesh
when u use
Types : Begin of Structure,
fields,
End of Structure.
Data : Internal table type table type of structure.
it means that only WORK AREA or HEADER is alone created and not the body.
If u specify OCCURS only then body is created.
Regards
Lakshman
‎2008 Mar 26 5:51 AM
when using Types it is considered as local Data type or local
structured Data Type.
U can create structure type with Types statment
and cannot create an internal table with Types declaration.
Types:begin of str,----->Local Structure type
f1
f2
end of str.
Data:itab type table of str
Data:begin of str, -
>Data Object
f1
f2
end of str.
Data:itab like table of str .
Regards,
priya
‎2008 Mar 26 5:52 AM
hi
yes u can do it man...
TYPES : BEGIN OF ty_itab,
bukrs LIKE bkpf-bukrs,
gjahr LIKE bkpf-gjahr,
monat LIKE bkpf-monat,
blart LIKE bkpf-blart,
END OF ty_itab.
DATA : it_itab TYPE STANDARD TABLE OF ty_itab,
wa_itab TYPE ty_itab.
wa_itab is the working aria....
it_itab is the internal table...
cheers
nawa
‎2008 Mar 26 5:56 AM
when using types statment and declare it is not considered as
internal table it is a structure type
when using Types it is considered as local Data type or local
structured Data Type.
U can create structure type with Types statment
and cannot create an internal table with Types declaration.
Types:begin of str,----->Local Structure type
f1
f2
end of str.
Data:itab type table of str
Data:begin of str, -
>Data Object
f1
f2
end of str.
Data:itab like table of str .
Regards,
priya
‎2008 Mar 26 6:13 AM
Yes , You Can. Read the Following :
Creating Internal Table Data Types
To create an internal table data type, you use the TYPES statement as follows:
Syntax
TYPES <t> <type> OCCURS <n>.
This creates an internal table data type <t> by using the OCCURS option of the TYPES statement. The lines of the internal table have the data type specified in <type>. To specify the data type of the lines, you can use either the TYPE or the LIKE parameter.
TYPES: BEGIN OF LINE,
COLUMN1 TYPE I,
COLUMN2 TYPE I,
COLUMN3 TYPE I,
END OF LINE.
TYPES ITAB TYPE LINE OCCURS 10.
This example creates an internal table data type ITAB which has lines with the same structure as the field string LINE.
Reward Point if Useful.
‎2008 Mar 26 6:15 AM
when Using types statment it donot have any memory space allocated.
while using Data:itab like or type table of structure. or occurs 0 it is considered as an internal table.
occurs 0 ---used for internal table with header line
like or type table of structure-->used for without header line
here only memory is allocated. not during Types.
reward if helpful
regards,
priya
‎2008 Mar 26 6:23 AM
yes but best way to do this is
TYPES: BEGIN OF t_ekko,
bukrs TYPE bukrs,
lifnr TYPE lifnr,
rlwrt TYPE rlwrt,
ebeln TYPE ebeln,
aedat TYPE aedat,
END OF t_ekko.
DATA: w_ekko TYPE t_ekko,
i_ekko TYPE TABLE OF t_ekko.
it will improve ur efficiency.
‎2008 Mar 26 7:31 AM
Hi you can do That
TYPES: BEGIN OF TY_BSID,
BUKRS LIKE BSID-BUKRS,
KUNNR LIKE BSID-KUNNR,
PSWBT LIKE BSID-PSWBT,
END OF TY_BSID
reward if usefull.