10-12-2006 5:08 PM
SELECT AZBOL_NO AZFOLDERNO BZORDITEMNO BZMECAORDERNO B~ZBYRPARTID
BZQUANTITY BZQUANPERCASE B~ZNOOFCASE INTO TABLE INT_ZMNET FROM
ZMNETHDR AS A INNER JOIN ZMNETDTL AS B ON AZBOL_NO = BZBOL_NO AND
AZFOLDERNO = BZFOLDERNO AND AZINVOICENO = BZINVOICENO
AND AZACTIONID = BZACTIONID WHERE A~ZBOL_NO IN BOL AND
BZDATEPOSTED IN DATE AND BBUKRS IN BUKRS AND A~ZFOLDERNO IN ZFOLDER
AND BZINVLINENO IN ZINVLINE AND BZINVOICENO IN ZINVOICE.
SORT INT_ZMNET BY ZBOL_NO ZFOLDERNO ZORDITEM ZMECAORDERNO ZBYPART
ZQUANTITY ZQUANPERCASE ZNOOFCASE.
can anything be done to improve the performance of this select statement
10-12-2006 5:13 PM
Hi,
Just make sure conditions in where clause should have sequence similar to either primary index of table.
or try breaking the stamtemnt as first only inner join of tables.
then use this internal table to further filter records as per where conditions.
Thanks.
Mark points if helpful.
10-12-2006 5:14 PM
Are the fields that are specified in the where condition in the same order as they appear in the z table?
If not, order them as they appear in the table.
Pass the full key of possible.
Create an index for the table if there are not many.
Regards,
Ravi
10-12-2006 5:30 PM
Hi Priyanka,
You can improve the performance of the above query if
Fields ZBOL_NO,ZFOLDERNO and ZINVOICENO are part of the primary index of both tables ZMNETHDR and ZMNETDTL .
If so.. then change your where clause as below
WHERE A~ZBOL_NO IN BOL AND
A~ZFOLDERNO IN ZFOLDER AND
A~ZINVOICENO IN ZINVOICE AND
B~ZDATEPOSTED IN DATE AND
B~BUKRS IN BUKRS AND
B~ZINVLINENO IN ZINVLINE.
This will surely improve the performance of your query.
Let me know if you have any concerns.
Don't forget to award points to the helpfull reply.
10-12-2006 5:43 PM
Try after breaking the code into 2 internal table. i.e use two select queries. Select the data from ZMNETHDR first and using the for all entries select the data from ZMNETDTL. Check which is taking lot of time.
Regards,
Prakash.