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: 

Correct Select in ABAP

Former Member
0 Kudos
650

Hi,

i have a problem regarding a select statement in ABAP. I need to pick all equipments from table EQUI who have an related measuring point (IMPTT. link between tables is equi-objnr and imptt-mpobj).

I thought of an inner join, but this is not the right way. There are 170 entries in equi but only the last two have measuring points. Each one has for. So mir output of itab has 8 entries.

select equi~equnr equi~objnr imptt~mpobj
  into CORRESPONDING FIELDS OF table itab
  from equi inner JOIN imptt ON  equi~objnr = imptt~mpobj.

Has anybody a suggestion for me how to pick the equipments correctly?

Thanks

1 ACCEPTED SOLUTION

horst_keller
Product and Topic Expert
Product and Topic Expert
225

Use a subquery in the WHERE condition, WHERE EXISTS?

2 REPLIES 2

horst_keller
Product and Topic Expert
Product and Topic Expert
226

Use a subquery in the WHERE condition, WHERE EXISTS?

0 Kudos
225

Thanks a lot. Was the right hint.

My correct working select query now looks like:

select * from equi into CORRESPONDING FIELDS OF table itab
  where objnr in (
  select imptt~mpobj
  from imptt inner JOIN equi ON ( equi~objnr = imptt~mpobj )
  ).