Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Initial check

Former Member
0 Likes
2,454

Hi All,

Is

if not itab is initial same as if not itab[] is initial?

Regards,

Jeetu

1 ACCEPTED SOLUTION
Read only

bpawanchand
Active Contributor
0 Likes
1,661

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

10 REPLIES 10
Read only

former_member188827
Active Contributor
0 Likes
1,661

itab means header line of internal table and itab[] means body of internal table.

Read only

Former Member
0 Likes
1,661

Hi,

itab - header line of internal table

itab[] - Body of internal table

Regards,

V.balaji

Read only

former_member188827
Active Contributor
0 Likes
1,661

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

Read only

former_member673464
Active Contributor
0 Likes
1,661

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

Read only

Former Member
0 Likes
1,661

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.

Read only

Former Member
0 Likes
1,661

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

Read only

Former Member
0 Likes
1,661

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

Read only

Former Member
0 Likes
1,661

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.

Read only

Former Member
0 Likes
1,661

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.

Read only

bpawanchand
Active Contributor
0 Likes
1,662

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