‎2007 May 17 5:13 AM
Hi to all ,
Please can u give me the code for this logic.
i am not getting any out put with my logic .
Go to VBRK with VBRK-VBELN = ITAN1-VBELN and get from field KNUMV the condition record number. Then for each ITAB1-POSNR of this ITAB1-VBELN go to KONV with:
KONV-KNUMV = VBRK-KNUMV
KONV-KPOSN = ITAB1-POSNR
KONV-KSCHL = the condition selected from /GIL/ZGTYPCODE_V for this Sales org and FUNCTION = 'WICREV'
get from field KBETR the condition rate from KPEIN the pricing unit and from KUMZA and KUMNE the conversion factors.
Calculate then the selling price per 1000 PUs as follows:
(KBETR / KPEIN) x 1000 x (KUMNE/KUMZA)
Update with the calculated value ITAB1-KBETR for the the related line of ITAB1
thanks in advance
‎2007 May 18 3:00 AM
Hi
Rough logic for the code:
declare the internal table for condition types i_kschl , i_price
and the i_vbrk with the necessary fields.
select kschl into table i_kschl
from /GIL/ZGTYPCODE_V where vkorg = <value> and FUNCTION = 'WICREV'.
if not itan1[] is initial.
select avbeln aknumv b~posnr into table i_vbrk
from vbrk as a join vbrp as b on avbeln = bvbeln
for all entries in itan1
where vbeln = itan1-vbeln.
endif.
if not i_vbrk{} is initial.
select knumv kposn kbetr KPEIN KUMZA KUMNE from
konv into table i_price
for all entries in i_vbrk
where knumv = i_vbrk-knumv and
kposn = i_vbrk-posnr.
endif.
loop at itan1.
Read the internal tables i_price and update the prices value into the corresponding field with the formula
(KBETR / KPEIN) x 1000 x (KUMNE/KUMZA)
Modify the itan1 index sy-tabix transporting <field>.
endloop.
Reward points if useful
Regards
Anji
‎2007 May 17 11:18 PM
Post your code, and the output you wanted, i can give you the corrected code.
‎2007 May 18 3:00 AM
Hi
Rough logic for the code:
declare the internal table for condition types i_kschl , i_price
and the i_vbrk with the necessary fields.
select kschl into table i_kschl
from /GIL/ZGTYPCODE_V where vkorg = <value> and FUNCTION = 'WICREV'.
if not itan1[] is initial.
select avbeln aknumv b~posnr into table i_vbrk
from vbrk as a join vbrp as b on avbeln = bvbeln
for all entries in itan1
where vbeln = itan1-vbeln.
endif.
if not i_vbrk{} is initial.
select knumv kposn kbetr KPEIN KUMZA KUMNE from
konv into table i_price
for all entries in i_vbrk
where knumv = i_vbrk-knumv and
kposn = i_vbrk-posnr.
endif.
loop at itan1.
Read the internal tables i_price and update the prices value into the corresponding field with the formula
(KBETR / KPEIN) x 1000 x (KUMNE/KUMZA)
Modify the itan1 index sy-tabix transporting <field>.
endloop.
Reward points if useful
Regards
Anji