‎2007 Oct 03 3:41 PM
Hi guys,
I wanted to know what difference does it make if i declare an internal table with header line and if i don't.
Is internal table with header line or without header line recommended.
Thanks and regards,
Girish.
‎2007 Oct 03 3:44 PM
Hi,
<b>with header line.</b>
data can be directly go to header first and will be placed in body when we used APPEND statement. cant be used for nesting of internal tables.
ex: data: itab like mara occurs 0 with header line.
or
itab like standard table of ekko with header line.
then itab is a internal with header line so u can use itab directly.
ex:
select * from itab INTO TABLE itab where matnr in p_matnr.
loop at itab.
write:/10 itab-fld1.
,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,
endloop.
<b>tables with out header line:</b>
for these tables we need to create a explicit header [workarea] and doing anything for data should be through that explicit header only.
ex:
data: itab like mara,
wa like mara.
itab is a internal table without header line [only body] and wa is the explicit workarea.
for this itab when u want to populate data u have to do like this.
select * from mara into wa where mantr in p_matnr.
append itab from wa.
endselect.
for accessing data of internal table
loop at itab into wa.
write:/10 wa-fld1,
................
............
endloop.
<b>With Header line:</b>
http://sap.mis.cmich.edu/sap-abap/abap04/sld012.htm
<b>Without Header line</b>
http://sap.mis.cmich.edu/sap-abap/abap04/sld013.htm
It is better to use the Internal tables without header lines, it is better for Performance
Regards
Sudheer
‎2007 Oct 03 3:45 PM
According to ABAP Objects ,you must use internal table without header line other wise you get syntax error.
other than this you can use internal table with header.
if you use internal table without header line then you get little bit good performance.
Thanks
Seshu
‎2007 Oct 03 3:46 PM
If you do not declare internal table with header line, you need to explicitly declare work area to work with that internal table.
As per ABAP standards we should declare work area explicitly and use the same while processing internal table.
For eg.
Loop at itab into watab.
your logic.
endloop.
See this thread which explains the point in detail
Message was edited by:
Ashish Gundawar
‎2007 Oct 03 3:49 PM
Hi,
itab with header lines are obsolete, anyway it will work but not recommended. instead use work area or more effiecient is field symbols. so donot use itab with header line.
i will explain use of itab w/o header line.
Data: itab1 type standard table of mara with header line occurs 0,
itab2 type standard table of mara,
wa_itab2 type mara.
loop at itab1.
"This will work fine.
endloop.
loop at itab2.
"This will give erro that itabd does not hav workarea
endloop.
"so write
loop at itab2 into wa_itab2.
"This will work
endloop.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb36a1358411d1829f0000e829fbfe/frameset.htm
Please give me reward point if it is useful.
Thanks
Murali Poli
‎2007 Oct 03 3:51 PM
performance point of view - without header line is good than with header line.
and in oops inveronment with header internal table is not allowed.
with out header line internal tables are called <b>nested internal tabels</b> in this we can include structures and it is not possible in case of with header line internal tables.
<b>if helpful reward some points.</b>