‎2008 Feb 07 2:29 PM
what is the diff between begin of itab occurs 0 and begin of itab occurs 0 with header line?plzz tell
‎2008 Feb 07 2:32 PM
Hi,
No difference
<REMOVED BY MODERATOR>
Gaurav J.
Edited by: Gaurav Juneja on Feb 7, 2008 3:32 PM
Edited by: Alvaro Tejada Galindo on Feb 7, 2008 6:20 PM
‎2008 Feb 07 2:33 PM
header line is like a structure inside your table allow you to work directly.
for example:
data : begin of it_toto occurs 0 ,
data1 type char10 ,
end of it_toto.
you could do.
move 'TOTO' to it_toto-data1.
append it_toto.
if you don't specify header line, you can't.
you will need to define :
data : begin of is_toto ,
data1 type char10 ,
end of is_toto.
move 'TOTO' to is_toto-data1.
append is_toto to it_toto.
‎2008 Feb 08 1:53 AM
Hi,
actually occurs 0 declares an internal table with header line by default. so no need to specify it again and no difference hence.
Regards,
Renjith Michael.
‎2008 Feb 08 2:55 AM
hi Srinath,
With Header line is used when a default work area has to be created while without header line wen u donot need work area.
however with header line is Obsolete now.
hope this answers ur question.
cheers,
Hema.
‎2008 Feb 08 3:05 AM
Prior to release 3.0, the only way you could create an internal table was by using the OCCURS addition with DATA: BEGIN OF <IT> ... END OF <IT>. All internal tables had header lines.
Since release 3.0 it was possible to create an internal table that referenced an existing type or structure using DATA: <IT> LIKE or TYPE, but to include the header line you needed to include the addition WITH HEADER LINE.
These features still exist in later releases for the sake of compatibility, but you will create an internal table with a header line in both cases. The difference is in how you create your table.
If you want to create an internal table and the fields of the table line you would use DATA: BEGIN OF <IT> OCCURS 0 ... END OF <IT>.
If you want to create an internal table with reference to an existing structure or type you would use DATA: <IT> LIKE|TYPE OCCURS 0 WITH HEADER LINE.
In both cases you will create an internal table with a header line, but to answer your specific question using your example:
"what is the diff between begin of itab occurs 0 and begin of itab occurs 0 with header line?"
you will not actually use "begin of itab occurs 0 with header line" as this will not compile, so it is not true to say that "begin of itab occurs 0 and begin of itab occurs 0 with header line" are the same.
They are not the same.
Regards
Kurt
‎2008 Feb 08 3:41 AM
hi,
there is no difference between those 2 statements both are same
there is no need to specify occurs 0 with header line
by default it is with header line only
‎2008 Feb 09 3:55 PM
Srinath
You ask a lot of stupid questions, and you very seldom reward points since you have so many outstanding questions.
Why is it that the level of difficulty for your questions is not consistent? Sometimes you seem like a beginer, and then sometimes you ask questions that are relevant for a senior developer, which means if you were a senior developer you should already know the answers to your beginer questions.
We spend our time helping you, so either start to reward people's efforts or stop asking questions.
Regards
Kurt
‎2008 Feb 09 4:01 PM
There is no difference, when defining internal table the old-way (BEGIN OF XXX OCCURS 0/END OF XXX) cause these internal tables have always a header.
The option WITH HEADER LINE is useful only when defining table via a TYPE : TYPE TABLE OF. these internal table have no header by default. (explicit TO xxx needed in LOOP and READ TABLE, or use pointer (field-symbols)
Remember that there are some old fashion syntax that are not allowed in OO/Class/BADI environment.
Regards
‎2008 Feb 09 4:05 PM
There is a difference, because his question was:
"what is the diff between begin of itab occurs 0 and begin of itab occurs 0 with header line?"
"begin of itab occurs 0 with header line" will not compile. Actually, some clients ask this at interviews, and if you say there is no difference, they will point out that the second part doesn't compile!
Regards
Kurt