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 Table inside Internal Table, possible ?

Former Member
0 Likes
3,056

Hello SDN s,

how ya all doin ?

Our requirement is like this, we need to create Internal Table inside another Internal Table.

1 st of all is that possible ? if Yes how to do that ? it will be helpful if u explain with some sample codes.

Best Regards....

Sankar Kumar

+91 98403 47141

8 REPLIES 8
Read only

Former Member
0 Likes
1,430

Hi,

It is possible..

Refer to the code below ..

i have tested it..

DATA: BEGIN OF IT_TEXT OCCURS 100.

INCLUDE STRUCTURE TLINE.

DATA: END OF IT_TEXT.

DATA: BEGIN OF PO_TEXT OCCURS 1,

AUFNR like CAUFV-AUFNR,

AUART like CAUFV-AUART,

GSTRP like CAUFV-GSTRP,

IT_TEXT1 like IT_TEXT occurs 0,

END OF PO_TEXT.

Also refer to this thread..

Regards,

Tanveer.

Please mark helpful answers.

Read only

Former Member
0 Likes
1,430

Hi Maran,

Yes its possible and in SAP is its called as DEEP table.

Its defined as you normally define a internal table using a structure. In this case you need to use a already defined internal table for defining the DEEP internal table.

Cheers

VJ

Read only

Former Member
0 Likes
1,430

USE THIS WAY

DATA: BEGIN OF ITAB1 OCCURS 0.

FIELD1,

FIELD2,

END OF ITAB1.

DATA: BEGIN OF ITAB2 OCCURS 0.

FIELD3,

FIELD4,

END OF ITAB2.

DATA: BEGIN OF ITAB OCCURS 0.

FIELD1,

FIELD2,

FIELD3,

FIELD4,

END OF ITAB.

NOW BY USING SELECT AND READ QUERY U CAN POPULATED ALL THE DATA OF ITAB1 AND ITAB2 INTO SINGLE INTERNAL TABLE ITAB.

Read only

Former Member
0 Likes
1,430

Yes u can use nested internal tables..

Refer this link..

http://help.sap.com/saphelp_bw31/helpdata/en/9f/db9eaa35c111d1829f0000e829fbfe/content.htm

Reward points if it helps.

With Regards,

Manikandan R

Read only

Former Member
0 Likes
1,430

hi maran,

look at the following thread for a similar discussion..

regards

satesh

Message was edited by: Satesh R

Read only

Former Member
0 Likes
1,430

Hi,

These are called nested internal tables.

You can create the same in different ways.

TYPES : BEING OF TYPE_TABLE,

FIELD1 TYPE C,

STYLE TYPE LVC_T_STYL,

END OF TYPE_TABLE.

DATA : T_dATA TYPE TABLE OF TYPE_TABLE.

As STYLE points to a TABLE by itself, it becomes a nested internal table. Now, for every row of Field1, STYLE can have multiple rows.

Regards,

Ravi

NOte : Please mark the helpful answers

Read only

Former Member
0 Likes
1,430

Hi Maran

Internal table inside internal table means Nested Internal Tables

ya its possible

jus have a look overr

First Internal Table type

types: begin of itab1 occurs 10,

f1 type i,

f2 type n,

end of itab.

Second internal table type having first internal table as its component:

types: begin of itab2 occurs 20,

f3 type n,

itab type itab1,

end of itab2.

now you can deifin your internal table as

data itab_final type table of itab2.

Thanks

Read only

Former Member
0 Likes
1,430

Hi Maran,

It is possible and it is known as DEEP Table.

Check this link

<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/frameset.htm">Deep table</a>

OR

Here is an example:

TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.

TYPES: BEGIN OF LINE,

COLUMN1 TYPE I,

COLUMN2 TYPE I,

COLUMN3 TYPE I,

END OF LINE.

TYPES ITAB TYPE SORTED TABLE OF LINE WITH UNIQUE KEY COLUMN1.

TYPES: BEGIN OF DEEPLINE,

FIELD TYPE C,

TABLE1 TYPE VECTOR,

TABLE2 TYPE ITAB,

END OF DEEPLINE.

TYPES DEEPTABLE TYPE STANDARD TABLE OF DEEPLINE

WITH DEFAULT KEY.

The program defines a table type VECTOR with type hashed table, the elementary line type I and a unique key of the entire table line. The second table type is the same as in the previous example. The structure DEEPLINE contains the internal table as a component. The table type DEEPTABLE has the line type DEEPLINE. Therefore, the elements of this internal table are themselves internal tables. The key is the default key - in this case the column FIELD. The key is non-unique, since the table is a standard table.

Hope it helps...

Lokesh

pls. reward appropriate points