Application Development 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: 

if not itab is initial

Former Member
0 Kudos

Hi.

please tell me what is the significance of " if not itab is initial."

and where it is to be placed in any code and please explain with example.

12 REPLIES 12

Former Member
0 Kudos

Hi,

It is used for all entries selection.....it checks whether there is any values is there any value or not.



if it_equz is not initial.
SELECT iloan
          tplnr
          msgrp
         INTO CORRESPONDING FIELDS OF TABLE it_iloa
          FROM iloa
          FOR ALL ENTRIES IN it_equz
          WHERE iloan = it_equz-iloan.
endif.

Regards

Debarshi

h_senden2
Active Contributor
0 Kudos

it checks whether itab is filled, where itab probably an internal table is.

regards,

Hans

Former Member
0 Kudos

if not itab is initial...

this is a very silly question.... try using debugger......

answer it yourself....

Former Member
0 Kudos

Hello,

I think u r new to ABAP

The statement

IF itab[] is not inital statement is used to check the values existing in the itab[] i.e. internal table or not.

if the itab[] contains the values then it will result is true.

IF itab[] is not inital.

resule: True.

else.

result: False.

endif.

raja_narayanan2
Active Participant
0 Kudos

Hi....

It is that if your internal table does not contain any values ... then do the proceed with the actions or else if internal table has the value the condition wont do anything.....

Regards

Raja

Former Member
0 Kudos

Hi Tanisha,

" if not itab is initial."

is used to check wheather the contnent of an internal table named itab is empty or not. Generaly, we use it after an operation to fill the itab and before working with the internal table.

In case of SELECT statement if we use FOR ALL ENTRIES, this checking is a must. Otherwise, if the internal table is entry the all the data of the data table/s in the SELECT query will be fetched.

Regards,

Anirban

Former Member
0 Kudos

It mean "if itab does not contains any row" for examppl

if not it_mara[] is initial.

endif.

regards

rajesh

Mohamed_Mukhtar
Active Contributor
0 Kudos

hi

For example

tables kna1.
types : begin of ty_itab ,
         kunnr type kna1-kunnr,
         name1 type kna1-name1,
         ort01 type kna1-ort01,
         land1 type kna1-land1,
        end of ty_itab.
data : it_itab type table of ty_itab,
         wa_itab type ty_itab.

select-options : S_kunnr for kna1-kunnr.

select kunnr
          name1
          ort01
          land1 from kna1 into table it_itab where kunnr in s_kunnr.

" to check whether it_itab has records 
if IT_itab is not initial.
loop at it_itab into wA_itab.
write statemetns
'
'
'
'
endloop
else.
message ' no records exists for the particular selection criteria'  type 'S'.
endif

Thanks & Regards

Former Member
0 Kudos

If not Itab is initial.......

It indiactes go to further process if the Internal table contains records.

it will reduce the process time and increases the performance of the program.

Thanks and Regards

Ganesh Reddy

Former Member
0 Kudos

Checking "If not Itab is initial' gains most importance if subsequently you are using the same table in 'For all entries'.

Else all records are fetched !! Hope it helps.

Former Member
0 Kudos

Hi,

'if not itab is initial' checks weather the itab filled with data or not.

For Example.

if not itab is initial.

Message 'Itab contains data' type 'S'.

else.

Message 'No data found' type 'E'.

endif.

Regards

Former Member
0 Kudos

Hi,

'if not itab is initial' checks weather the itab filled with data or not.

For Example.

if not itab is initial.

Message 'Itab contains data' type 'S'.

else.

Message 'No data found' type 'E'.

endif.

Regards