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

if not itab is initial

Former Member
0 Likes
8,346

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.

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
Read only

Former Member
0 Likes
4,287

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

Read only

h_senden2
Active Contributor
0 Likes
4,287

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

regards,

Hans

Read only

Former Member
0 Likes
4,287

if not itab is initial...

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

answer it yourself....

Read only

Former Member
0 Likes
4,287

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.

Read only

raja_narayanan2
Active Participant
0 Likes
4,287

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

Read only

Former Member
0 Likes
4,287

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

Read only

Former Member
0 Likes
4,287

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

if not it_mara[] is initial.

endif.

regards

rajesh

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
4,287

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

Read only

Former Member
0 Likes
4,287

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

Read only

Former Member
0 Likes
4,287

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.

Read only

Former Member
0 Likes
4,287

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

Read only

Former Member
0 Likes
4,287

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