2007 Jul 26 7:37 AM
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
2007 Jul 26 7:38 AM
Hi,
these 2 Internal tables may contain the Headers also
Regards
Sudheer
2007 Jul 26 7:39 AM
2007 Jul 26 7:40 AM
2007 Jul 26 7:41 AM
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
2007 Jul 26 7:42 AM
2007 Jul 26 8:38 AM
2007 Jul 26 8:44 AM
2007 Jul 26 9:18 AM
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
2007 Jul 26 9:54 AM
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.....
2007 Jul 26 10:13 AM
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