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

Former Member
0 Likes
630

I have a SELECT statement that is bogging down the performance of my report. Can this be converted into 2 READ's. Any ideas on how to improve the performance of this code. Thanks.

  SELECT SINGLE qals~prueflos qals~aufnr qals~selmatnr afpo~dauat afpo~dwerk
        FROM ( qals
        INNER JOIN afpo ON afpo~aufnr = qals~aufnr )
        INTO (qals-prueflos, qals-aufnr, qals-selmatnr, afpo-dauat, afpo~dwerk)
        WHERE qals~matnr    = collector-matnr
          AND qals~charg    = collector-charg
          AND qals~art      = c_manualinsp
          AND qals~herkunft = c_gr_prod.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
605

HI,

Write two select instead of this join..

select single prueflos aufnr selmatnr from qalis into wa_qals where matnr = collector-matnr

and charg = collector-charg

AND art = c_manualinsp

AND herkunft = c_gr_prod.

if sy-subrc eq 0.

select aufnr dauat dwerk from afpo where aufnr = wa_qals-aufnr...

if sy-subrc eq 0.

your logic

endif.

endif.

Thask

mahesh

4 REPLIES 4
Read only

Former Member
0 Likes
606

HI,

Write two select instead of this join..

select single prueflos aufnr selmatnr from qalis into wa_qals where matnr = collector-matnr

and charg = collector-charg

AND art = c_manualinsp

AND herkunft = c_gr_prod.

if sy-subrc eq 0.

select aufnr dauat dwerk from afpo where aufnr = wa_qals-aufnr...

if sy-subrc eq 0.

your logic

endif.

endif.

Thask

mahesh

Read only

Former Member
0 Likes
605

Isnt a JOIN always faster than 2 select statements ?

Read only

0 Likes
605

Not always...I think it depends on wether your are using the complete key, index and amount of data....but not really sure -:P

Greetings,

Blag.

Read only

0 Likes
605

Did you find Answer ?

QALS - Key field PRUEFLOS ,you are not using here

if not see the my comments

if you do not have key field(Where condition) when you use select single ,then do not use select single command.

instead of select single ,use select up to 1 row ,see the performance now.

if you need help on select up to 1 row then see the saphelp.

Thanks

Seshu