12-03-2008 7:48 AM
Moderator message: Please use meaningful subject in future
Initially i'm doing likes this:-
get Material no to itAB.
SELECT MATNR FROM MARA AS F
INTO CORRESPONding Fields of TABLE ITAB
WHERE MATKL IN MATGRP.
LOOP AT ITAB
for every MATNR
SELECT *
FROM ( ( MSEG AS A
INNER
JOIN MKPF AS B
ON B~MBLNR = A~MBLNR ) " Material Documber Number
INTO CORRESPONding Fields of TABLE ITAB
WHERE A~WERKS IN PLANTS
AND A~MATNR = MATNR.
There is many MBLNR returns for each MATNR
MODIFY the ITAB where ITAB-MBLNR = MBLNR. " Updating only if Material Documber Number matches.
END LOOP
Combing two select statement into Subquery:-
SELECT *
FROM ( ( MSEG AS A
INNER
JOIN MKPF AS B
ON BMBLNR = AMBLNR )
INTO CORRESPONding Fields of TABLE ITAB
WHERE A~WERKS IN PLANTS
AND A~MATNR IN (
SELECT MATNR FROM MARA AS F WHERE MATKL IN MATGRP ).
Will subquery return the same as above.
Should i use EXISTs or IN for every Materinal NO which returns mutiple material number.
Please advise on this.
Edited by: Matt on Dec 3, 2008 10:06 AM
12-03-2008 8:41 AM
using " for all entries in ITAB " in second SELECT statement would be a safer .
12-03-2008 8:47 AM
you mean in the subquery? is it EXIST or IN, i should use in the subquery