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: 

Condition Types

0 Kudos

Hi Friends,

Could any one help in calculating:

Discount value:

sum of discounts used in standard price procedure

structure Z_INV_HEAD component KWERT, condition values ZTPR, ZTR1, ZCM5, ZEDI, ZDMG

Using the below logic:

Calculate sum of all discounts used in billing document

and write this sum into invoice layout.

All possible discount condition values which are used in our price procedures are at the moment ZTPR, ZTR1, ZCM5, ZEDI, ZDMG.

Take values from billing document header assigned to discount condition types: structure is KOMV, search by field KSCHL (which is condition type - find all condition types which are used in our concrete billing document from the ones above), find related values in fields KWERT and calculate sum of retrieved values.

Help me with some coding..... Thanks to all

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos

Hi Bhaskar

for calculating the totals:

if itab-kschl in ('ZTPR' , 'ZTR1', 'ZCM5', 'ZEDI', 'ZDMG')

lv_total = itab-value + lv_total.

endif.

KOMV/ KONV is a cluster table so you cannot join this table... so need to use for all entries, I guess KNUMV is the key in this table.

select f1 f2 f3 from KOMV

into table it_komv

for all entires in itab

where kschl in ('ZTPR' , 'ZTR1', 'ZCM5', 'ZEDI', 'ZDMG')

knumv = itab-knumv.

I dont have access to R3, else I would have given you more details.

2 REPLIES 2

former_member156446
Active Contributor
0 Kudos

Hi Bhaskar

for calculating the totals:

if itab-kschl in ('ZTPR' , 'ZTR1', 'ZCM5', 'ZEDI', 'ZDMG')

lv_total = itab-value + lv_total.

endif.

KOMV/ KONV is a cluster table so you cannot join this table... so need to use for all entries, I guess KNUMV is the key in this table.

select f1 f2 f3 from KOMV

into table it_komv

for all entires in itab

where kschl in ('ZTPR' , 'ZTR1', 'ZCM5', 'ZEDI', 'ZDMG')

knumv = itab-knumv.

I dont have access to R3, else I would have given you more details.

Former Member
0 Kudos

Hi ,

Try this sample code :

select kschl kbetr kawrt kposn kwert kherk kstat stunr

from konv into corresponding fields of table it_konv

where knumv = vbdkr-knumv.

Discount for pricing conditions :

read table it_konv with key kschl = 'ZTPR'

kposn = vbdpr-posnr.

if sy-subrc eq 0 .

move it_konv-kwert to wa_disc_ZTPR.

move it_konv-kbetr to ppu_ZTPR.

condense ppu_ZTPR.

condense wa_disc_ZTPR.

zkv1_disc_price = wa_disc_price1 * wa_disc_ZTPR / 10000.

disc_price_ZTPR = wa_disc_zkv1 - zkv1_disc_price.

endif.

ADDITON:

loop at it_headercond into wa_conditions.

case wa_conditions-flag.

when 1.

add wa_conditions-kwert to subtotal.

..........................................

ENDLOOP.

Regards,

Mohan