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

syntax query

Former Member
0 Likes
775

hi all,

is the following syntax valid.

select * from dbtab for all entries of it_tab.

im running a batch program. i just want to check if my entries in my internal table are present in my dbtab.

so that i dont insert my dbtab for those corresponding entries

i strictly want to avoid looping on the it_tab.

please correct me if wrong also give alternative if any

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
746

hi,

You need to give atleast one selection criteria field. Like this,

SELECT * FROM vbap

INTO CORRESPONDING FIELDS OF TABLE t_vbap

FOR ALL ENTRIES IN t_vbak

WHERE vbeln = t_vbak-vbeln.

7 REPLIES 7
Read only

Former Member
0 Likes
746

hiii

no this is not a valid syntax

select * from dbtab for all entries of it_tab.

you should use it like below

select * from dbtab for all entries IN it_tab where field1 = field1-it_itab.

regards

twinkal

Read only

Former Member
0 Likes
746

Hi,

You should use a where condition for the select which is common to both database and internal table.

By this query you get the data which are common in internal table and database. the remaining data which are in database will not be selected.

is this what u need?

Read only

0 Likes
746

if by that query i get the entries which are common that means i should not append my itab.(using sy-subrc)

else i should .

but how do i seggregate between the entries which are present in dbtab and the entries which are not.

Read only

0 Likes
746

by this select query you get the entries which are there in the internal table only.

Read only

Former Member
0 Likes
746

hi,

If i have understood your question correctly do this way ..


if not it_tab[] is initial.
 select * from dbtab into table it_data for all entries in it_tab
              where field1 = it_tab-field1 and
                       field2 = it_tab-field2.
endif.

Regards,

Santosh

Read only

Former Member
0 Likes
747

hi,

You need to give atleast one selection criteria field. Like this,

SELECT * FROM vbap

INTO CORRESPONDING FIELDS OF TABLE t_vbap

FOR ALL ENTRIES IN t_vbak

WHERE vbeln = t_vbak-vbeln.

Read only

Former Member
0 Likes
746

thank you all for helping me out