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: 

alternative for RESB Table..

former_member219850
Participant
0 Kudos

SELECT posnr matnr shkzg bdmng meins aufnr

          INTO TABLE gt_resb

          FROM resb

       FOR ALL ENTRIES IN gt_afih

           WHERE  aufnr = gt_afih-aufnr." AND

           "werks = gt_afih-werks and

          "posnr NE '0000'.

     IF sy-subrc EQ 0.

     ENDIF.


Above query is taking too much time.


Please suggest alternative tables from which I can get same data..


Thanks.

Darshan.

5 REPLIES 5

Former Member
0 Kudos

Hi Darshan,

This query will take much time why because you are not giving primary key in the where conidtion,

If you want to select the data with the same fields which you are mentioning in the where condition better to consult basis people and is there any possibility create secondary index and do the query as

below . then your queryu will run fast.

SELECT posnr matnr shkzg bdmng meins aufnr

          INTO TABLE gt_resb

          FROM resb

          FOR ALL ENTRIES IN gt_afih

          WHERE  aufnr = gt_afih-aufnr

%_HINTS ORACLE 'INDEX("RESB" "RESB~INDEX NAME")'.

         

Regards

Mani       

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Darshan,

In RESB table, create the index for AUFNR field.

I suggest to use inner join instead of For all entries

If you are using For all entries, make sure there is no duplication records in gt_afih table.

Regards

Rajkumar Narasimman

former_member1200644
Participant
0 Kudos

Hi Darshan,

First Select RSNUM from table AFKO and then pass RSNUM of AFKO  in RSEB table .

I think , it is helpful.

Regards,

Nilesh Patel

raymond_giuseppi
Active Contributor

Read 187906 - Performance: Customer developments in PP and PM


Incorrect:

  SELECT FROM resb WHERE AUFNR = ...

Correct:

  SELECT rsnum FROM afko WHERE aufnr = <resb-aufnr>

    SELECT ..... FROM resb WHERE rsnum = <afko-rsnum>

Hint: And focus on JOIN and not FOR ALL ENTRIES.

Regards,

Raymond

0 Kudos

Thanks for help guys..

I really appreciate your help!!!!..

Thanks,

Darshan.