06-28-2008 7:14 AM
Hi,
I used to declare internal table as given below and use them in the program,
Data : int1 type Mara.
Data : int2 like Mara.
But recently i saw a syntax as given below,
Data: <internal table name> type <Table type>.
What is table type?
What is it use when declaring with internal table?
I saw table type in SE11 and entered MARA in table type but i got information that "No objects correspond to the selection criteria". Please give me example for "table type".
06-28-2008 10:37 AM
Hi,
In SE11 we can define a table type . And we can declare the internal table of that TYPE in our program .
We can define a table type in our program using
TYPES:
begin of fs_table,
carrid like spfli-carrid,
connid like spfli-connid,
end of fs_table.
TYPES:
t_table TYPE
standard table
of fs_table.
Now here t_table is not an internal table.
It is a table type. Memory is not allocated for this.
We can declare the internal table of TYPE t_table like
data:
t_tab1 type t_table.
Now t_tab1 is an internal table of TYPE t_table.
But the table type t_table is availabe within the program only.
When u create this TABLE TYPE in DICTIONARY then it is available globally.
using TYPE-POOLS also we can define datatypes which are available globally .
If we want to declare an object of the type which u created in type-pools then you should include the
TYPE-POOLS : <Type-pool> .
in your program.
Regards,
Rajitha.
06-28-2008 7:16 AM
Hi,
Please check this link
http://help.sap.com/saphelp_nw04/helpdata/en/90/8d7304b1af11d194f600a0c929b3c3/frameset.htm
A table type describes the structure and functional attributes of an internal table in ABAP. In ABAP programs you can reference a table type TTYP defined in the ABAP Dictionary with the command DATA <inttab> TYPE TTYP. An internal table <inttab> is created in the program with the attributes defined for TTYP in the ABAP Dictionary.
A table type is defined by:
--->its line type, that defines the structure and data type attributes of a line of the internal table
--->the options for managing and accessing the data ( access mode) in the internal table
--->the key ( key definition and key category) of the internal table
Use of Internal Table.
After selecting the data from the data base we need to process the data and display in the required format.
To process the data, first we get the data from the data base in to internal table and then we process it.
We generally use LIKE for standard structures and TYPE for the custom defined structures.
Best regatds,
raam
06-28-2008 7:27 AM
Hi,
refer the link below;
http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
by the statement
Data : int1 type Mara.
you are refering to the structure of mara...
regards,
pritam.
06-28-2008 7:28 AM
Hi,
Check this out......
You can specify the table type <tabkind> as follows:
ANY TABLE->
1.INDEX Table.
2.Hashed table.
In INDEX TABLE->
1.STANDARD TABLE.
2.SORTED TABLE.
Generic table types
INDEX TABLE
For creating a generic table type with index access.
ANY TABLE
For creating a fully-generic table type.
Data types defined using generic types can currently only be used for field symbols and for interface parameters in procedures . The generic type INDEX TABLE includes standard tables and sorted tables. These are the two table types for which index access is allowed. You cannot pass hashed tables to field symbols or interface parameters defined in this way. The generic type ANY TABLE can represent any table. You can pass tables of all three types to field symbols and interface parameters defined in this way. However, these field symbols and parameters will then only allow operations that are possible for all tables, that is, index operations are not allowed.
Fully-Specified Table Types
STANDARD TABLE or TABLE
For creating standard tables.
SORTED TABLE
For creating sorted tables.
HASHED TABLE
For creating hashed tables.
Fully-specified table types determine how the system will access the entries in the table in key operations. It uses a linear search for standard tables, a binary search for sorted tables, and a search using a hash algorithm for hashed tables.
Regards
Sujit Pal.
06-28-2008 9:53 AM
hi check this..
first method...
data: it_mara type table of mara .
second method
types: begin of ty_mara .
include structure mara.
types:end of ty_mara.
data: it_mara type standard table of ty_mara .
begin of occurs 0 statement is obsolate ...means not in use.
06-28-2008 10:37 AM
Hi,
In SE11 we can define a table type . And we can declare the internal table of that TYPE in our program .
We can define a table type in our program using
TYPES:
begin of fs_table,
carrid like spfli-carrid,
connid like spfli-connid,
end of fs_table.
TYPES:
t_table TYPE
standard table
of fs_table.
Now here t_table is not an internal table.
It is a table type. Memory is not allocated for this.
We can declare the internal table of TYPE t_table like
data:
t_tab1 type t_table.
Now t_tab1 is an internal table of TYPE t_table.
But the table type t_table is availabe within the program only.
When u create this TABLE TYPE in DICTIONARY then it is available globally.
using TYPE-POOLS also we can define datatypes which are available globally .
If we want to declare an object of the type which u created in type-pools then you should include the
TYPE-POOLS : <Type-pool> .
in your program.
Regards,
Rajitha.