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: 

Nested internal table with header line

former_member184111
Active Contributor
0 Kudos
729

Hi Experts,

I am preparing for the certification on ABAP and i encountered a question :

An internal table that is nested within another internal table should not contain a header line , state whetehre it is true or false.

Can you guys help me ?

Regards,

Anubhav jain

10 REPLIES 10

Former Member
0 Kudos
109

Hi,

these 2 Internal tables may contain the Headers also

Regards

Sudheer

Former Member
0 Kudos
109

true

gopi_narendra
Active Contributor
0 Kudos
109

False - It can contain a HEADER LINE .

Regards

Gopi

Former Member
0 Kudos
109

TRUE

becuase the outer loop internal table should be clear of the header so that the your data will be looped properly ... otherwise Duplicate of the last data ...

" means  the  outerloop will  have   last time   the  last data  in the header  ... so that  it 
" will retrieve the   data   as first time in the  inner loop  ..  and once  again    it will  
" retrive the   as  second time   last in  the outer  loop and last in the   inner  loop .

reward points if it is usefull .....

Girish

Former Member
0 Kudos
109

False - It can contain a header line

0 Kudos
109

Guys ,

An example would be useful.

Anubhav

0 Kudos
109

hi ,

I am changing my answer after confirmation from few of the threads :

Nested internal tables can't have header lines :true .

Please go through the following links so that the idea will be more clearer with examples .

Hope this will be of help !

Message was edited by:

Ranjita Kar

Pawan_Kesari
Active Contributor
0 Kudos
109

I think question is not talking about nested loop but the complex structures in which table is nested in strcuture.. In that case nested internal tabel cannot have header line

0 Kudos
109

Hi Ranjita,

in the thread given by you thers an exaplme of code as follows:

TYPES: BEGIN OF TYPE_DEEP,

MATNR TYPE MATNR,

<b>T_MARC TYPE MARC OCCURS 0,</b>

END OF TYPE_DEEP.

DATA: T_DEEP TYPE STANDARD TABLE OF TYPE_DEEP.

DATA: WA_DEEP TYPE TYPE_DEEP.

DATA: T_MARC TYPE TABLE OF MARC.

DATA: S_MARC TYPE MARC.

  • Populating data.

WA_DEEP-MATNR = 'TEST'.

S_MARC-MATNR = 'TEST'.

S_MARC-WERKS = '9090'.

APPEND S_MARC TO T_MARC.

  • Append second level internal table.

WA_DEEP-T_MARC[] = T_MARC[].

  • Append.

APPEND WA_DEEP TO T_DEEP.

  • Process the internal table.

LOOP AT T_DEEP INTO WA_DEEP.

WRITE: / WA_DEEP-MATNR.

  • PROCESS the second level internal table.

LOOP AT WA_DEEP-T_MARC INTO S_MARC.

WRITE: S_MARC-WERKS.

ENDLOOP.

ENDLOOP.

here nested internal table T_MARC contains a header line.....

0 Kudos
109

Please read and analise from all the threads about nested internal tables and their use , I think that will help you in solving your querry ..

There are even 2 more examples with the bit of descriptions . you need to analise from there

Check this one :

Nested internal tables are when you make a field which is TYPED with a TABLE TYPE.

That is one of your strucutre field is a TABLE TYPE so when you create a INTENRAL TABLE of this Strucutre this internal table field containes one of its field as another INTERNAL table.

They are also concidered DEEP STRUCUTRES as we will not the size of the internal table at the decleration time.

For example

DATA: begin of NES_STRUCT,

field1(10) type C,

nested_tab type table of SPFLI,

end of NES_STRUCT.

Now NES_STRUCT is a strcutre which has an internal table in it.

Now

DATA: IT_NES_STRUCT LIKE TABLE OF NES_STRUCT.

Now IT_NES_STRUCT is an intenral table with each record of it having a field with name "nested_tab" which is an internal table itself.

In this example it is clearly shown that Nested internal tables can not have a header line.

check for this link from help.sap.com for the use of nested internal tables :

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

Message was edited by:

Ranjita Kar