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: 

Access to KONV

fernando_vega2
Explorer
0 Kudos

Hello,

I would like to obtain a sum of discounts (which in our case is consistent with the "Condition type" KSCHL 'ZDPP' and 'ZDPX') to to send data to BW

I thought to do this as follows:

SELECT SUM(KBETR) into v_kbetr

FROM KONV

WHERE KNUMV = VBRK-KNUMV

AND KPOSN = i_mc13vd0itm-posnr

AND KSCHL = 'ZDPP'

OR KSCHL = 'ZDPX'.

But as the table KONV is a cluster table, there are two problems:

1- I can't do SELECT SUM

2- I can't access by indexes (being cluster table) and I am afraid that the program, to try a lot of data, it dies.

I would like to make the selection with another table or with inner join of several tables because I think that it can be better than a select into table from konv and a loop.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

U need to do a simple select:

DATA: V_KBETR TYPE KONV-KBETR,
           T_KBETR TYPE KONV-KBETR.

T_KBETR = 0.

SELECT KBETR) into v_kbetr FROM KONV
   WHERE KNUMV = VBRK-KNUMV
        AND KPOSN = i_mc13vd0itm-posnr
        AND ( KSCHL = 'ZDPP' OR KSCHL = 'ZDPX' ).

   T_KBETR = T_KBETR + V_KBETR.
ENDSELECT.

U can also stored the record in an internal table and then loop it, but I think it's the same for performace:

DATA: T_KONV TYPE TABLE OF KONV WITH HEADER LINE,
           T_KBETR TYPE KONV-KBETR.

T_KBETR = 0.

SELECT * FROM KONV INTO TABLE T_KONV
   WHERE KNUMV = VBRK-KNUMV
        AND KPOSN = i_mc13vd0itm-posnr
        AND ( KSCHL = 'ZDPP' OR KSCHL = 'ZDPX' ).

LOOP AT T_KONV.
   T_KBETR = T_KBETR + T_KONV-KBETR.
ENDLOOP.

Max

7 REPLIES 7

Former Member
0 Kudos

Hi

U need to do a simple select:

DATA: V_KBETR TYPE KONV-KBETR,
           T_KBETR TYPE KONV-KBETR.

T_KBETR = 0.

SELECT KBETR) into v_kbetr FROM KONV
   WHERE KNUMV = VBRK-KNUMV
        AND KPOSN = i_mc13vd0itm-posnr
        AND ( KSCHL = 'ZDPP' OR KSCHL = 'ZDPX' ).

   T_KBETR = T_KBETR + V_KBETR.
ENDSELECT.

U can also stored the record in an internal table and then loop it, but I think it's the same for performace:

DATA: T_KONV TYPE TABLE OF KONV WITH HEADER LINE,
           T_KBETR TYPE KONV-KBETR.

T_KBETR = 0.

SELECT * FROM KONV INTO TABLE T_KONV
   WHERE KNUMV = VBRK-KNUMV
        AND KPOSN = i_mc13vd0itm-posnr
        AND ( KSCHL = 'ZDPP' OR KSCHL = 'ZDPX' ).

LOOP AT T_KONV.
   T_KBETR = T_KBETR + T_KONV-KBETR.
ENDLOOP.

Max

fernando_vega2
Explorer
0 Kudos

Yes, but my main problem is access to the table KONV. I would get the same data by accessing a faster way with other tables. I think that the access to KONV is slow.

Edited by: José Luis Arteta on Oct 16, 2008 4:14 PM

0 Kudos

Hi

Do u think it or you are sure?

U're using the main key fields (like KNUMV and KPOSN) in your select: is it so slow?

U can check the pricing to get the Step number (STUNR) other key field in order to improve the performance.

There isn't another table, all pricing data are in KONV table, sometime some value can be stored in the following VBRP fields:

KZWI1

KZWI2

KZWI3

KZWI4

KZWI5

KZWI6

U should check customizing of procedure to understand which information can be stored there.

But if they aren't there, u can get them from KONV only.

Max

fernando_vega2
Explorer
0 Kudos

I am still not sure because in the Development I do not have a significant amount to evaluate performance.

But once I remember that I had to access the table BSEG (a cluster table as well) and it was very slow (I received a DUMP). But accessing to BSID table (BSID belongs to the cluster and it contains data from the customers and, in that case, it was that I needed) was going pretty fast.

0 Kudos

Hi

Probably because BSEG table was read without to use key fields, but if you use key fields you'll obtain the same performace of transparent table.

I believe you should good performance in your selection of KONV, I've often used a selection of KONV like yours in my program and I have never had performance problem.

Max

0 Kudos

The issue with BSEG would have been that you were not using the index. Access to BSEG can and should be just as fast as any other table. But you have to use the index. The same holds with KONV.

Rob

fernando_vega2
Explorer
0 Kudos

Thanks Max and Rob,

I will try this and I'll comment the result ond this post.