Application Development 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: 

Performance tuning on SELECT Statement

Former Member
0 Kudos

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

custodio_deoliveira
Active Contributor
0 Kudos

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

0 Kudos

Hi,

Pass  primary key fields in where condition.

0 Kudos

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

former_member249399
Active Participant
0 Kudos

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

0 Kudos

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.

0 Kudos

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