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

alternative for RESB Table..

former_member219850
Participant
0 Likes
2,477

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.

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
Read only

Former Member
0 Likes
1,650

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       

Read only

rajkumarnarasimman
Active Contributor
0 Likes
1,650

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

Read only

Former Member
0 Likes
1,650

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

Read only

RaymondGiuseppi
Active Contributor
1,650

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

Read only

0 Likes
1,650

Thanks for help guys..

I really appreciate your help!!!!..

Thanks,

Darshan.