‎2008 Aug 22 8:29 AM
Hi,everybody
I am confused what different between 'itab' and 'itab[]' ? ( itab refers to a inner table )
How to use them in a correct place?
Please give me some example and code , thanks!
‎2008 Aug 22 8:31 AM
Hi,
Itab[] means the Body of the Internal table and Itab means the Header line of internal table.
For details Check this link-
http://www.sap-img.com/abap/with-header-without-header-internal-table.htm
‎2008 Aug 22 8:31 AM
Hi,
Itab[] means the Body of the Internal table and Itab means the Header line of internal table.
For details Check this link-
http://www.sap-img.com/abap/with-header-without-header-internal-table.htm
‎2008 Aug 22 8:33 AM
thanks for your anwser ,but could you tell me how to use them in different situation.
‎2008 Aug 22 8:36 AM
when you speak itab and itab[] if the table created with Header line , then itab represents the header and itab[] represents the body.
When you refer the table with out header line then there is no difference between them.
>how to use them in different situation
In latest editions you have to use/decalre the tables with out header lines. so in that case you can directly use itab.
‎2008 Aug 22 8:38 AM
Hi,
When you are Creating Internal table with Header line addition then A work area with the same type of Internal table is created automatically by System.No need to declare the work area separately.
For Accessing the records of the Intaenal table you can use this header line as work area.
Check this link for Sample code-
Check this link for screen shots-
http://sap.mis.cmich.edu/sap-abap/abap04/sld012.htm
Regards,
Sujit
‎2008 Aug 22 9:01 AM
>
> Hi,
>
>
> Itab[] means the Body of the Internal table and Itab means the Header line of internal table.
>
> For details Check this link-
>
> http://www.sap-img.com/abap/with-header-without-header-internal-table.htm
WRONG
For example.
DATA: itab TYPE HASHED TABLE OF mara WITH UNIQUE-KEY matnritab here refers only to the table contents. itab[] will also refer to the table contents. There is a difference between the two only for tables with header line.
Now, I wish I'd got to this thread earlier, but in the event someone else reads it, I'll repeat what I've often said.
The use of tables with header lines is BAD programming practice SAP have acknowledged this themselves, by banning their use in ABAP Objects. Always define your table and work areas seperately. Also learn about the different table types, and what they're used for. If you persist in using tables with header lines, you'll never get the advantages offered by hashed or sorted tables.
matt
‎2008 Aug 22 9:01 AM
>
> Hi,
>
> When you are Creating Internal table with Header line addition then A work area with the same type of Internal table is created automatically by System.No need to declare the work area separately.
>
> Regards,
> Sujit
Bad programming practice
‎2008 Aug 22 8:31 AM
hi chen
Lets say itab is defined as an internal table with header line .
then itab = contains the header data
itab[] contains the whole data in the internal table .
~hitesh
‎2008 Aug 22 8:34 AM
itab refers to the internal table with header line (if specified)
However itab[] refers to the body of the table without the header line.
itab[3] refers to the third row of the table
Hope this clears your doubt!
Regards,
Prashant
‎2008 Aug 22 9:05 AM
>
> itab refers to the internal table with header line (if specified)
>
> However itab[] refers to the body of the table without the header line.
>
> itab[3] refers to the third row of the table
>
> Hope this clears your doubt!
>
> Regards,
> Prashant
itab[3] only refers to the third row of the table in the debugger. I am not aware that indexed row access has ever been permitted or is part of the syntax of the ABAP language. Even if it were, it would not work for non-indexed tables.
‎2008 Aug 22 8:35 AM
hi ,
itab is work area or header line
itab[] is body...
this is STructure
TYPES : BEGIN OF ty_qpac,
codegruppe TYPE qpac-codegruppe, " CODE GROUP
code TYPE qpac-code , " CODE
bewertung TYPE qpac-bewertung, " CODE VALUATION
fehlklasse TYPE qpac-fehlklasse, " DEFECT CLASS
qkennzahl TYPE qpac-qkennzahl, " QUALITY SCORE
feldname TYPE qpac-feldname, " POSTING PROPOSAL
bb_dunkel TYPE qpac-bb_dunkel, " STOCK SCREEN BACKGROUND PROCESSING
folgeakti TYPE qpac-folgeakti, " FOLLOW-UP ACTION
text(30) , " Error text
END OF ty_qpac.
Data : it_qpac TYPE TABLE OF ty_qpac, " body
wa_qpac TYPE ty_qpac. " work Area
With the help of work area , data is moved into the body
With Regards.
Always Learner
‎2008 Aug 22 8:35 AM
Hi,
Itab[] means the body of the Internal table & Itab means the header line of internal table i.e workarea of internal table.
this is the case when we declare the internal table with headerline.
example :
suppose we have internal table with headerline.
data : itab type standard table of mara with headerline.
and here we need to check it's initiality then we write ,
if not itab[] is initial.
to move the data into table we write.
itab[] = itab1[].
itab refers juz a workarea that is need to read one by one record.
hope this helps.
thanks,
dhanashri.
Edited by: Dhanashri Pawar on Aug 22, 2008 9:37 AM
‎2008 Aug 22 8:35 AM
'itab' : work area of Internal table
'itab[]' : Internal table with header Line
rgds
rajesh
Edited by: RAJESH KUMAR on Aug 22, 2008 1:05 PM
‎2008 Aug 22 8:41 AM
If internal table contains header line, you can use this.
here itab refers as work area.
Example:
LOOP AT itab1.
itab = itab1. "means data is hold only by header line.
Clear itab. " header line is refreshed.
Endloop.
Now,
loop itab
itab will now have any contents as it is not pushed to the internal table content list.
Endloop.
Coming to itab[]. " it describe the contents of internal table
itab[] = itab1[]. " all contents of itab1 will be populated to itab
Loop at itab.
it will have all contents of itab i.e. contents pushed above.
Endloop.
Regards,
SaiRam