‎2011 Jan 27 6:39 PM
Hi, I have a Requirement
implemented in the Pricing Procedures.
This Requirement determines whether the condition is valid or not.
The problem is: when i make the sales order the condition is working properly but then modify something in the sales order, the condition is not updated.
For example:
When creating the sales order triggers a condition through the Requirement, then change the amount of a position of sales order and according to the ABAP CODE inactivate this condition but that should not happen.
This position works if we enter the sales order and then to the Conditions tab and then click the button "Update" option "G - Copy pricing elements and redetermination taxes Unchanged"
I attached the ABAP Code:
IF komk-trtyp <> 'A' AND komk-vbtyp CA 'KH' AND
incl_konditionen = 'Y'.
SELECT SINGLE netwr knumv
FROM vbrk
INTO (lv_netwr, lv_knumv)
WHERE vbeln = komp-vgbel.
IF sy-subrc EQ 0.
SELECT SINGLE kposn
FROM konv
INTO lv_kposn
WHERE knumv EQ lv_knumv AND
kposn EQ komp-vgpos AND
kschl EQ 'J1A2' AND
kwert GT 0.
IF sy-subrc EQ 0.
lv_campo = '(SAPMV45A)TKOMP[]'.
ASSIGN (lv_campo) TO <fs_tkomp>.
IF <fs_tkomp> IS ASSIGNED.
REFRESH lt_tkomp.
lt_tkomp[] = <fs_tkomp>.
CLEAR lv_netwr_aux.
LOOP AT lt_tkomp INTO ls_tkomp.
lv_netwr_aux = lv_netwr_aux + ls_tkomp-NETWR.
ENDLOOP.
IF lv_netwr <> lv_netwr_aux.
lv_subrc = 4.
ELSE.
lv_subrc = 0.
ENDIF.
ELSE.
lv_subrc = 4.
ENDIF.
ELSE.
lv_subrc = 4.
ENDIF.
ENDIF.
ENDIF.
Thanks!
‎2011 Jan 27 6:47 PM
What are you modifying in the sales order? If you need to reprice based on the modifcation, then use the USEREXIT_NEW_PRICING_VBAP (or VBKD0 in MV45AFZB to trigger repricing type 'G'. Use code tags next time...
‎2011 Jan 27 6:51 PM
I just want to activate or deactivate a condition of Pricing Procedures depending, for example if I change the Quantity in the position of sales order.
‎2011 Jan 27 7:02 PM
Well, if you change the quantity, the item will automatically reprice fully and your requirement should hit and function accordingly. If you change some other value that doesn't automatically trigger repricing or not at the level you want, you can re-trigger it with the user exit I mentioned. For the quantity change, debug your requirement to find out why it doesn't work.
‎2011 Jan 27 7:11 PM
there any way to make the condition is active or not from Requirement in the Pricing Procedures Implemented using SY-SUBRC 0 or 4?
‎2011 Jan 27 7:55 PM
You don't 'de-activate' conditions with a requirement and repricing, you stop them from proposing (SY_SUBRC = 4) or allow them to propose (SY-SUBRC = 0).
‎2011 Jan 27 8:05 PM
solve it by creating a "Condition Calculation alternative formula for type" and cleaning:
xkomv-kbetr and xkwert
and then we put the value "C"into xkomv-ksteu
Thanks and Regards.