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

ABAP & SQL performance

Former Member
0 Likes
629

Hi all.

I have the following sql wich performance isn't good enough because one of the tables used in the join as a lot of data.

So i Want to know how i can improve it ?


SELECT DISTINCT ordered_prod
  INTO TABLE ht_data-ordered_prod
  FROM crmd_orderadm_i as i
  JOIN crmd_link as l ON i~header = l~guid_hi
  JOIN crmd_partner as p on l~guid_set = p~guid
  WHERE l~objtype_set = '07'
  AND p~partner_no = wa_but000-partner_guid.

Will it be more efficient if i make separe select from the 3 table and then process it with loops for example ?

Thanks for your suggestions.

5 REPLIES 5
Read only

Former Member
0 Likes
587

hi

use select for all entries it will improve ur perfromance

for an beeter result try to get the relation in tables and flow of data lets take and Example of three table

i_tab1 with key A

i_tab2 with key A B

i_tab3 with key A B C

now frist

apply only select query

to it

like select * from SDR into table ZXS

where ......

now apply for all entries in this manner

select * from RET in SDER

for all entries in ZXS

where

...= ZXS-A

similarly for last table and this time use for all entry for table SDER.

Cheerts

Snehi

Cheers

Snehi

Edited by: snehi chouhan on Jul 10, 2008 10:10 AM

Read only

Former Member
0 Likes
587

You can use secondary indexes for the table which has a lot of data.

Read only

Former Member
0 Likes
587

Hi Friend,

Use FOR ALL ENTRIES in the select statement.

Regards

Hemant Khemani

Read only

0 Likes
587

Hi

try this code.

select ordered_prod into table ht_data_ordered_prod

from crmd_orderamd_i as i inner join crmd_link as l

ON iheader = lguid_hi where l~objtype-set = '07' and your selection screen condition.

if not ht_data[] is initial.

select distinct ordered_prod into table <int table>

from crmd_partner for all entries in ht_data

where partner_no = wa_but000-partner_guid.

endif.

regards.

sriram.

Read only

Former Member
0 Likes
587

HI,

~go ahead with the select,

~ remove that distinct from the select.

~after the data fetch sort the internal table and remove the duplicates.

SELECT ordered_prod

INTO TABLE ht_data-ordered_prod

FROM crmd_orderadm_i as i

JOIN crmd_link as l ON iheader = lguid_hi

JOIN crmd_partner as p on lguid_set = pguid

WHERE l~objtype_set = '07'

AND p~partner_no = wa_but000-partner_guid.

~are u using select-endselect, if no then why ht_data-ordered_prod????