04-14-2020 2:12 PM
Hello experts,
i have a very old query which needs to be optimised in ECC. Please help me on this.
SELECT DISTINCT
vbak~vbeln "Sales doc number vbak
vbak~kunnr "Sold-to party vbak
vbak~auart "Sales Document Type vbak
vbap~matnr "Material number vbap
vbap~posnr "Item no in sales order vbap
vbfa~vbeln "Delivery number
vbfa~posnn "Item no in delivery
vbfa~rfmng "Actual quantity delivered (in sales units)
vbap~kwmeng "Cumulative Order Quantity in Sales Units vbap
vbak~vdatu "requested delivery date vbak
vbkd~bstkd "Customer purchase order number
vbap~abgru "rejection Reason
INTO TABLE gt_so
FROM vbak
JOIN vbap ON vbak~vbeln = vbap~vbeln
JOIN mean ON vbap~matnr = mean~matnr
JOIN vbkd ON vbak~vbeln = vbkd~vbeln
LEFT OUTER JOIN vbfa ON vbfa~vbelv = vbap~vbeln
AND vbfa~posnv = vbap~posnr
AND vbfa~vbtyp_n EQ gc_j
WHERE vbak~auart EQ gv_auart
AND vbak~vbeln IN s_vbeln
AND vbak~erdat IN s_erdat
AND vbak~vdatu IN s_vdatu
AND vbkd~bstkd IN s_bstkd
AND vbap~matnr IN s_matnr
AND mean~ean11 IN s_ean11
AND mean~eantp IN s_eantp.
Cheers,
LLD
04-14-2020 4:47 PM
Post the execution plan that cause you the most trouble right now. Also let us know, what Database is being used, as this can have an impact on the available functionality for the Execution Plan.
04-14-2020 2:50 PM
Is your query is very slow?
Or what is your exact requirement towards performance.
04-14-2020 2:54 PM
Hi, Query is running very slow. How can i improve the performance of the query?
04-14-2020 2:59 PM
Just to understand..
1. Is this a report program? and is your data is huge?
2. What are all the Selection parameter & how many of them are mandatory.
3. If you give date range / sales order range - how much it is taking time?
4. After querying into internal table gt_so - are you processing again in loop?
5. Just put a break point after the query - and see how much time it takes just for query .
Based on this - we can further analyze to improvise.
04-14-2020 3:00 PM
Please provide the "execution plan" of the query (via SQL trace for instance).
04-14-2020 3:00 PM
Hi Lalit.
Enable the ST12 trace and check the over all DB & ABAP usage
refer the SAP Note link, How to collect and analyze traces using ST12
https://launchpad.support.sap.com/#/notes/2436955
Regards
SS
04-14-2020 4:47 PM
Post the execution plan that cause you the most trouble right now. Also let us know, what Database is being used, as this can have an impact on the available functionality for the Execution Plan.
05-13-2020 4:07 PM
lalit.d, please follow up on your open question.