01-16-2008 3:52 PM
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
01-16-2008 4:12 PM
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.
01-16-2008 4:12 PM
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.
01-16-2008 4:19 PM
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