Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reg :Internal tables

Former Member
0 Likes
794

Hi all,

any body send me that,

diff b/w internal tables and structures,

types and data declaration

Regards,

Ramu

Hi all,

any body send me that,

diff b/w internal tables and structures,

types and data declaration

Regards,

Ramu

6 REPLIES 6
Read only

Former Member
0 Likes
753

At the first place there should not be a comparision made between Internal tables and structures, as internal tables are defined with reference to structures.

Now coming to the functinality, Internal tables are defined to manipulate the data in the application program coming from the database (so that data in DB is not modified for requirements).

Structures are skeletons defined in the SAP dictionary to be used to define Internal tables, Tables parameters in Function modules, Screen fields in Module Pool programs, Etc...

Read only

0 Likes
753

Hi Naveen

Thanks for ur reply,

k what is diff b/w

types:

data:

Read only

0 Likes
753

Hi.....

<b>TYPES:</b>

You define local data types in a program using the

TYPES <t> ... [TYPE <type>|LIKE <obj>] ...

statement.

<b>DATA:</b>

DATA: To declare variables..

EX:

in your program if u have the following statements:

TYPES: number TYPE i,

length TYPE p DECIMALS 2,

code(3) TYPE c.

now number is a local datatype.

so u can declare other data objects as:

DATA NUM1 TYPE number.

This statement declares a variable with name <b>ABC</b> and type i,

Reward points if useful......

Suresh......

Read only

Former Member
0 Likes
753

Hi,

Example....

Say iam creating from SE11 (ABAP Dictionary) a,

1. Table "ZTABLE" and its fields are ....

1. Field1

2. Field2

3. Field3.

2. Structure "ZSTRU and its fields are .....

1. Field1

2. Field2

3. Field3.

I have written a program in which i have declared as follows :

-


COde -


1. Tables: ZTABLE,

2. Data : ls_zstru type zstru

lt_zstru type table of zstru.

Now, u can use this "ls_zstru" and append one by one row to the main table "ZTABLE".

like. ...

Loop at lt_zstru into ls_zstru.

.....

......

append ls_zstru to lt_zstru.

endloop.

Update .... ztable from lt_zstru.

-


COde -


Now, u can see that .... using the structure u can operate or work with ONE record per time and that too the record will be accessed / filled only at the runtime.....

where as u can append any number of entries to the table.

Just have a look at these links:

/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

https://www.sdn.sap.com/irj/sdn/advancedsearch?query=table%20and%20structure&cat=sdn_all

and for Types and Data..

1>TYPES statement defines the structure without allocation of memory, DATA statements allocate the memory at runtime.

2>create a structure by using types statement and refer it by using the DATA statement.

3>In order to avoid the internal table declaration without header line ,we are declaring a structure by types statemnet and declaring an internal table with reference to the structure.

and

check these threads...

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/content.htm

http://searchsap.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid21_gci1213769,00.html

If it helps reward with points..

Regards,

Rk

Hope this helps ..

Message was edited by:

Rk Pasupuleti

Read only

Former Member
0 Likes
753

The statement TYPES dtype defines either any independent data type dtype or a structured data type struc_type..

The statement DATA dobj either declares an arbitrary variable dobj or a structure struc

Read only

Former Member
0 Likes
753

Hi Mohan.....

<b>Structures:</b>

A structure (structured type) comprises components (fields). Types are defined for the components A component can refer to an elementary type (via a data element or by directly specifying the data type and length in the structure definition), another structure or a table type.

<b>Internal table:</b>

Internal tables are basically used to deal with the data either pushing into the database or pulling out of the application tables for the output purpose to show on the screen.

Internal tables are defined in ABAP programs, you can not define them in SE11 whereas structures are defined in SE11 and they work as a table itself.

Table types are defines in SE11,

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.

<b>A table type is defined by:</b>

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

<b>TYPES:</b>

ABAP distinguishes between types and objects. Types are descriptions that do not occupy memory. Objects are instances of types, and do occupy their own memory space. A type describes the technical attributes of all of the objects with that type.

<b>Declaration:</b>

Declaration is nothing but allocating memory for a variable.....

You can declare variables statically using the following statements:

DATA: To declare variables whose lifetime is linked to the context of the

Variables are named data objects that you can declare statically using declarative statements, or dynamically while a program is running.

Reward points if useful......

Suresh......