‎2008 Aug 18 6:22 PM
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
‎2008 Aug 18 6:33 PM
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
‎2008 Aug 18 6:26 PM
Try using a WHERE Clause instead of:
AND AAA IN S_ONE AND BBB IN S_TWO.
‎2008 Aug 18 6:33 PM
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