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

internal tabels

Former Member
0 Likes
1,147

what is the structure of an internal table

11 REPLIES 11
Read only

Former Member
0 Likes
1,124

Hi Suresh ,

Internal table do not have a standard structure , it depends upon how you declare it.

There are two ways of declaring an IT

1) Data : Begin of it_1 occurs 0 ,

matnr type matnr ,

werks type werks_d ,

End of it_1.

2) Types : Begin of ty_matnr ,

matnr type matnr ,

werks type werks_d,

End of ty_matnr.

Data : it_1 type table of ty_matnr.

The 2nd option is the prefered one.

Hope this answers your question.

Regards

Arun

Read only

Former Member
0 Likes
1,124

Hi,

You can create internal table

1) with refernce to DB table directly with header line.

2) Defining on structure with occur statement.

3) Defining from existing TYPES as 'type stanadard table of <type name>'

Thanks

Sandeep

Reward if helpful

Read only

Former Member
0 Likes
1,124

please go through the internal table declaration type's as follows

<b>Table declaration (old method)
DATA: BEGIN OF tab_ekpo OCCURS 0,             "itab with header line
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
 END OF tab_ekpo.

*Table declaration (new method)     "USE THIS WAY!!!
TYPES: BEGIN OF t_ekpo,
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
 END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
      wa_ekpo TYPE t_ekpo.                    "work area (header line)

* Build internal table and work area from existing internal table
DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
      wa_datatab LIKE LINE OF tab_ekpo.

* Build internal table and work area from existing internal table,
* adding additional fields
TYPES: BEGIN OF t_repdata.
        INCLUDE STRUCTURE tab_ekpo.  "could include EKKO table itself!!
TYPES: bukrs  TYPE ekpo-werks,
       bstyp  TYPE ekpo-bukrs.
TYPES: END OF t_repdata.
DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
      wa_repdata TYPE t_repdata.                 "work area (header line)

</b> 

Girish

Read only

Former Member
Read only

Former Member
0 Likes
1,124
Read only

Former Member
0 Likes
1,124

Line type is a structure of an Internal Table

Read only

Former Member
0 Likes
1,124

Line type is a structure of an Internal Table

Read only

Former Member
0 Likes
1,124

use following different possibilities,

TYPES: BEGIN OF mytext,

number TYPE i,

name(10) TYPE c,

END OF mytext.

TYPES mytab TYPE STANDARD TABLE OF mytext WITH DEFAULT KEY.

DATA: BEGIN OF IT_BKPF OCCURS 0,

BELNR LIKE BKPF-BELNR,

GJAHR LIKE BKPF-GJAHR,

BUKRS LIKE BKPF-BUKRS,

END OF IT_BKPF.

DATA : BEGIN OF IT_MATNR OCCURS 0.

INCLUDE STRUCTURE MAKT.

DATA : END OF IT_MATNR.

it may help you

Read only

Former Member
0 Likes
1,124

Hi Suresh

Internal table is the temporary table wherein you fetch all the datas from database and store it in the internal table for any modifications.

its structure can be of two types

1)with header line--->default work area will be created

2)without header line---->user wil create the work area

<u><b>With header line</b></u>

data : begin of itab occurs 0,

matnr like mara-matnr,

end of itab.

<u><b>Without header line</b></u>

data : begin of itab,

matnr type matnr,

end of itab.

REWARD IF USEFUL SURESH...!!

Read only

Former Member
0 Likes
1,124

hi suresh,

internal tables are nothing but a temporary table which is used to store data temporarily...

the structure of internal can be defined in 2 ways,

1) internal table with header line

2) internal table without header line.

1) internal table with header line:

in this the internal table will be having a work area.

definition :

DATA itab like DATABASE TABLE NAME OCCURS 0 with header line.

OR

DATA : begin of itab occurs 0,

field like DBtable-field,

End of itab.

2) internal table without header line:

in this the internal table will not be having any work area. You will have to define work area for that internal table.

definition :

DATA itab like DATABASE TABLE NAME without header line.

workarea:

DATA : WA like DATABASE TABLE NAME .

OR

DATA : begin of it,

field like DBtable-field,

End of itab.

data : itab like standard table of IT.

there are many ways by which u can define an internal table.

Also by using TYPES u can define internal table.

TYPES : begin of it,

field TYPE DBtable-field,

End of itab.

TYPES : ITAB type standard table of IT.

hope this will help u out.

please reward points in case usefull...

regards,

Prashant

Read only

Former Member
0 Likes
1,124

hi

thanks to all for responding to my query

regards

suri