2007 Feb 14 10:35 AM
Dear Expert's,
i am having a proble with this
SELECT mblnr mjahr zeile matnr charg bwart menge dmbtr ebeln ebelp lgort
FROM mseg
INTO CORRESPONDING FIELDS OF TABLE it_mseg
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln
AND ebelp = it_ekko-ebelp
AND lgort = '0001'
AND werks = '1001'
AND bwart IN ('961','962').
i want to retrive data from mseg table i am having a purchase order & item no ,
Storage location, Plant, Movement type .
if a ma using above query the this query takes lots of time
Provide me method by with i can retrive data on the given condition using some other method...
2007 Feb 14 3:36 PM
Hi Naresh,
You are writen the query correctly, but you did not maintained the sequence of the fields. we need to maintain the field sequence based on the table
if not it_ekko[] is initial.
SELECT mblnr mjahr zeile matnr charg bwart menge dmbtr ebeln ebelp lgort
FROM mseg
INTO TABLE it_mseg
FOR ALL ENTRIES IN it_ekko
WHERE
<b>werks = '1001' and
bwart IN ('961','962') and
lgort = '0001' and</b>
ebeln = it_ekko-ebeln
AND ebelp = it_ekko-ebelp.
endif.Regards
Sudheer
Hi Naresh,
You are writen the query correctly, but you did not maintained the sequence of the fields. we need to maintain the field sequence based on the table
if not it_ekko[] is initial.
SELECT mblnr mjahr zeile matnr charg bwart menge dmbtr ebeln ebelp lgort
FROM mseg
INTO TABLE it_mseg
FOR ALL ENTRIES IN it_ekko
WHERE
<b>werks = '1001' and
bwart IN ('961','962') and
lgort = '0001' and</b>
ebeln = it_ekko-ebeln
AND ebelp = it_ekko-ebelp.
endif.Regards
Sudheer
2007 Feb 14 10:51 AM
You can think of creating index on MSEG for PO/PoItem or use EKBE table to first find out Material doc for all POs and then go to MSEG for details of Material doc.
2007 Feb 14 10:55 AM
Hi Naresh,
Make sure if the table it_EKKO is not empty.
Also, sort it_ekko by ebeln and ebelp.
Declare the table it_mseg with the fields in the same order as they are selected from the table. and replace the statement INTO CORRESPONDING FIELDS OF TABLE it_mseg with INTO TABLE it_mseg
Regards,
Ravi
2007 Feb 14 11:02 AM
sort it_ekko by ebeln ebelp.
and write your select query.
2007 Feb 14 11:54 AM
Hi
Change the positions as shown in below:
removed into corresponding
SELECT mblnr mjahr zeile bwart matnr charg lgort dmbtr menge ebeln ebelp
FROM mseg
INTO TABLE it_mseg
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln
AND ebelp = it_ekko-ebelp
AND lgort = '0001'
AND werks = '1001'
AND bwart IN ('961','962').
Regards
Shiva
2007 Feb 14 3:26 PM
Hi Naresh,
Re write the code i this fashion,
<b>if not it_ekko[] is initial.</b>
SELECT mblnr mjahr zeile matnr charg bwart menge dmbtr ebeln ebelp lgort
FROM mseg
<b>INTO TABLE it_mseg</b>
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln
AND ebelp = it_ekko-ebelp
AND lgort = '0001'
AND werks = '1001'
AND bwart IN ('961','962').
<b>endif.</b>
<b>i have bolded the changes in your code..
first check whetehr the internal table it_ekko is initial or not and remove the into corresponding fields of table , rather arrange the field in your internal table it_mseg in the order you are selecting from mseg.</b>
2007 Feb 14 3:36 PM
Hi Naresh,
You are writen the query correctly, but you did not maintained the sequence of the fields. we need to maintain the field sequence based on the table
if not it_ekko[] is initial.
SELECT mblnr mjahr zeile matnr charg bwart menge dmbtr ebeln ebelp lgort
FROM mseg
INTO TABLE it_mseg
FOR ALL ENTRIES IN it_ekko
WHERE
<b>werks = '1001' and
bwart IN ('961','962') and
lgort = '0001' and</b>
ebeln = it_ekko-ebeln
AND ebelp = it_ekko-ebelp.
endif.Regards
Sudheer
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |