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: 

Check Inner join

Former Member
0 Kudos

Can you please check below select statement because there are double records reasoning somethings . Shall I need to change order of joins ?

SELECT maramatnr maraprdha marcmaabc marameins

maktmaktx marctrame mard~labst

mbewstprs mbewpeinh

INTO CORRESPONDING FIELDS OF gt_mara_itab

FROM mara

INNER JOIN makt

ON maktmatnr = maramatnr

AND makt~spras = sy-langu

INNER JOIN marc

ON marcmatnr = maramatnr

INNER JOIN mard

ON mardmatnr = maramatnr

AND mardwerks = marcwerks

LEFT OUTER JOIN mbew

ON mbewmatnr = marcmatnr

AND mbewbwkey = marcwerks.

WHERE mara~matnr IN smal_tab

AND mara~mtart IN s_mtart

AND mara~matkl IN s_matkl

AND marc~werks IN s_pplant

AND mard~lgort NOT IN gr_lgort

AND mara~lvorm = space

AND marc~lvorm = space

AND mard~lvorm = space.

3 REPLIES 3

Former Member
0 Kudos

It's pretty hard to say where the problem lies. As a start, try splitting up the SELECT. I'd see what happens without the JOIN on MBEW first.

Rob

Former Member
0 Kudos

hi,

you'll have duplicates of material, its desceiption, but if u notice the quantity fields may not. thats because of data selection from marc and mard. jus delete the duplicates based on ur requirement. if u want unique entries at the time of selection itself, then use left outer join as u have used in the program for marc and mard. theres nothing wrong in your select.

regards,

madhu

Former Member
0 Kudos

This message was moderated.