Skip to Content
-2
Dec 19, 2022 at 09:27 AM

Multiple table fields in where condition select query

234 Views

Hi Experts,

In the below select query what is the problem?

Mara table which is c is not working in where condition. Is not is possible to put multiple tables field in where condition?

How to solve it?

c~mtart = @mattype AND
c~matkl IN @matgrp AND

not working.

    SELECT
a~werks,
a~lgort,
a~matnr,
a~charg,
* a~ersda,
a~clabs,
a~cinsm,
a~cspem,
b~maktx,
c~meins,
c~mtart,
c~matkl,
concat( a~matnr, a~charg ) AS merge
FROM mchb AS a
INNER JOIN makt AS b
ON a~matnr = b~matnr
INNER JOIN mara AS c
ON a~matnr = c~matnr
WHERE a~lgort = @p_store AND a~werks = @p_plant AND
a~matnr IN @s_matnr AND
a~charg IN @s_batch AND
c~mtart = @mattype AND
c~matkl IN @matgrp AND
( a~clabs > 0 OR a~cinsm > 0 OR a~cspem > 0 )
INTO TABLE @DATA(it_mchb2).