2006 Nov 15 4:19 AM
SELECT MARAMATNR MSEGMENGE MSEG~BWART
INTO CORRESPONDING FIELDS OF TABLE ITAB_SHIP_QTY
FROM MARA INNER JOIN MSEG ON MSEGMATNR = MARAMATNR
INNER JOIN MKPF ON MKPFMBLNR = MSEGMBLNR
AND MKPFMJAHR = MSEGMJAHR
WHERE MARAMATNR IN Z_MATNR AND MKPFBUDAT IN SHIP_D
AND ( ( MSEG~LGORT = 'L002' AND
MSEG~BWART IN ('901','902','101','102','105','106') ) OR
( MSEGLGORT = 'L001' AND MSEGBWART = '311' ) OR
( MSEGUMLGO = 'L001' AND MSEGBWART = '312' ) ).
Dear all,is the above code correct? coz i get the internal table wif more than 2000records with same material number,same movement type and same storage location...only some of the quantity is different. Thx all
2006 Nov 15 4:25 AM
Hi
After this select write
sort itab_ship_qty by matnr .
delete adjacent duplicates from itab_ship_qty comparing matnr menge bwart.
SELECT MARAMATNR MSEGMENGE MSEG~BWART
INTO CORRESPONDING FIELDS OF TABLE ITAB_SHIP_QTY
FROM MARA INNER JOIN MSEG ON MSEGMATNR = MARAMATNR
INNER JOIN MKPF ON MKPFMBLNR = MSEGMBLNR
AND MKPFMJAHR = MSEGMJAHR
WHERE MARAMATNR IN Z_MATNR AND MKPFBUDAT IN SHIP_D
AND ( ( MSEG~LGORT = 'L002' AND
MSEG~BWART IN ('901','902','101','102','105','106') ) OR
( MSEGLGORT = 'L001' AND MSEGBWART = '311' ) OR
( MSEGUMLGO = 'L001' AND MSEGBWART = '312' ) ).
Dear all,is the above code correct? coz i get the internal table wif more than 2000records with same material number,same movement type and same storage location...only some of the quantity is different. Thx all
2006 Nov 15 4:25 AM
Hi
After this select write
sort itab_ship_qty by matnr .
delete adjacent duplicates from itab_ship_qty comparing matnr menge bwart.
2006 Nov 15 4:57 AM
Hi Joan
The SELECT statement is absolutely correct.
There may be huge data for that meterial. If you want to X check, just check it out in MSEG table by providing the material only. The number of records in the MSEG should be either >= number of records your SELECT populates.
Regards
Surya.
2006 Nov 15 5:10 AM
thx rk
hi surya,if the data really are tat huge....should i use the method as suggested by Rk? coz in the end i need to sum up the menge ( qty )
sort itab_ship_qty by matnr .
delete adjacent duplicates from itab_ship_qty comparing matnr menge bwart.
2006 Nov 15 5:47 AM
Hi,
You can do the following.
1. Do an innerjoin separately with MSEG and MKPF for all entries selected from MARA (MARA~MATNR IN Z_MATNR). This willl give u a control on your record fetching.
2. You can use your present query with distinct addition to the BWART field and sum addition to the MENGE field as you will get some of quantities for the same movment types.
3. Otherwise manipulate your output internal table based on the filter criteria you have.
2006 Nov 15 6:02 AM
hie balachandran,can u elaborate more on how to do the following?
1. Do an innerjoin separately with MSEG and MKPF for all entries selected from MARA (MARA~MATNR IN Z_MATNR). This willl give u a control on your record fetching.
2. You can use your present query with distinct addition to the BWART field and sum addition to the MENGE field as you will get some of quantities for the same movment types.
thx..
2006 Nov 15 6:54 AM
2006 Nov 15 6:02 AM
hi
good
i hope the inner join is correct, but the procedure of writing is bit confusing, if you r getting more than 2000 records than your one of the condition is satisfying the criteria but some of the condition is not satisfying, if you have use the select statement than insterad of using OR make them AND which i think more appropriate.
thanks
mrutyun^
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |