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

Query Error

Hi Experts

I have used the following query, but its performance is very bad, what could be the reason, pls advise me.

IF i_afpo[] IS not INITIAL.

sort i_afpo by aufnr.

delete adjacent duplicates from i_afpo comparing aufnr.

SELECT AUFNR

BUDAT

ISDD

WERKS

SMENG

ARBID

RUECK

RMZHL

VORNR

LTXA1

GRUND

STOKZ

STZHL

AENAM

AUERU

EXNAM

AUFPL

APLZL

ISM01

ILE01

ANZMA

RMNGA

XMNGA

extid

stzhl

GMEIN

LMNGA FROM AFRU

INTO TABLE i_AFRU

FOR ALL ENTRIES IN i_afpo

WHERE aufnr EQ i_afpo-aufnr AND

BUDAT IN ZDAT AND

ISDD IN ZEDAT AND

GRUND IN ZLINE AND

WERKS IN ZPL.

ENDIF.

Thanks in advance.

Regards

Rajaram

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 03:42 AM

    Hi,

    place this code before if statement and try

    sort i_afpo by aufnr.

    delete adjacent duplicates from i_afpo comparing aufnr.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 31, 2008 at 04:18 AM

    Hi Rajaram

    sort i_afpo by aufnr.
    delete adjacent duplicates from i_afpo comparing aufnr.
    
    IF i_afpo[] IS not INITIAL.
    
    SELECT AUFNR BUDAT ISDD WERKS SMENG ARBID RUECK
    RMZHL VORNR LTXA1 GRUND STOKZ STZHL AENAM AUERU
    EXNAM AUFPL APLZL ISM01 ILE01 ANZMA RMNGA XMNGA
    extid  stzhl GMEIN LMNGA 
    FROM AFRU
    INTO TABLE i_AFRU
    FOR ALL ENTRIES IN i_afpo
    WHERE aufnr EQ i_afpo-aufnr AND
    BUDAT IN ZDAT AND
    ISDD IN ZEDAT AND
    GRUND IN ZLINE AND
    WERKS IN ZPL.
    ENDIF.
    

    in i_afpo try to get RUECK RMZHL and the change the condition as

    ....
    ...
    ..
    LMNGA FROM AFRU
    INTO TABLE i_AFRU
    FOR ALL ENTRIES IN i_afpo
    WHERE aufnr EQ i_afpo-aufnr AND
    RUECK  EQ i_afpo-RUECK and 
    RMZHL  EQ i_afpo-RMZHL and  
    BUDAT IN ZDAT AND
    ISDD IN ZEDAT AND
    GRUND IN ZLINE AND
    WERKS IN ZPL.
    ENDIF.

    if its not possible its okay for ur query to take long time.. becoz ur not using any of the key fields from the table....

    when ever you pick and option to use a table.. u need to make sure you have some key field with u....

    Add a comment
    10|10000 characters needed characters exceeded

    • Functional consultants are there to help us when we are stuck with such sort of issues.. if you have one, get him..

      RUECK data element CO_RUECK

      RMZHL data element CO_RMZHL

      hit a where used list with the data element and see what other tables have this .. and find out if anything you can use of those list... you will get a very big list.. all the best..

      Award points if helpful.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 04:55 AM

    If poosible, try to use inner join istead of for all entries. Inner Join should improve your perfomance.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 05:01 AM

    Hi,

    I usally look for index in that table.If index exist i will give the where option in the index order

    For eg: if the index is BUADT WERKS AUFNR

    i will give the where option like BUDAT = ' ' and WERKS ' ' and aufnr = ' '.

    The other way is give the where condition in the order of the table

    in your query you can try in this order

    ..................where BUDAT IN ZDAT AND

    WERKS IN ZPL AND

    GRUND IN ZLINE AND

    SDD IN ZEDAT AND

    ufnr EQ i_afpo-aufnr.

    better create a index ....

    Regards,

    karthik

    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.