Hi All,
SELECT matnr FROM mara INTO TABLE gt_mara
WHERE matnr IN s_matnr
AND mtart = p_mtart.
IF NOT gt_mara[] IS INITIAL.
SORT gt_mara BY matnr.
SELECT aufnr objnr aufpl FROM caufv INTO TABLE gt_caufv
FOR ALL ENTRIES IN gt_mara
WHERE aufnr IN s_aufnr
AND auart = p_auart
AND werks = p_werks
AND plnbez = gt_mara-matnr.
ENDIF.
I have replaced the above for all entries query by the below inner join. Found in the debugg both have same number of records in the (DEV server). Performance wise also this one is better. Let me know both are exactly same or not.
SELECT a~matnr
b~aufnr
b~objnr
b~aufpl
INTO TABLE gt_caufv FROM mara AS a INNER JOIN caufv AS b
ON amatnr = bplnbez WHERE matnr IN s_matnr
AND mtart =<b> p_mtart</b>
AND aufnr IN s_aufnr
AND auart = p_auart
AND werks = p_werks.
My concern with the join is <b>amatnr = bplnbez</b> is whether this will give me unique records or duplicate records. It seems to be good and unique in the DEV but not sure about the PROD server . Kindly Clarify.
Thanks,