Skip to Content
author's profile photo Former Member
Former Member

loop

loop at itab into wa_itab.

Now for wa_itab-umwrk I need to get burks

from t001k-werks where wa_itab-umwrk = t001k-werks.

Do i do a select single / read, are there any performance considerations since the fetch is being done inside a loop.

endloop.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 30, 2008 at 10:16 AM

    select single use database buffer....

    rest no idea..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 30, 2008 at 10:18 AM

    I can suggest u one way.

    Collect all the umwrk into one internal table ( Say it_umwrk ).

    Now Use select on T001K for all entries in IT_UMWRK.

    rwrd points if useful

    Bhupal

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 30, 2008 at 10:18 AM

    Select bukrs outside loop and use Read in Loop, yes from my point of view select query in Loop will slow down, because every time loop will do iteration the select query will get fired.

    Hope it will help.

    BR,

    Alok

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 30, 2008 at 10:18 AM

    Hey mn..

    You do one thing make second internal table and accouding to ur internal table use "for all entries"..

    than

    use

    loop it into wa.

    read table secondit(what i have told you to make) into sec_wa where ur condition.

    endloop.

    this approch is best in terms of performance,

    Regards

    Manish.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 30, 2008 at 10:19 AM

    Better if U use a read instead of selecting from table every

    time ...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 30, 2008 at 10:19 AM

    instead of using select single inside loop first fetch the data and then read internal table inside loop for that particular field.\

    this will not affect database evrytime in case of performance issues.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 30, 2008 at 10:20 AM

    Hi!

    It will not cause huge problems, if you are using the SELECT SINGLE with the full key in the WHERE condition.

    I mean something like this:

    SELECT SINGLE * FROM mara WHERE matnr = wa_itab-matnr.

    To reduce the SELECT counts, you can give this command within an AT event:

    SORT itab BY umwrk. "umwrk field has to be the first field in the itab

    loop at itab into wa_itab.

    AT NEW umwrk. "this line

    Now for wa_itab-umwrk I need to get burks

    from t001k-werks where wa_itab-umwrk = t001k-werks.

    Do i do a select single / read, are there any performance considerations since the fetch is being done inside a loop.

    ENDAT. "this line

    endloop.

    Regards

    Tamá

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 30, 2008 at 10:21 AM

    Hi,

    You must use READ Statement because of performance issue.

    If you use select inside the loop it affect the performance.

    Regards

    Boobalan S

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.