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

how to declare internal table

Former Member
0 Likes
4,138

hi guru

please tell me how to declare int. table in real time with example.

i want how to write with types keyward.

regards

subhasis

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,116
************************************************************************
* Table Declaration *
************************************************************************
TABLES: mara,
marc,
mard.
************************************************************************
* Types Declaration *
************************************************************************
TYPES: BEGIN OF typ_mara,
matnr TYPE mara-matnr, "Material Number"
mbrsh TYPE mara-mbrsh, "Industrial Sector"
mtart TYPE mara-mtart, "Material Type"
meins TYPE mara-meins, "Base Unit of Measure"
END OF typ_mara.

TYPES: BEGIN OF typ_makt,
matnr TYPE makt-matnr, "Material Number"
maktx TYPE makt-maktx, "Material Description"
END OF typ_makt.

TYPES: BEGIN OF typ_marc,
matnr TYPE marc-matnr, "Material Number"
werks TYPE marc-werks, "Plant Number"
END OF typ_marc.

TYPES: BEGIN OF typ_mard,
matnr TYPE marc-matnr, "Material Number"
werks TYPE marc-werks, "Plant Number"
lgort TYPE mard-lgort, "Storage Location"
END OF typ_mard.
************************************************************************
* Intrnal tables Declaration *
************************************************************************
DATA: it_mara TYPE STANDARD TABLE OF typ_mara WITH HEADER LINE.
DATA: it_makt TYPE STANDARD TABLE OF typ_makt WITH HEADER LINE.
DATA: it_marc TYPE STANDARD TABLE OF typ_marc WITH HEADER LINE.
DATA: it_mard TYPE STANDARD TABLE OF typ_mard WITH HEADER LINE.

hi guru

please tell me how to declare int. table in real time with example.

i want how to write with types keyward.

regards

subhasis

5 REPLIES 5
Read only

Former Member
0 Likes
1,117
************************************************************************
* Table Declaration *
************************************************************************
TABLES: mara,
marc,
mard.
************************************************************************
* Types Declaration *
************************************************************************
TYPES: BEGIN OF typ_mara,
matnr TYPE mara-matnr, "Material Number"
mbrsh TYPE mara-mbrsh, "Industrial Sector"
mtart TYPE mara-mtart, "Material Type"
meins TYPE mara-meins, "Base Unit of Measure"
END OF typ_mara.

TYPES: BEGIN OF typ_makt,
matnr TYPE makt-matnr, "Material Number"
maktx TYPE makt-maktx, "Material Description"
END OF typ_makt.

TYPES: BEGIN OF typ_marc,
matnr TYPE marc-matnr, "Material Number"
werks TYPE marc-werks, "Plant Number"
END OF typ_marc.

TYPES: BEGIN OF typ_mard,
matnr TYPE marc-matnr, "Material Number"
werks TYPE marc-werks, "Plant Number"
lgort TYPE mard-lgort, "Storage Location"
END OF typ_mard.
************************************************************************
* Intrnal tables Declaration *
************************************************************************
DATA: it_mara TYPE STANDARD TABLE OF typ_mara WITH HEADER LINE.
DATA: it_makt TYPE STANDARD TABLE OF typ_makt WITH HEADER LINE.
DATA: it_marc TYPE STANDARD TABLE OF typ_marc WITH HEADER LINE.
DATA: it_mard TYPE STANDARD TABLE OF typ_mard WITH HEADER LINE.
Read only

former_member196299
Active Contributor
0 Likes
1,116

hi Subhasish ,

procees ike this .

types : begin of itab1,

field1 like tablename-fieldname,

field2 like tablename-fieldname,

end of itab1 .

data: itab2 type table of itab1 occurs 0 .

or

data: itab2 type itab1 occurs 0 with header line .

Regards,

Ranjita

Read only

Former Member
0 Likes
1,116

hi,

Check this thread for different scenarios of using internal table

Regards,

Santosh

Read only

Former Member
0 Likes
1,116

Hi,

In real time the ITABs declaration will be of without header line

Data : begin of t_type,

mara type mara-matnr,

Data : end of t_type.

  • table and work area

data : i_table type standard table of t_type,

wa type t_type.

Regards

Shiva

Read only

Former Member
0 Likes
1,116

No, u should not use header line statement or occurs 0 , it is not performance oriented

use the following code..

types : begin of ty_mara,

matnr type mara-matnr,

mtart type mara-mtart,

end of ty_mara,

ty_t_mara type standard table of ty_mara.

data : wa_mara type ty_mara,

it_mara type ty_t_mara.

here it_mara is the internal table and wa_mara is the work area..

it is the best way to define and to use also .

rewards ..

if helpful