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 statement fails...

Former Member
0 Likes
467

Hi,

I have a subscreen with 4 select options..

S_ONE

S_TWO

S_THREE

S_FOUR

I write a select statement with inner join on two tables based on field XXX. And the data to be retrieved is based on the values entered in these select options..

so my statement is as follows:

SELECT TAB1AAA, TAB1BBB, TAB1CCC, TAB1DDD INTO CORRESPONDING FIELDS OF ITAB FROM TAB1 INNER JOIN TAB2 ON TAB1XXX = TAB2XXX

AND AAA IN S_ONE AND BBB IN S_TWO.

Now I dont enter any values in these select options, so by default all the records must be retrieved isn't it ? I have records in bothe TAB1 and related records in TAB2.

But I dont get any records and sy-subrc is returning value of 4.

any help ?

thks

1 ACCEPTED SOLUTION
Read only

younes_bouaouad
Explorer
0 Likes
441

Hi,

As long as the conditions AAA IN S_ONE AND BBB IN S_TWO aren't affecting the JOIN, you've got to put it in a WHERE clause. and don't forget to specify table names.

Your select will look like :

SELECT TAB1AAA, TAB1BBB, TAB1CCC, TAB1DDD

INTO CORRESPONDING FIELDS OF ITAB

FROM TAB1 INNER JOIN TAB2 ON TAB1XXX = TAB2XXX

WHERE TAB1~ AAA IN S_ONE AND TAB1~ BBB IN S_TWO.

Edited by: Younes BOUAOUAD on Aug 18, 2008 5:34 PM

2 REPLIES 2
Read only

Former Member
0 Likes
441

Try using a WHERE Clause instead of:

AND AAA IN S_ONE AND BBB IN S_TWO.

Read only

younes_bouaouad
Explorer
0 Likes
442

Hi,

As long as the conditions AAA IN S_ONE AND BBB IN S_TWO aren't affecting the JOIN, you've got to put it in a WHERE clause. and don't forget to specify table names.

Your select will look like :

SELECT TAB1AAA, TAB1BBB, TAB1CCC, TAB1DDD

INTO CORRESPONDING FIELDS OF ITAB

FROM TAB1 INNER JOIN TAB2 ON TAB1XXX = TAB2XXX

WHERE TAB1~ AAA IN S_ONE AND TAB1~ BBB IN S_TWO.

Edited by: Younes BOUAOUAD on Aug 18, 2008 5:34 PM