12-02-2011 10:41 PM
Hi Experts,
I would like to ask help, currently im implementing new custom routine in VOFM, im doing some calculation for the Value of
XKOMV-KBETR and XKOMV-KWERT.
Inside the routine I am successfully made the changes by using this logic.
<CALCULATION happening>
W_KSCHL = XKOMV-KSCHL.
READ TABLE XKOMV WITH KEY KSCHL = W_KSCHL.
IF sy-subrc EQ 0.
MOVE W_KBETR TO XKOMV-KBETR.
MOVE W_KWERT TO XKOMV-KWERT.
MODIFY XKOMV TRANSPORTING KBETR KWERT WHERE KSCHL EQ W_KSCHL.
ENDIF.
but when I came out of that routine, this logic overwrite all the changes I've made.
execute condition value formula not changing xkomv
will normally be processed in xkomv_kwert_ermitteln
IF xkomv-kofrm NE 0 AND wertformel EQ space AND komp-kposn NE 0.
rettkomv = xkomv.
xkwert = xkomv-kwert.
frm_kondi_wert-nr = xkomv-kofrm.
PERFORM (frm_kondi_wert) IN PROGRAM saplv61a IF FOUND.
xkomv = rettkomv.
ENDIF.
RETTKOMV overwrite everything, can any one help me please, Im implementing this for the condition type in ME21N (PO create) at Item level, that's why the value on the screen of my PO is not updating.
Thanks and regards,
Ishmer03
Edited by: Ishmer03 on Dec 2, 2011 11:41 PM
Edited by: Ishmer03 on Dec 2, 2011 11:48 PM
12-03-2011 12:51 AM
First of all, I assume, that you are putting your coding in a "Condition Value" formula in VOFM. I also, assume that you have assigned this formula in the "Alternate calculation type" field against the condition type, whose value that you are trying to modify, in your pricing procedure / calculation schema configuration
I see that you also need to update variable XKWERT which takes the final condition value from calculation. You don't need to set KBETR, which will automatically get calculated by SAP based on KWERT and base value / quantity.
Try
W_KSCHL = XKOMV-KSCHL.
READ TABLE XKOMV WITH KEY KSCHL = W_KSCHL.
IF sy-subrc EQ 0.
MOVE W_KWERT TO XKOMV-KWERT.
MODIFY XKOMV TRANSPORTING KWERT WHERE KSCHL EQ W_KSCHL.
XKWERT = W_KWERT.
ENDIF.
12-03-2011 4:15 AM
hi ,
FORM FRM_KONDI_WERT_826.
*{ INSERT SNDK900032
tables : zvtdds , mvke ,lips.
data : wf_ntgew like mara-ntgew,
wf_MVGR5 like vbap-MVGR5,
wf_kwert like komv-kwert,
wf_kwert1 like komv-kwert,
wa_komv like xkomv,
ykomv like xkomv,
ymvke like mvke ,
wf_weight like mara-ntgew.
ykomv = xkomv.
select single ntgew
into wf_ntgew
from mara client specified
where mandt = sy-mandt
and matnr = komp-matnr.
if sy-subrc eq 0.
if ( sy-tcode = 'VF01' or sy-tcode = 'VF02' ) .
select single *
from lips CLIENT SPECIFIED
where mandt = sy-mandt
AND VBELN = KOMP-VGBEL
and matnr = komp-matnr
and kokrs = komk-vkorg
and vtweg = komk-vtweg .
IF SY-SUBRC = 0 .
select single * from zvtdds client specified
where mandt = sy-mandt
and vkorg = komk-vkorg
and vtweg = komk-vtweg
and mvgr5 = lips-mvgr5.
endif.
ELSEIF ( SY-TCODE = 'VA01' or sy-tcode = 'VA02' ) .
select SINGLE *
from mvke client specified
where mandt = sy-mandt
and matnr = komp-matnr
and vkorg = komk-vkorg
and vtweg = komk-vtweg .
if sy-subrc = 0 .
select single * from zvtdds client specified
where mandt = sy-mandt
and vkorg = komk-vkorg
and vtweg = komk-vtweg
and mvgr5 = mvke-mvgr5.
endif.
ENDIF.
if sy-subrc eq 0.
wf_weight = komp-ntgew * zvtdds-kbetr2 / 100 .
wf_kwert1 = wf_weight * 10000 / komp-kursk .
endif.
* depb rate based on percentage in document curency
wf_kwert = komp-kzwi2 .
endif.
xkwert = wf_kwert * zvtdds-kbetr1 / 10000 .
if wf_kwert1 le xkwert and wf_kwert1 ne 0. " for maintaing value 0 for KBETR2 field
xkwert = wf_kwert1.
else.
xkwert = xkwert.
endif.
* xkwert = xkwert * zvtdds-kbetr1 / 10000 .
if xkwert lt 0 .
message w021(zfi) .
endif .
for -ve fob value message .
*} INSERT
ENDFORM.
r
12-03-2011 4:17 AM
hi ,
You should update XKWERT whichtakes final value .
regards
Deepak.
12-05-2011 8:16 AM
I Tried both, But still doesnt update the Value of KWERT and KBETR of Purchase Order.
01-28-2015 10:04 PM
Hi Elmer,
Now I modified the value changing XKWERT.
But it change multiply by 1000.
Do yo know why and how to change it?
Thanks.
04-10-2015 4:33 AM
I've had similar issues but I think I found out why this is happening. It has to do with the config settings (pricing or possible copy control) with the 'condition control' field. If it's set to E, F, or H, whatever you put into XKWERT or XKOMV-KWERT is overwritten by RETTKOMV in (LV61AA55). If it's NOT set to one of those 3 values, then the value you set to XKWERT within the routine is correctly put into XKOMV-KBETR after the routine is called (LV61AA43). So, talk to your SD configurator and find out if it needs to be those values... if not, then your routine will work.