Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

heavy selection for not invoiced deliveries with few input parameters

$
0
0

Hello,

 

I have a request to display not invoiced deliveries starting from only 4 mandatory selection option in input:

- Sales Organization
- Distribution Channel 
- Division                                       
- Goods issue date of delivery
- Sales order type 


+ The customer as not mandatory select option.


The fastest way I found is with a huge inner join (I know it's not always recommended to do such select)


SELECT likp~vbeln likp~ernam likp~erzet likp~erdat likp~vstel          likp~vkorg likp~lfart likp~lfdat likp~ablad likp~kunnr          likp~anzpk likp~waerk likp~wadat_ist likp~xblnr likp~bolnr          likp~lifex likp~vkorg vbuk~wbstk vbuk~fkstk lips~posnr          lips~pstyv lips~matnr lips~werks lips~lgort lips~kdmat          lips~lfimg lips~meins lips~vrkme lips~arktx lips~vbelv          lips~netwr lips~vgbel lips~vgpos lips~vtweg lips~spart          vbak~auart vbak~knumv kna1~name1 kna1~land1 kna1~ort01          kna1~stras          FROM ( vbak INNER JOIN lips ON lips~vgbel = vbak~vbeln                       INNER JOIN likp ON likp~vbeln = lips~vbeln                       INNER JOIN vbuk ON vbuk~vbeln = likp~vbeln                       INNER JOIN kna1 ON kna1~kunnr = likp~kunnr )           WHERE   likp~vkorg     IN s_vkorg             AND    lips~vtweg     IN s_vtweg             AND    lips~spart     IN s_spart             AND    likp~kunnr     IN s_kunnr             AND    likp~wadat_ist IN s_wadat             AND    vbak~auart     IN s_auart             AND    vbuk~fkstk     Eq 'A'. 

For a huge database it's taking about 3 minutes.

 

I tried to divide the select into singular select from each table starting from likp (to have a list of vbeln) but this select from likp with only  2 non key selection option is not so performant and taking so much time.

   where vkorg        IN s_vkorg     AND wadat_ist IN s_wadat

Could you kindly help?

 

Thank you in advance.

Moez.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>