Skip to Content

ABAP SELECT - JOIN condition vs. WHERE condition

Hello,

this looks like basic ABAP question. I explored abapdocu. I see there are some clear differences (for example subqueries cannot be used in join_cond). But in other cases I am still a bit unsure what is preferred and why?

Is it just "semantic" what decides which cond do you use?

Here are examples of the SELECTs:
1) join_cond (ON)

SELECT mara~matnr INTO @l_material
  FROM mara
  INNER JOIN marc ON ( marc~matnr = mara~matnr AND
                       marc~werks = @p_werks ).

2) sql_cond (WHERE)

SELECT mara~matnr INTO @l_material
  FROM mara
  INNER JOIN marc ON ( marc~matnr = mara~matnr )
  WHERE marc~werks = @p_werks.
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Feb 22, 2019 at 06:59 PM

    It depends how the database works in the end. I did an inner join on HANA and because I had some conditions in the join instead of the where, I used up all the memory.

    There are general discussions concerning the best use of ON and WHERE across the web. it's not a SAP/ABAP specific issue.

    Add a comment
    10|10000 characters needed characters exceeded