Application Development 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: 

Inner join

Former Member
0 Kudos
124

I need to join MARA and MSEG as inner join on mara-matnr = mseg-matnr.

However matnr is not a key field in mseg.The query is shown below.

from mkpf AS a

inner join mseg as b

on amandt = bmandt

and amblnr = bmblnr

and amjahr = bmjahr

inner join mara as c

on cmatnr = bmatnr

Is this query alright, specially cmatnr = bmatnr. Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
89

Yeah you can filter out even if it not a key field....

Regards,

Jayant..

6 REPLIES 6

Former Member
0 Kudos
89

I think it should work fine...

Regards,

Jayant

0 Kudos
89

Even if matnr is not a key field in MSEG

Former Member
0 Kudos
89

Hi

Its fine

It works.

Reward points if useful

Regards

Anji

Former Member
0 Kudos
89

Hi SV,

Refer this code :

SELECT amatnr amEINS AMTART DMAKTx bwerks clgort

c~labst INTO CORRESPONDING FIELDS OF TABLE IT_MATERIAL

FROM mara AS a

INNER JOIN MAKT AS D on amatnr = dmatnr

inner join marc AS b

ON amatnr = bmatnr

inner join MARD as c

ON BMATNR = CMATNR AND BWERKS = CWERKS

where AMATNR IN S_MATNR and bwerks in s_werks.

Reward points if helpful.

Regards,

Hemant

Former Member
0 Kudos
89

It will work fine ...

for joins, it is not must to be a key field, but recommended...

Former Member
0 Kudos
90

Yeah you can filter out even if it not a key field....

Regards,

Jayant..