‎2008 Feb 01 5:01 AM
Plz find my SELECT query below:
select w~mandt
wvbeln wposnr wmeins wmatnr wwerks wnetwr
wkwmeng wvrkme wmatwa wcharg w~pstyv
wposar wprodh wgrkor wantlf wkztlf wlprio
wvstel wroute wumvkz wumvkn wabgru wuntto
wawahr werdat werzet wfixmg wprctr wvpmat
wvpwrk wmvgr1 wmvgr2 wmvgr3 wmvgr4 wmvgr5
wbedae wcuobj w~mtvfp
xetenr xwmeng xbmeng xettyp xwepos xabart
x~edatu
xtddat xmbdat xlddat xwadat xabruf xetart
x~ezeit
into table t_vbap
from vbap as w
inner join vbep as x on xvbeln = wvbeln and
xposnr = wposnr and
xmandt = wmandt
for all entries in t_vbak
where
w~vbeln in s_ordno and
w~vbeln = t_vbak-vbeln and
( ( werdat > pre_dat ) and ( werdat <= w_date ) ) and
( ( ( erdat > pre_dat and erdat < p_syndt ) or
( erdat = p_syndt and erzet <= p_syntm ) ) ) and
w~matnr in s_matnr and
w~pstyv in s_itmcat and
w~lfrel in s_lfrel and
w~abgru = ' ' and
w~kwmeng > 0 and
w~mtvfp in w_mtvfp and
x~ettyp in w_ettyp and
x~bdart in s_req_tp and
x~plart in s_pln_tp and
x~etart in s_etart and
x~abart in s_abart and
( ( xlifsp in s_lifsp ) or ( xlifsp = ' ' ) ).
Could u please suggest an Index that can reduce the DB Access time for the above Query?
On what fields I should specify the Index
Thx
‎2008 Feb 01 5:04 AM
Hi,
If u have check the where contion without primary key u may create index. that is called the secondary index.
Regards,
S.Nehru.
‎2008 Feb 01 5:18 AM
‎2008 Feb 01 5:14 AM
instead of using joins between vbap and vbep
fecth VBAP entries for all the selected entries in VBAK
and then fecth VBEP entries for all the selected entires in VBAP. Then club both vbap and vbep entires into single internal table.
‎2008 Feb 01 5:17 AM
‎2008 Feb 06 8:50 AM
‎2008 Feb 06 8:56 AM
Hi Santo,
I understand that your VBAP table is w in the query.
Now try creating a secondary index for VBAP.
Go to se11 and create index for VBAP in the order of your query. This will surely speed up DB access.
On what fields I should specify the Index?
maintain the same query sequence.
Edited by: rohitaash sharma on Feb 6, 2008 9:56 AM