‎2007 Jun 21 7:11 AM
Hi Experts,
Below SELECT statement is taking too much of time.How can I modify this statement to improve the performance?
TYPES: BEGIN OF customer,
vbeln LIKE vbfa-vbeln,
kunnr LIKE kna1-kunnr,
END OF customer.
DATA: srch_kunnr TYPE customer OCCURS 0 WITH HEADER LINE .
SELECT vbeln INTO CORRESPONDING FIELDS OF TABLE
srch_kunnr
FROM vbpa
WHERE parvw = l_parvw AND
land1 IN so_co_ag.
Thanks in advance.
Raj
‎2007 Jun 21 7:57 AM
Hi Basavraj,
I beleive your fetching only vbeln into table, then why are you using into coresponding fields.
SELCT VBELN
INTO TABLE srch_kunnr
FROM VBAP
WHERE parvw = l_parvw AND
land1 IN so_co_ag.
Hope this helps you. Reply for queries, shall post the updates.
Regards.
Kumar
‎2007 Jun 21 7:57 AM
Hi Basavraj,
I beleive your fetching only vbeln into table, then why are you using into coresponding fields.
SELCT VBELN
INTO TABLE srch_kunnr
FROM VBAP
WHERE parvw = l_parvw AND
land1 IN so_co_ag.
Hope this helps you. Reply for queries, shall post the updates.
Regards.
Kumar
‎2007 Jun 21 8:20 AM
hi,
try like this,
TYPES: BEGIN OF customer,
vbeln type vbeln,
kunnr type kunnr,
END OF customer.
DATA: srch_kunnr TYPE table of customer.
SELECT vbeln kunnr INTO TABLE srch_kunnr
FROM vbpa.
WHERE parvw = l_parvw AND
land1 IN so_co_ag.
" wat is your where condition? it should be some ralation with field like
kunnr = vbpa-kunnr and vbeln = vbpa-vbeln, something like that.
reward points if useful,
regards,
seshu.
‎2007 Jun 21 9:44 AM
Hi,
I agree with Seshu.
Your where condition don't use fields neither of your table key nor of standard secondary index.
Consequently, that means that this statement will implies a <b>table scan</b> on VBPA which is certainly the source of performances problem.
Whether you can add key field in your where condition, or eventually create a specific index.
Regards,
Alex
‎2007 Jun 22 4:20 AM
Hi experts,
Thanks for your time.
Seshu ans alex,Could you please explain how can avoid this table scan.
how to create a specific index..
If you can modify the existing code ..that would be very helpful.
Regards
basavaraj
‎2007 Jun 23 10:32 PM
Hi
I too agree that you need to give any of primary key for filtering in where condition. As all vbeln needs to be considered, then just check the below code.
This should not take much time but just check the records in vbfa is not so huge that it leads for memory short dump.
TYPES: BEGIN OF customer,
vbeln LIKE vbfa-vbeln,
parvw like vbfa-parvw,
land1 like vbfa-land1,
kunnr LIKE kna1-kunnr,
END OF customer.
DATA: srch_kunnr TYPE customer OCCURS 0 WITH HEADER LINE .
SELECT vbeln parvw land1 INTO TABLE
srch_kunnr
FROM vbpa.
DELETE srch_kunnr NOT parvw = l_parvw AND
NOT land1 IN so_co_ag.
Regards
Navneet