‎2008 Jul 02 6:38 AM
Hi All,
Is
if not itab is initial same as if not itab[] is initial?
Regards,
Jeetu
‎2008 Jul 03 2:23 PM
HI
No, Both are not one and the same when you write some thing like below
IF NOT itab IS INITIAL.
---
ENDIF.
here if the table you created has header line then it will check whether all the fields in header line are set to initial value or not .if it is initial then the result of the expression will be FALSE because NOT always reverses the result of expression .If the table does not contain any header line then it will through an error.
NOT behaviour
TRUE will become FALSE
FALSE will become TRUE
IF NOT itab[] IS INITIAL.
---
ENDIF.
Here you are directly validating the body of the table that means whether tha table has any line or not
itab is Header line or work area
itab[] is Body of the internal table
Hope this gives you and idea
Regards
Pavan
Edited by: Pavan Bhamidipati on Jul 3, 2008 3:24 PM
‎2008 Jul 02 6:40 AM
itab means header line of internal table and itab[] means body of internal table.
‎2008 Jul 02 6:41 AM
Hi,
itab - header line of internal table
itab[] - Body of internal table
Regards,
V.balaji
‎2008 Jul 02 6:42 AM
dey r not same...first statement 'll only check the header line which is simplay a work area associateed with internal table and the second will check actual contents of internal table..
plz reward points if dis helps
‎2008 Jul 02 6:42 AM
hi,
Both are same if you have not declared the internal table with out header line at the time of declaration.If you declare internal table with header line then the 'if not itab is initial' checks for the header line and 'if not itab[] is initial' checks for contents of internal table.
Regards,
Veeresh
‎2008 Jul 02 6:49 AM
Hi,
1.itab is initial : checks if itab headerline i.e workarea is initial i.e empty.
2.itab[] is initial : checks if itab body is initial.
if the above itab is declared with headerline.
Both will be same if you declare the internal table with out header line.
hope this help you.
plz reward if useful.
thanks,
dhanashri.
‎2008 Jul 02 6:50 AM
hi,
it is not same.
because we need to specify the body..
then only it will check wether the body contains records or not.
if we are not specifying the body it will consider as work area.
Regards,
venkat n
‎2008 Jul 02 7:30 AM
Hi Jeetu,
Actually when we declare the internal table with header line, then to distinguish between the work area and the internal table itself, we use this notation.
itab[] means your work area and
itab means your internal table.
Reward if it proves useful.
Regards
Natasha Garg
‎2008 Jul 03 1:40 PM
Hi,
when we declare the internaltable without headerline
there is no difference between itab and itab[].
if we declare the internaltable with header line
itab menas it showing body,header and itab[] menas body only.
please check in debugger mode you can get good idea.
Regards,
Suresh.
‎2008 Jul 03 2:04 PM
HI jeetu,
there is a simple rule if any internal table created in sap is having an header line,then itab[] would always refer to internal table body contents and itab without square brackets([]) would refer to the header line contents.
thnks.
‎2008 Jul 03 2:23 PM
HI
No, Both are not one and the same when you write some thing like below
IF NOT itab IS INITIAL.
---
ENDIF.
here if the table you created has header line then it will check whether all the fields in header line are set to initial value or not .if it is initial then the result of the expression will be FALSE because NOT always reverses the result of expression .If the table does not contain any header line then it will through an error.
NOT behaviour
TRUE will become FALSE
FALSE will become TRUE
IF NOT itab[] IS INITIAL.
---
ENDIF.
Here you are directly validating the body of the table that means whether tha table has any line or not
itab is Header line or work area
itab[] is Body of the internal table
Hope this gives you and idea
Regards
Pavan
Edited by: Pavan Bhamidipati on Jul 3, 2008 3:24 PM