2007 Feb 08 2:43 PM
i am learning the abap thats way i am asking these type of questions
plz tell me the answer.
2007 Feb 08 2:50 PM
• Internal tables with header line.
When you create internal tables with header line, and then default workarea or header is created. And you can work with this header.
• Internal Table without header line.
In this case you need to create output explicit workarea to work with table. Only advantage of internal tables without header line is that you can nest them i.e., you can have table within table, which is not possible on internal tables with header line.
Internal table consists of 2 parts
Header and Body
When we loop at an internal table , each record from body is taken into header line and processed.
an internal table can be declared with header line or without headerline
When we declare with header line it will loop as said above
when there is no headerline , then we have to declare workarea for that internal table and move one record at a time to internal table and then use that for processing
With header line.
DATA : BEGIN OF ITAB OCCURS 0,
FIELD1(10),
END OF ITAB.
LOOP AT ITAB.
ENDLOOP.
Without headerline
TYPES : BEGIN OF ITAB,
FIELD1(10),
END OF ITAB.
DATA : ITAB1 TYPE TABLE OF ITAB,
WA TYPE ITAB.
LOOP AT ITAB1 INTO WA.
ENDLOOP.
2007 Feb 08 2:47 PM
Internal tables have two parts.
header line &
Body area.
Header line can hols one record data. we append that record to the body area.
we can insert the data into body area irrespective of that itab having header line or not.
But we can not get the data from the body area directly for the internal table with out header line. For this we need to have another structure with the same siza of itab.
We can get the data of a record directly from the body,If itab is with header line.
Cheers.
2007 Feb 08 2:48 PM
When you declare a table with a header line, that means you have a temporary work area in the 'header' of an internal table. Without a header line, means that you will not need a header line or will use an explicit work area to be defined.
For example, when you use the READ command on an internal table, where is the read data stored? When using a header area, it automatically copies the information into the header. Without a header area you need to specify the work area used.
2007 Feb 08 2:50 PM
• Internal tables with header line.
When you create internal tables with header line, and then default workarea or header is created. And you can work with this header.
• Internal Table without header line.
In this case you need to create output explicit workarea to work with table. Only advantage of internal tables without header line is that you can nest them i.e., you can have table within table, which is not possible on internal tables with header line.
2007 Feb 08 2:51 PM
Internal table consists of 2 parts
Header and Body
When we loop at an internal table , each record from body is taken into header line and processed.
an internal table can be declared with header line or without headerline
When we declare with header line it will loop as said above
when there is no headerline , then we have to declare workarea for that internal table and move one record at a time to internal table and then use that for processing
With header line.
DATA : BEGIN OF ITAB OCCURS 0,
FIELD1(10),
END OF ITAB.
LOOP AT ITAB.
ENDLOOP.
Without headerline
TYPES : BEGIN OF ITAB,
FIELD1(10),
END OF ITAB.
DATA : ITAB1 TYPE TABLE OF ITAB,
WA TYPE ITAB.
LOOP AT ITAB1 INTO WA.
ENDLOOP.
2007 Feb 08 2:51 PM
HI,
The optional addition WITH HEADER LINE declares an extra data object with the same name and line type as the internal table. This data object is known as the header line of the internal table.When you use internal tables with header lines, you must remember that the header line and the body of the table have the same name. If you have an internal table with header line and you want to address the body of the table, you must indicate this by placing brackets after the table name (itab[]). Otherwise, ABAP interprets the name as the name of the header line and not of the body of the table. You can avoid this potential confusion by using internal tables without header lines. In particular, internal tables nested in structures or other internal tables must not have a header line, since this can lead to ambiguous expressions.
<b>It is not allowed to work with header lines in internal tables in classes. This statement is obsolete and is only available to ensure compatibility with Releases prior to 4.6 and 6.10</b>
Regards
Sudheer
2007 Feb 08 2:53 PM
Hi vikram,
Header line is a implicit work area for the internal table. It depends on how the internal table is declared that the itab will have the header line or not.
e.g.
data: begin of itab occurs 10,
ab type c,
cd type i,
end of itab.<b> " this table will have the header line. </b>
data: itab1 like itab occurs 10. <b>" table is without header line. </b>
<b>With header line</b>
Header line is a implicit work area of the internal table where it has the current index value of the internal table..
Example
-
DATA: BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
END OF ITAB.
ITAB-MATNR = 'ABC'. ""Moving the values to the header line.
APPEND ITAB. ""Append the values from the header line to the internal table..
<b>Without header line</b>
DATA: ITAB TYPE STANDARD TABLE OF MARA.
Workarea is requried to access the internal table records..as it is declared without header line..
DATA: WA TYPE MARA.
READ TABLE ITAB INTO WA INDEX 1.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |