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: 

ST05 query performans

Former Member
0 Kudos

Hi,


When i traced the coding below, i am waiting too much.. How can i write this join ? Can you help me ?


BR



SELECT SINGLE b~psmng FROM resb AS a

           INNER JOIN afpo AS b ON a~aufnr = b~aufnr

           INTO gt_data-stoktanuretim

           WHERE a~werks EQ p_werks

             AND a~matnr EQ gt_data-matnr

             AND a~aufnr NE space

             AND a~kdauf EQ gt_data-kdauf

             AND a~kdpos EQ gt_data-kdpos.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

What are you trying to extract, you seem to already have SO, so a simple

select SINGLE psmng
     FROM AFPO
     WHERE kdauf EQ gt_data-kdauf
       AND kdpos EQ gt_data-kdpos.

Could suffice?


Regards,

Raymond

4 REPLIES 4

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Gulsah,

  I hope for this case, it is not required to use inner join concept, since we are fetching single entry.. First fetch the value from RESB Table and then fetch from AFPO Table. Try Select UP TO 1 rows instead of select single.

Regards

Rajkumar Narasimman

former_member185613
Contributor
0 Kudos

Hi,

I would suggest to get the aufnr values from RESB table into an internal table (since WHERE condition involves the fields taken only from the table RESB) and write another query using FOR ALL ENTRIES to fetch the value of the field psmng from the table AFPO.

I am not saying that for al entries works better than the join but you can see if it results in imporvement in performance.

Hope this helps,

~Athreya

raymond_giuseppi
Active Contributor
0 Kudos

What are you trying to extract, you seem to already have SO, so a simple

select SINGLE psmng
     FROM AFPO
     WHERE kdauf EQ gt_data-kdauf
       AND kdpos EQ gt_data-kdpos.

Could suffice?


Regards,

Raymond

0 Kudos

thank you