Application Development 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: 

How to declare internal table with types

Former Member
0 Kudos
2,522

Hi to all,

how to declare internal table with types,

here iam declaring internal table with types but it shows error

where i done a mistake.

tables : /bi0/pplant.

types : begin of i_plant,

plant type plant,

country type county,

region type region,

types : end of i_plant.

data : itab type table of i_plant,

wa type line of i_plant.

please reply....

thanks and regards,

swami

10 REPLIES 10

former_member386202
Active Contributor
0 Kudos
315

Hi,

Declare like this

types : begin of i_plant,

plant type plant,

country type county,

region type region,

end of i_plant.

data : itab type table of i_plant,

wa type i_plant.

Regards,

prashant

Former Member
0 Kudos
315

types : begin of i_plant,

plant type plant,

country type county,

region type region,

end of i_plant.

data : itab type standard table of i_plant,

data: wa type i_plant.

Check. Are you still facing any error?

0 Kudos
315

Hi to all,

it shows that the type plant is unknow.

so what i have to do for this..

how to rectify this error...

Thanks and regards,

swami

0 Kudos
315

Hi,

types : begin of i_plant,

plant type werks_d,

country type LAND1_GP,

region type REGIO,

types : end of i_plant.

data : itab type table of i_plant,

wa type line of i_plant.

regards,

Santosh Thorat

Former Member
0 Kudos
315

hi,

check this code..

TYPES : BEGIN OF i_plant,

plant TYPE plant,

country TYPE country, "Check here its country

region TYPE region.

TYPES : END OF i_plant.

DATA : itab TYPE TABLE OF i_plant,

wa TYPE i_plant. "Check here

Regds

Sivaparvathi

Please reward points if helpful...

Edited by: Siva Parvathi on Dec 26, 2007 12:17 PM

Former Member
0 Kudos
315

Hi,

Declaration like this

Types : begin of i_plant,

plant type plant,

country type country,

region type region,

end of i_plant.

data : itab_plant type standard table of i_plant,

wa_plant type i_plant.

Note down the bold parts of the internal table declaration with your code you will get the difference between your code and problem you experienced.

Thanks,

Sakthi C

*Rewards if usefull*

0 Kudos
315

see here it shows error

types: begin of i_plant,

plant type plant,

country type county,

region type region,

end of i_plant.

bold The type "PLANT" is unknown, but there is a type with the similar name bold

How to rectify this error..

Thanks and Regards,

Swami.

0 Kudos
315

Hi,

tables : /bi0/pplant.

types : begin of i_plant,

plant type /bi0/plant,

country type /bi0/county,

region type /bi0/region,

types : end of i_plant.

data : itab like i_plant occurs 0 with header line,

wa type line of i_plant.

Regards

Former Member
0 Kudos
315

hi swaminath,

The following explanation could help u out in finding ur error.

Creating Internal Tables

By using Type statement

Types : begin of line,

column1 type I,

column2 type I,

end of line.

Using TYPES we cannot create an internal table.

Data itab type line occurs 10.

Internal table itab is created with the same structure as internal table data type line.

The TYPES statement creates a structure LINE as defined.

In the next line when we say DATA : itab type line occurs 10. An internal table itab is created with the structure of LINE.

Besides declaring the structure of an internal table, the OCCURS clause also defines how many table entries are maintained in main storage. Extra records are written out to paging area and can effect performance.

EXAMPLE:

TYPES : begin of line,

empno type I,

empname(20) type c ,

end of line.

By using DATA statement we need to create internal table by referring to TYPES data type.

Example:

DATA t_line TYPE line OCCURS 10 with header line

If you look at the example, it becomes clear that an internal table t_line is created of the type LINE . The table can hold 10 records and also has an header line., where LINE could be another internal table or a transparent table.

Reward if useful

Thank you,

Regards.

Former Member
0 Kudos
315

hi,

if plant is a field referred from some database table then u need to refer that table in the types statement.

like if there is feild called plant in the table - /bi0/pplant

then declare like this :

types : begin of i_plant,

plant type /bi0/pplant-plant, " changes here

country type county,

region type region,

end of i_plant. "changes here