Skip to Content
0
Jan 24, 2007 at 12:44 AM

How to improve JOINs ?

15 Views

Hi

Is always usefull to 'separate' a JOIN for improve the performance ?

That is, instead to use a Join accesing two tables, make first one Select accesing the first table, and then make a second select using a FOR ALL ENTRIES for the first Internal Table.

How can we improve something like this ???

SELECT vbak~vbeln

vbak~vbtyp

vbak~vkorg

vbak~vtweg

vbak~spart

vbak~kunnr

vbak~auart

vbak~audat

FROM vbak

INNER JOIN vbpa

ON vbakvbeln EQ vbpavbeln AND

vbpa~posnr EQ c_poszero

INNER JOIN vbkd

ON vbakvbeln EQ vbkdvbeln AND

vbkd~posnr EQ c_poszero

INNER JOIN vbuk

ON vbakvbeln EQ vbukvbeln

INTO TABLE i_vbak

WHERE vbak~auart IN r_auart

AND vbak~vkorg IN s_vkorg

AND vbak~spart IN s_spart

AND vbak~audat IN s_odate

AND vbak~waerk IN s_waerk

AND vbak~vkbur IN s_vkbur

AND vbak~vsbed IN s_vsbed

AND vbkd~ktgrd IN s_ktgrd

AND vbkd~bzirk IN s_bzirk

AND vbuk~gbstk IN s_gbstk

AND vbak~vbeln IN s_vbeln

AND vbpa~kunnr IN s_kunnr

AND vbpa~parvw EQ c_parvzs

AND vbak~vbtyp IN r_vbtyp.

The only obligatory field is s_vkorg.

Regards

Frank