Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

statement construction

Former Member
0 Likes
630

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.

6 REPLIES 6
Read only

Former Member
0 Likes
610

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

Read only

0 Likes
610

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

Read only

Former Member
0 Likes
610

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

Read only

0 Likes
610

Hi Ravi,

I don't think it will work,,

vbak-vbeln is sales doc where as likp-vbeln is delivery note

Read only

Former Member
0 Likes
610

<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>

Read only

0 Likes
610

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..