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 tuning on SELECT Statement

Former Member
0 Likes
1,138

Hi all,

Good day!

I would like to ask for your assistance on this,

SELECT SINGLE *
FROM zcp_dt_spas_main
INTO CORRESPONDING FIELDS OF wa_spasmain
WHERE pa_partner EQ m_crn-partner and ( penstat = 'A' or ( penstat = 'S' and parfs in ('C','N'
) ) ).



using SAT transaction code, it has a large execution time/run time.


How can tune this select statement to make it run faster than it is doing now?



Thank you so much.


Best regards.

6 REPLIES 6
Read only

custodio_deoliveira
Active Contributor
0 Likes
1,111

Hi Almighty,

It's nearly imposible to help you if we don't know your Z table. What's the primary key? Is there any index? Is it a transparent table?

Cheers,

Custodio

Read only

0 Likes
1,111

Hi,

Pass  primary key fields in where condition.

Read only

0 Likes
1,111

sorry i didnt mentioned it. It is a transparent table Sir.

Read only

former_member249399
Active Participant
0 Likes
1,111

You can try with removing 'INTO CORRESPONDING FIELDS ' and

SELECT single field  name

FROM zcp_dt_spas_main
INTO  wa_spasmain
WHERE pa_partner EQ m_crn-partner

and  penstat in  ('A' 'S')

and parfs in ('C','N').

Read only

0 Likes
1,111

How do you know this is a better option without knowing the structure of zcp_dt_spas_main and wa_spasmain? This could easily generate a short dump, i.e. if the structures are different and a numeric target field is receiving a non numeric character.

Read only

Former Member
0 Likes
1,111

Hi,

I have tune your select statement.

Try using the code below code.

data : wa_spasmain type zcp_dt_spas_main.

select single *

FROM zcp_dt_spas_main

into wa_spasmain

WHERE pa_partner EQ m_crn-partner

if sy-subrc eq 0.

  if penstat = 'A' or ( penstat = 'S' and parfs in ('C','N') )

     ............ write further code here.  

  endif.

endif.

Regards,

Dev