‎2007 Sep 13 4:59 AM
Hi
i have written sql like this, program is running for hour, andw heni run se30 it showed the program is taking lion's share of runtime. how to tune this statement?
SELECT vbeln
wadat
FROM likp
INTO TABLE t_likp
FOR ALL ENTRIES IN t_vbak
WHERE vkorg = t_vbak-vkorg
AND kunag = t_vbak-kunnr
AND wadat_ist IN so_budat.
‎2007 Sep 13 5:06 AM
Your select statement takes long time to execute
because you are not using the key fields to retrive the data
in likp key fields are vbeln(delivery number)
If there is no way to get the delivery number
try creating the secondary index for the fields you are using to retrive the data
if you do not use key fields the selects will be costly selects
Regards,
siva
‎2007 Sep 13 5:17 AM
Hi Siva,
I am here trying to get the delivery number from LIKP.
I executed the table through se16 by passing the same parameters as in program and i got the out put very fast...
I guess LIKP is very fast if we pass sales org and customer date range...
I will try creating the indexes but not very comfortable in creating them..
Thanks alot for the reply
‎2007 Sep 13 5:14 AM
Hi Nihi,
What are the contents of the table t_vbak and if you have vbeln in that then you can reconstruct your select statement as follows:
SELECT vbeln
wadat
FROM likp
INTO TABLE t_likp
FOR ALL ENTRIES IN t_vbak
WHERE vbeln = t_vbak-vbeln
and vkorg = t_vbak-vkorg
AND kunag = t_vbak-kunnr
AND wadat_ist IN so_budat.
Check this.
Reward if helpful.
Regards,
Ravi G
‎2007 Sep 13 5:24 AM
Hi Ravi,
I don't think it will work,,
vbak-vbeln is sales doc where as likp-vbeln is delivery note
‎2007 Sep 13 5:23 AM
<b>IF NOT T_VBAK[] IS INITIAL.
SORT T_VBAK by VKORG KUNAG.</b>
SELECT vbeln
wadat
FROM likp
INTO TABLE t_likp
FOR ALL ENTRIES IN t_vbak
WHERE vkorg = t_vbak-vkorg
<b>AND wadat_ist IN so_budat
AND kunag = t_vbak-kunnr.</b>
<b>ENDIF.</b>
‎2007 Sep 13 5:41 AM
Hi prashanth,
Isuue resolved.. offcoursw other elements in my program which i rectified them too..
But your suggestion worked..awarding points to you
Thanks all..