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: 

Best method to get connected to KONV table!!!

Former Member
0 Kudos
1,309

Hi,

To join the Billing document Item Level wise to "KONV" table the following query can be used;

WHERE VBRKKNUMV = KONVKNUMV and

VBRKVBELN = VBRPVBELN and

VBRPPOSNR = KONVKPOSN…

If you carefully observe the "KONV" table you will find the field “KNUMH” which uniquely identify each record in "KONV" table.

1. Using “KNUMH” field could we build a link between KONV and VBRP table?

2. Is there alternate query for the above?

3. Is there a Function that could be used instead of the Query?

Thanks,

Kishan

1 ACCEPTED SOLUTION

Former Member
0 Kudos
346

Hi,

You could write your selects this way:

SELECT VBELN

KNUMV

FKDAT

KUNRG

KUNAG

VKORG

VTWEG

FKART

WAERK

INTO TABLE I_VBRK

FROM VBRK

WHERE ...............

SELECT VBELN

POSNR

MATNR

NETWR

FKIMG

AUBEL

AUPOS

VRKME

MEINS

INTO TABLE I_VBRP

FROM VBRP FOR ALL ENTRIES IN I_VBRK

WHERE VBELN = I_VBRK-VBELN.

  • get pricing conditions for all the billing items

SELECT KNUMV

KPOSN

KSCHL

KWERT INTO TABLE I_KONV

FROM KONV FOR ALL ENTRIES IN I_VBRP

WHERE KNUMV = I_VBRP-KNUMV AND

KPOSN = I_VBRP-POSNR AND

KSTAT <> C_X AND

KINAK = '' AND

KRUEK <> C_X.

regards

Aveek

13 REPLIES 13

Vinod_Chandran
Active Contributor
0 Kudos
346

Hi Kishan,

What you are following is correct. The tables VBRK and VBRP does not have the field KNUMH so you cannot link with KONV.

Thanks

Vinod

andreas_mann3
Active Contributor
0 Kudos
346

Hi Koshan,

try fm <b>PRICING</b>

regards Andreas

Former Member
0 Kudos
346

Hi,

Your current query is fine, that is the correct way also,

KNUMH won't work for this issue.

Cheers,

Sasi

Former Member
0 Kudos
346

Hi,

Your current query is fine, that is the correct way also,

KNUMH won't work for this issue.

Cheers,

Sasi

Former Member
0 Kudos
346

hi Guys ,

we cannt use Cluster tables in Join?

we have some FM to get Condtion values ?check with condtion

regards

Prabhu

Former Member
0 Kudos
347

Hi,

You could write your selects this way:

SELECT VBELN

KNUMV

FKDAT

KUNRG

KUNAG

VKORG

VTWEG

FKART

WAERK

INTO TABLE I_VBRK

FROM VBRK

WHERE ...............

SELECT VBELN

POSNR

MATNR

NETWR

FKIMG

AUBEL

AUPOS

VRKME

MEINS

INTO TABLE I_VBRP

FROM VBRP FOR ALL ENTRIES IN I_VBRK

WHERE VBELN = I_VBRK-VBELN.

  • get pricing conditions for all the billing items

SELECT KNUMV

KPOSN

KSCHL

KWERT INTO TABLE I_KONV

FROM KONV FOR ALL ENTRIES IN I_VBRP

WHERE KNUMV = I_VBRP-KNUMV AND

KPOSN = I_VBRP-POSNR AND

KSTAT <> C_X AND

KINAK = '' AND

KRUEK <> C_X.

regards

Aveek

0 Kudos
346

Hi Aveek Ghose,

I awarded you points. I am now actually looking for a exact Function to get Item Level Price from KONV table.

Sorry to loop this Question.

Thanks

Kishan

0 Kudos
346

RV_PRICE_PRINT_ITEM

0 Kudos
346

Hi,

Max has provided the correct answer.

CALL FUNCTION 'RV_PRICE_PRINT_ITEM'

EXPORTING

COMM_HEAD_I = KOMK

COMM_ITEM_I = KOMP

IMPORTING

COMM_HEAD_E = KOMK

COMM_ITEM_E = KOMP

TABLES

TKOMV = TKOMV

TKOMVD = TKOMVD.

regards

Aveek

0 Kudos
346

Hi,

There is another fucntion module you could try out:

CALL FUNCTION 'PRICING'

EXPORTING

calculation_type = c_c

comm_head_i = im_komk

comm_item_i = im_komp

IMPORTING

comm_head_e = ex_komk

comm_item_e = ex_komp

TABLES

tkomv = ex_komv.

regards

Aveek

0 Kudos
346

Hi Aveek Ghose,

Your points awarded!

Thank U very much. One more doubt The KOMK & KOMP structures have lots of fields in them. Do I have to populate each field in them? Could U be kind enough to give me a example what fields need to be populated in this 2 structures. That will solve this problem.

Thanks,

Kishan

0 Kudos
346

Hi,

Sorry to loop this.

CALL FUNCTION 'RV_PRICE_PRINT_ITEM'

EXPORTING

COMM_HEAD_I = KOMK

COMM_ITEM_I = KOMP

IMPORTING

COMM_HEAD_E = KOMK

COMM_ITEM_E = KOMP

TABLES

TKOMV = TKOMV

TKOMVD = TKOMVD.

What values have to filled in KOMK, KOMP structures because it has many fields.

Thanks,

Kishan

0 Kudos
346

Hi,

Here are the fields that need to be populated:

CLEAR KOMK.

KOMK-MANDT = SY-MANDT.

KOMK-KALSM = VBDKR-KALSM.

KOMK-FKART = VBDKR-FKART.

KOMK-KAPPL = 'V'.

IF VBDKR-KAPPL NE SPACE.

KOMK-KAPPL = VBDKR-KAPPL.

ENDIF.

KOMK-WAERK = VBDKR-WAERK.

KOMK-KNUMV = VBDKR-KNUMV.

KOMK-VBTYP = VBDKR-VBTYP.

KOMK-BUKRS = VBDKR-BUKRS.

KOMK-BELNR = VBDKR-VBELN.

KOMP-KPOSN = VBDPR-POSNR.

regards

Aveek