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

Performance issue wid Select query

former_member201364
Participant
0 Likes
1,025

Hello All,

There is a performance issue with the below select query.

Select kunnr vtweg vtwku

from knvv into gt_knvv where kunnr = s_kunnr

and vkorg = gt_int-vkorg

and vtweg = gt_int-vtweg.

Gt_int is sorted by the primary keys and fields in "where" are in proper order.

But since there is no value in s_kunnr , the above statement is consuming 95% of the execution time.

Can any one of you suggest how to improve the performance?

Regards,

Sindhuri Vajjala

9 REPLIES 9
Read only

Former Member
0 Likes
988

I think u are selecting large no of data that why it take more time.

to improve performance you can check with secondary index also.

Read only

Former Member
0 Likes
988

did you ever hear about indexes ??? It is not more complicated than a telephone, know the name

get the telephone, know only first name and you will not find anything ... in reasonable time.

I can not see you table knw, but check SE11, how many records are in this table

what are the key fields

are there other indexes

Which fields of indexes appear in your where clause?

Siegfried

Read only

Former Member
0 Likes
988

Hi

first of all check whether u are using key fields, indexes or not.

Read only

Former Member
0 Likes
988

>

> Hello All,

>

> There is a performance issue with the below select query.

>

> Select kunnr vtweg vtwku

> from knvv into gt_knvv where kunnr = s_kunnr

> and vkorg = gt_int-vkorg

> and vtweg = gt_int-vtweg.

>

> Gt_int is sorted by the primary keys and fields in "where" are in proper order.

>

> But since there is no value in s_kunnr , the above statement is consuming 95% of the execution time.

>

> Can any one of you suggest how to improve the performance?

>

> Regards,

> Sindhuri Vajjala

One question, what is gt_int? Do you loop at gt_int?

I'm asking this because i can not see any for all entries in the select statement and wondering where does gt_int value came from.

Regards,

Abraham

Read only

Former Member
0 Likes
988

Hi.

The issue is with your where condition vkorg = gt_int-vkorg and vtweg = gt_int-vtweg only. Instead GT_INT use some variables or constants in the select query.

Regards

Balaji.G

Read only

Former Member
0 Likes
988

Hello Poornima,

Table KNVV Customer Master Sales Data & where clause is using index key fields.

Is s_kunnr variable of selection screen field?

If yes then you should have used where kunnr IN s_kunnr (not the equal sign = )

Gt_int an internal table should be used as 'for all entries', pls ref link for code example-

http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3a1f358411d1829f0000e829fbfe/content.htm

search for word 'Tabular Conditions'.

Once you modify select query let us know how is the result and will assist if any issue.

Thank You,

Nishikant.

Read only

Former Member
0 Likes
988

Hi,

Use IN operator with S_KUNNR.

Is GT_INT is internal Table with Header Line? If yes, does Header Line got some values.

Instead of using GT_INT fields , better use some temp var's and transfer the values in that Temp var's.

Read only

Former Member
0 Likes
988

HI....

1. When ever u r using select options use IN in where condition.

2. FInd out what r key fileds in the table and filter selection by adding all possible fields.

3. INTO TABLE clause is mandatory.

4. try to make selection options and parameters using in this SELECT mandatory.

Read only

Former Member
0 Likes
988

Hi Poornima,

Please follow up with Siegfried Boes answer.

Regards,

Jyothi CH.