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: 

report

Former Member
0 Kudos
74

Hello

This is lalitha

in the select statement the syntax

(if it_vbak[] is not initial.

select * from vbap into table it_vbap

for all entries in it_vbak where kunnr = it_vbak-kunnr .)

I want to know the meaning of initial ie what values of vbak is it selecting & for all entries in it_vbak .

2 REPLIES 2

Former Member
0 Kudos
40

(a) "if not it_vbak[] is initial." means that the logic will only be executed if the internal table it_vbak has contents i.e. at least one row.

(b) The "for all entries in" will generate a select statement along the lines of "where kunnr = X or kunnr = Y or kunnr = Z" where X,Y, and Z are taken from the rows in it_vbak.

(c) the reason for (a) is that if you specifiy an empty table in (b), you will end up selecting all the data from vbap - i.e. a "for all entries in" with an empty internal table specified will return everything, not nothing. As the online help says "Duplicate lines are automatically removed from the resulting set. If the internal table itab is empty, the whole WHERE statement is ignored and all lines in the database are put in the resulting set."

Jonathan

Former Member
0 Kudos
40

Hi Lalitha,

if it_vbak[] is not initial.

<b>- If there are values in the table it_vbak then only you will call the below select statement. The reason being if there are no values in internal table and you use thte same in FOR ALL ENTRIES then all the records will be selected from VBAP</b>

select * from vbap into table it_vbap

for all entries in it_vbak where kunnr = it_vbak-kunnr

Regards,

Atish