‎2008 Jan 31 3:39 AM
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
‎2008 Jan 31 3: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
‎2008 Jan 31 4:12 AM
‎2008 Jan 31 4: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....
‎2008 Jan 31 5:13 AM
You are correct, i tied like u said, but RUECK,RMZHL fields in Not available in AFPO table.
Its available in AFKO Table, But value is not available in that table.
What can i do, pls advice me.
‎2008 Jan 31 5:20 AM
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.
‎2008 Jan 31 4:55 AM
If poosible, try to use inner join istead of for all entries. Inner Join should improve your perfomance.
‎2008 Jan 31 5: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