on 09-10-2008 4:53 PM
I wrote a select query on CKIS table based on the inputs from KEKO table for which plant and material number are inputs.
Here is my select query:
SELECT bzobj kalnr kalka kadky tvers bwvar kkzma matnr werks posnr
INTO TABLE it_keko
FROM keko
WHERE werks = p_werks
AND matnr = p_matnr.
IF sy-subrc = 0.
SORT it_keko BY bzobj kalnr kalka kadky tvers bwvar kkzma.
ENDIF.
IF NOT it_keko[] IS INITIAL.
SELECT bzobj kalnr kalka kadky tvers bwvar kkzma posnr kstar
gpreis lstar vornr
INTO TABLE it_ckis
FROM ckis
FOR ALL ENTRIES IN it_keko
WHERE bzobj = it_keko-bzobj
AND kalnr = it_keko-kalnr
AND kalka = it_keko-kalka
AND kadky = it_keko-kadky
AND tvers = it_keko-tvers
AND bwvar = it_keko-bwvar
AND kkzma = it_keko-kkzma.
Please advice for better performance of this query.
Thanks in advance.
Jeevi.
Thanks for your advices.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check for the indexes and add the indexes which you are using in where condition.
Regards,
Naresh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chalasani,
Please fetch all the key fields from the csik table, LEDNR is alone missing pls add this field. Otherwise i dont find any error in your select query.
Regards,
Shobana.k
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
why you are retreiving the same fields from both tables.
better if you are using a join to get the details from both tables at ones that will help reducing the no of roundtrips.
try to use the join statement like this.
SELECT T1BZOBJ T1KALNR T1KALKA T1KADKY T1TVERS T1BWVAR T1KKZMA T1MATNR T1WERKS T1POSNR
T2KSTAR T2GPREIS T2LSTAR T2VORNR
INTO TABLE IT_KEKO_CKIS
FROM
KEKO AS T1 JOIN CKIS AS T2 ON
T1BZOBJ = T2BZOBJ AND
T1KALNR = T2KALNR
WHERE T1~WERKS = P_WERKS
AND T1~MATNR = P_MATNR.
Edited by: Yogananda Namala on Sep 11, 2008 4:07 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi chalasani
You can delete duplicate records from KEKO using
Delete Adjacent duplicates from it_KEKO comparing bzobj kalnr kalka kadky tvers bwvar kkzma.
before your query on CKIS, as less no of records in IT_KEKO will take lesser time for CKIS.
Regards
Rajnesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are all already using key fields in the where clause in both the fetch 's , it cannot be optimized better !!!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.