Application Development 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: 

Retrieving the Data from KONV Table

Former Member
0 Kudos

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.

6 REPLIES 6

Former Member
0 Kudos

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

anversha_s
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi

Dont use into corresponding fields.... its a heavy statement..

use into table...

try doing the both and find the performance yourself....

Thanks

Former Member
0 Kudos

Hi ,

Try with RV_KONV_SELECT .

Regards,

Raghav

Former Member
0 Kudos

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

Clemenss
Active Contributor
0 Kudos

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