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

Conditioins in outer join

marcin_cholewczuk
Active Contributor
0 Likes
501

Hi Gurus,

Is it possible to put codition on outer joined table? In where it's not possible, cause I'm getting syntax error. With puting it under HAVING I'm able to go pass syntax check, but I'm getting short dump during execution. It looks like

SELECT *

FROM tab1 LEFT JOIN tab2 ON ....

WHERE...

GROUP BY...

HAVING tab2~field1 IS NULL

Any ideas how it can be done?

BR

Marcin Cholewczuk

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
472

When you encounter syntax errors or short dumps, please decribe these in all detail to put people in the position to help you. Also provide actual code and not place holders, which might not contain the actual cause of the problem.

Regarding WHERE-conditions for outer joined tables, only those fields are not allowed in the WHERE-condition that you already use in the ON-condition to link the two tables. For background, see

http://help.sap.com/abapdocu_70/en/ABAPSELECT_JOIN.htm

Thomas

When you encounter syntax errors or short dumps, please decribe these in all detail to put people in the position to help you. Also provide actual code and not place holders, which might not contain the actual cause of the problem.

Regarding WHERE-conditions for outer joined tables, only those fields are not allowed in the WHERE-condition that you already use in the ON-condition to link the two tables. For background, see

http://help.sap.com/abapdocu_70/en/ABAPSELECT_JOIN.htm

Thomas

2 REPLIES 2
Read only

ThomasZloch
Active Contributor
0 Likes
473

When you encounter syntax errors or short dumps, please decribe these in all detail to put people in the position to help you. Also provide actual code and not place holders, which might not contain the actual cause of the problem.

Regarding WHERE-conditions for outer joined tables, only those fields are not allowed in the WHERE-condition that you already use in the ON-condition to link the two tables. For background, see

http://help.sap.com/abapdocu_70/en/ABAPSELECT_JOIN.htm

Thomas

Read only

0 Likes
472

Hello Thomas,

It's not possible to use any field from right table when I use LEFT JOIN in WHERE condition. I'm always getting syntax error "No fields from the right-hand table of a LEFT OUTER JOIN may appear in the WHERE condition: <field name>.". However it looks like I can move this condition to ON condition in JOIN. Not sure if it will work how I want, but at least I'm not getting syntax errors or short dumps (DBIF_RSQL_SQL_ERROR - SQL error in the database when accessing a table).

BR

Marcin Cholewczuk