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

Query Error

Former Member
0 Likes
891

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

7 REPLIES 7
Read only

Former Member
0 Likes
869

Hi,

place this code before if statement and try

sort i_afpo by aufnr.

delete adjacent duplicates from i_afpo comparing aufnr.

Regards

Read only

0 Likes
869

still its not working fine yar.,

Read only

former_member156446
Active Contributor
0 Likes
869

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....

Read only

0 Likes
869

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.

Read only

0 Likes
869

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.

Read only

Former Member
0 Likes
869

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

Read only

Former Member
0 Likes
869

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