2007 Dec 26 11:10 AM
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
2007 Dec 26 11:14 AM
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
2007 Dec 26 11:14 AM
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?
2007 Dec 26 11:24 AM
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
2007 Dec 26 11:32 AM
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
2007 Dec 26 11:16 AM
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
2007 Dec 26 11:28 AM
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*
2007 Dec 26 12:09 PM
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.
2007 Dec 28 6:14 AM
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
2007 Dec 26 11:56 AM
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.
2007 Dec 28 6:09 AM
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