2008 Jul 03 3:06 PM
We need to select order data based on material number. I've created a join starting at VAPMA and going to VBAP then to VBEP but it seems to be very expensive SQL. Should I structure this another way?
SELECT vvbeln vposnr v~matnr
pvgbel pwerks pvgpos pmeins
ewmeng ej_3asize
INTO CORRESPONDING FIELDS OF TABLE itab
FROM vapma AS v INNER JOIN vbap AS p
ON vvbeln = pvbeln AND
vposnr = pposnr
INNER JOIN vbep AS e
ON pvbeln = evbeln AND
pposnr = eposnr
INNER JOIN vbak AS k
ON kvbeln = evbeln
WHERE ....
2008 Jul 04 1:13 AM
With the join conditions above, check the fields against indexes on the tables. Check how selective these fields are, using DB05, the more selective the better. Then evaluate whether or not you need a new index.
Also, look at the size and future projected growth of all 3 tables. These things change from company to company. If you have a small enough table, you may want to read it into an ABAP internal table and use the FOR ALL ENTRIES IN statement instead.
2008 Jul 04 5:34 AM
Hi,
Just a suggestion, You can get the details of watever u get from VAPMA ( vvbeln vposnr v~matnr) from VBAP.then join on vbap and vbak should be able to get you the required data right?
Btw..are you using any Inequality condition in your WHERE condition?
Regards,
madhu
2008 Jul 04 9:34 AM
VAPMA is the correct starting point for access via material number. The JOIN conditions look OK at first glance, please tell us the WHERE conditions also.
Thomas
2008 Jul 04 1:16 PM
hi,
can u tell me what is the whole select statement for it as i might be the where condition is giving the problem to your performance.
2008 Jul 04 1:44 PM
Hi,
INNER JOIN is always very costly in terms of performance.
You try it with FOR ALL ENTRIES...
the following links will help you to get the idea:
[http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp]
[http://www.sap-img.com/abap/abap-fine-tuning.htm]
Finaly check the link for related syntax
[http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/content.htm]
Reward if found helpful.
Anirban Bhattacharjee
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |