11-25-2006 9:39 AM
Hi All,
We have a problem in retrieving the Sales data from KONV Table.
Below is the code we used to retrieve the data from KONV table.
<b>SELECT KKNUMV KKPOSN KKSCHL KKBETR K~KWERT FROM KONV AS K
INTO CORRESPONDING FIELDS OF TABLE IG_VALUE
FOR ALL ENTRIES IN IG_SALESTAX
WHERE KNUMV = IG_SALESTAX-KNUMV AND
KPOSN = IG_SALESTAX-POSNR AND
KSCHL = 'JIN1' OR KSCHL = 'JIN2' OR
KSCHL = 'JIN4' OR KSCHL = 'JIN5'.</b>
In the testing server when the program is executed it giving "Session Timed Out" error.
Is ther any alternative way to retrieve the data from KONV table or is there any Funtion Module specifically used to retrevive the Sales details.
Suggestions and Help will be much appreciated.
Thanks & Regards.
Ramesh.
11-25-2006 9:41 AM
Please try this
SELECT KNUMV KPOSN KSCHL KBETR KWERT FROM KONV
INTO CORRESPONDING FIELDS OF TABLE IG_VALUE
FOR ALL ENTRIES IN IG_SALESTAX
WHERE KNUMV = IG_SALESTAX-KNUMV AND
KPOSN = IG_SALESTAX-POSNR AND
( KSCHL = 'JIN1' OR
KSCHL = 'JIN2' OR
KSCHL = 'JIN4' OR
KSCHL = 'JIN5' ).
Regards
Kathirvel
11-25-2006 9:46 AM
Hi rmaesh,
pls remove tha INTO CORRESSPONDING.
create an internal table in same selection format.
SELECT KKNUMV KKPOSN KKSCHL KKBETR K~KWERT FROM KONV AS K
<b>INTO TABLE</b> IG_VALUE
FOR ALL ENTRIES IN IG_SALESTAX
WHERE KNUMV = IG_SALESTAX-KNUMV AND
KPOSN = IG_SALESTAX-POSNR AND
<b>( KSCHL = 'JIN1' OR KSCHL = 'JIN2' OR
KSCHL = 'JIN4' OR KSCHL = 'JIN5' ).</b>
rgds
Anver
pls mark all hlpful answers
11-25-2006 10:17 AM
Hi
Dont use into corresponding fields.... its a heavy statement..
use into table...
try doing the both and find the performance yourself....
Thanks
11-25-2006 10:50 AM
11-25-2006 7:21 PM
Your SELECT looks pretty good to me. But there are a couple of things you can try.
Check that the FOR ALL ENTRIES table has values.
Since KONV is a cluster table, it may be running into trouble on the ORs for KSCHL. So try:
CHECK NOT ig_salestax[] IS INITIAL.
SELECT k~knumv k~kposn k~kschl k~kbetr k~kwert FROM konv AS k
INTO CORRESPONDING FIELDS OF TABLE ig_value
FOR ALL ENTRIES IN ig_salestax
WHERE knumv = ig_salestax-knumv AND
kposn = ig_salestax-posnr AND.
DELETE ig_value WHERE
kschl <> 'JIN1' AND kschl <> 'JIN2' AND
kschl <> 'JIN4' AND kschl <> 'JIN5'.
Rob
11-25-2006 11:04 PM
Hi Ramesh,
the reason for timeout definitely comes from the missing brackets around the OR comditions as already suggested.
You don't need an alias ' KONV AS K'. Especially as you do not JOIN anything. Even if you JOIN: You need an alias only if you JOIN a table on itself.
I don't know who is respoisible for the useless use of alias (AS ...). In almost every case it just helps to confuse, nothingh else.
Note: OR is 'weaker' than AND. So in your case all conditions sopecvified are checked but the fulfillment of KSCHL = 'JIN1' OR KSCHL = 'JIN2' OR KSCHL = 'JIN4' OR KSCHL = 'JIN5' is enough to select the record; the whole condition vealuates to TRUE and no index can be used because the whole table must be scanned sequentially.
It is a widespread (and unfortunately supported by SAP) urban legend that INTO CORRESPONDING FIELDS is such a heavy performance breaker when selecting just 5 fields. Performance measures never show significant difference; most time is used by the database to retrieve data.
Regards,
Clemens