‎2007 May 20 8:24 PM
hello abap gurus,
i was trying to create an internal table of type of my ztable. and when i was trying to execute my program , it was giving error, as " table type does not have header line.
DATA: ITAB type ZTABLE with header line.
what is wrong in this, can some one help me with this.
thanks
‎2007 May 20 8:31 PM
Hello Saritha
The correct statement would be:
DATA:
itab TYPE ztable OCCURS 0 WITH HEADER LINE.However, using header lines is a sign of ppor ABAP programming. Do no use them anymore, they mess up any program.
Instead, use table types and work area as shown below:
DATA:
gt_itab TYPE STANDARD TABLE OF ztable, " table type
gs_line TYPE ZTABLE. " work area
LOOP AT gt_itab INTO gs_line.
...
ENDLOOP.Regards
Uwe
‎2007 May 20 8:29 PM
‎2007 May 20 8:31 PM
Hello Saritha
The correct statement would be:
DATA:
itab TYPE ztable OCCURS 0 WITH HEADER LINE.However, using header lines is a sign of ppor ABAP programming. Do no use them anymore, they mess up any program.
Instead, use table types and work area as shown below:
DATA:
gt_itab TYPE STANDARD TABLE OF ztable, " table type
gs_line TYPE ZTABLE. " work area
LOOP AT gt_itab INTO gs_line.
...
ENDLOOP.Regards
Uwe
‎2007 May 20 8:35 PM
‎2007 May 20 8:36 PM
For Better coding Standard :
<b>Internal table with header line :</b>
data : begin of itab occurs 0,
fld1 type c,
fld2 type c,
end of itab.
<b>Internal table without header line :</b>
Declare Structure
types : begin of ty_itab,
fld1 type c,
fld2 type i,
end of ty_itab
Internal table without header line
data i_itab type standard table of ty_itab
Work area
data wa_itab like line of i_itab.
Try to use always Internal table without header line.
Hope you got my point and please let me know if you have any question
Thanks
Seshu