‎2007 Aug 01 2:44 PM
‎2007 Aug 01 2:51 PM
Header line and Work Area are more or less same and serve the same purpose...
but difference is u have to declare work area variable separately..
header line of internal table is always of same structure as internal table .. but ur work area can be of different structure.. but there are some restrictions..
when u use LOOP ... ENDLOOP and READ TABLE staement... in case of header line..
u use :
LOOP AT itab.
ENDLOOP.
READ TABLE itab INDEX n.
table with header line.
LOOP AT itab INTO wa.
ENDLOOP.
READ TABLE itab INTO wa INDEX n.
Now use of itab with header line is obsolete..
u should use itab and work area..
in ABAP Objects u can't use itabs with header line..
Reward for useful answers
Regards
Pradeep
‎2007 Aug 01 2:48 PM
Head lines are part of your internal tables which holds the data of the line which has been read using the READ TABLE statement or the LOOP. A work area is an explicit variable with the same structure as your internal table which is used to read the line of the internal table into instead of using the header line. Header lines are obselete and you should always use explicit work areas.
Data: itab type table of mara.
data: wa like line of itab.Regards,
Rich Heilman
‎2007 Aug 01 2:49 PM
With ABAP's OO programming, you will not be able to use itabs with header lines, so you might as well start declaring those work areas.
it takes a little more time but it makes a lot of sense especially if you need to re-use the TYPES that are declared.
‎2007 Aug 01 2:49 PM
Hi,
While adding or retrieving records to / from internal table we have to keep the record temporarily.
The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
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. " this table will have the header line.
data: wa_itab like itab. " explicit work area for itab
data: itab1 like itab occurs 10. " table is without header line.
The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table
Regards
Sudheer
‎2007 Aug 01 2:49 PM
Hi,
Header Line of an internal table is nothing but the workarea.
But all workarea's might not be the header line.
If you define an internal table with header line, you would be able to create a workarea with the same name as of the internal table automatically. Then such header line could be used as a work area. But it is a standard now-a-days to use explicitly defined work areas of the same structure as that of the internal table.
<b>Reward points if this info helps,</b>
Kiran
‎2007 Aug 01 2:49 PM
Hi Srikanth,
While adding or retrieving records to / from internal table we have to keep the record temporarily.
The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
<b>Header line</b> 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. " this table will have the header line.
data: wa_itab like itab. " explicit work area for itab
data: itab1 like itab occurs 10. " table is without header line.
The<b> header line</b> is a field string with the same structure as a row of the body, but it can only hold a single row.
It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table.
<b>Work area is used to hold a single record</b>
When you declare a TABLE with TABLES : MARA statement
by default a work area of MARA is created and you can use a select single statement into MARA work area
Similarly with ITAB's if you delcare itab with header line, it creates a work area during run time first the record is fetched to header(work area) and is moved to body.
so every time the record comes to header and then moved to Itab body.
TYPES:
BEGIN OF t_bukrs,
bukrs LIKE t001-bukrs, "Company dode
butxt LIKE t001-butxt, "Name of company
END OF t_bukrs,
data gt_bukrs TYPE STANDARD TABLE OF t_bukrs. "table
data gs_bukrs TYPE t_bukrs." work area
select * from t001 into corresponding fields of table gt_bukrs.
loop at gt_bukrs into gs_bukrs.
write:/ gs_bukrs-bukrs.
endloop.
<b>Reward pts if found usefull :)</b>
Regards
Sathish
‎2007 Aug 01 2:51 PM
Header line and Work Area are more or less same and serve the same purpose...
but difference is u have to declare work area variable separately..
header line of internal table is always of same structure as internal table .. but ur work area can be of different structure.. but there are some restrictions..
when u use LOOP ... ENDLOOP and READ TABLE staement... in case of header line..
u use :
LOOP AT itab.
ENDLOOP.
READ TABLE itab INDEX n.
table with header line.
LOOP AT itab INTO wa.
ENDLOOP.
READ TABLE itab INTO wa INDEX n.
Now use of itab with header line is obsolete..
u should use itab and work area..
in ABAP Objects u can't use itabs with header line..
Reward for useful answers
Regards
Pradeep
‎2007 Aug 01 2:51 PM
Difference between Work Area and Header Line
While adding or retrieving records to / from internal table we have to keep the record temporarily.
The area where this record is kept is called as work area for the internal table. The area must have the same structure as that of internal table. An internal table consists of a body and an optional header line.
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. " this table will have the header line.
data: wa_itab like itab. " explicit work area for itab
data: itab1 like itab occurs 10. " table is without header line.
The header line is a field string with the same structure as a row of the body, but it can only hold a single row.
It is a buffer used to hold each record before it is added or each record as it is retrieved from the internal table. It is the default work area for the internal table.
‎2007 Aug 01 3:10 PM
Hi,
These are table with header line.
DATA: T_TABLE type table of <table_name> with header line. data: begin of t_table occurs 0,
field1 type ...
field2 type ...
field3 type ...
end of t_table.<b>The result is:</b>
<u><b>TABLE</b></u>
FIELD NAME |FIELD1|FIELD2|FIELD3|
HEADER LINE |EE1 |EE2 |EE3 | <---- Line 5 content
1|AA1 |AA2 |AA3 |
2|BB1 |BB2 |BB3 |
3|CC1 |CC2 |CC3 |
4|DD1 |DD2 |DD3 |
5|EE1 |EE2 |EE3 |
These are table without header line.
DATA: T_TABLE type table of <table_name>. DATA: T_TABLEX LIKE TABLE OF t_table.<b>The result is:</b>
<u><b>TABLE</b></u>
FIELD NAME |FIELD1|FIELD2|FIELD3|
0|--- |--- |--- | <---- No header Line
1|AA1 |AA2 |AA3 |
2|BB1 |BB2 |BB3 |
3|CC1 |CC2 |CC3 |
4|DD1 |DD2 |DD3 |
5|EE1 |EE2 |EE3 |These are work areas:
Tables <table>.
DATA: wa type <table>.
DATA: wa like t_table.
DATA: wa type line of <table>.
<b>The result is:</b>
<u><b>WORK AREA</b></u>
|EE1 |EE2 |EE3 | <---- ContentRegards.
Marcelo Ramos
‎2007 Aug 01 3:12 PM
hi,
there is no diff b/w header line and work area when we consider functionality.
header line - acts as a workarea for a table when it is created with header line.
ex: data: itab like mara occurs 0 with header line.
workarea - acts as a header for internal table with out header lines.
ex: data: itab like mara occurs 0.
wa like mara. [ wa is a external workarea for itab table]
if helpful reward some points.
with regards,
suresh aluri.