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

Select query

Former Member
0 Likes
975

Hi all,

I am having an internal table itab1 with 100 records(Purchase order numbers)

I need to write a select query to fetch all the records from the table ekpo into table itab2 other than the records in the internal table itab1.

That means i should not select the records into internaltable itab2 which r existing in the internal table itab1.

Please give me the select query

Regards

Ajay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
946

itab_100.<--100 records table

itab_final is the select from EKPO

select * from ekpo
 into table itab_final
 where condition.

loop at itab_final

 read table itab_100.
 if sy-subrc eq 0.
  delete itab_final.
 endif.

endloop.

8 REPLIES 8
Read only

Former Member
0 Likes
946

Hi,

use for all entries statement, in the where statement use NE for all fields in itab1.

Read only

bpawanchand
Active Contributor
0 Likes
946

HI

Please give me the select query

*select **

from ekpo

into itab2

for all entries in table itab1

where <condition>.

Regards

Pavan

Read only

JozsefSzikszai
Active Contributor
0 Likes
946

hi Ajay,

I would move the numbers from the itab into a range the following way:

sign option low

I NE number1

I NE number2

...

then the select would be:

SELECT ... FROM EKPO INTO ... WHERE ebeln IN range.

hope this helps

ec

rubbish... scroll down to Rob Burbank's post...

Read only

KalC
Active Participant
0 Likes
946

Hi ,

this might be useful.

Select * from ekpo into table itab2 for all entries in itab1 where ebeln ne itab1-ebeln.

Regards,

Kalyan.

Read only

Former Member
0 Likes
946

select ebeln

from ekko

into table itab

where ebeln in s_ebeln .

if sy-subrc = 0.

select ebeln

ebelp

from ekpo

into table itab1

for all entries in itab

where ebeln = itab-ebeln.

endif.

Read only

Former Member
0 Likes
947

itab_100.<--100 records table

itab_final is the select from EKPO

select * from ekpo
 into table itab_final
 where condition.

loop at itab_final

 read table itab_100.
 if sy-subrc eq 0.
  delete itab_final.
 endif.

endloop.

Read only

Former Member
0 Likes
946

I don't think any of the proposed solutions will work. You should build a range table using EQ and "E"xclude.

Rob

Read only

vinod_vemuru2
Active Contributor
0 Likes
946

Hi Ajay,

Just give the WHERE clause conditions reverse in EKPO select.

eg: If u r using some field EQ in ekko then use NE in ekpo.

But in this case the where clause fields should be common in ekko and ekpo.

Also paste the code on how u r populating the data into itab1(Po numbers).

Thanks,

Vinod.