This wiki explains how to perform validations on pricing condition types using java routines with a simple example.
Created on: 09/08/2010
Arun Kumar is a senior CRM developer working with Accenture.
Table of Contents
There are scenarios where certain validations need to carried out when pricing is triggered. For example, when a reprice/complete re-price is triggered or when adding a manual condition type. In CRM since pricing is executed by the Sales Pricing Engine, the presentation layer is mostly used to implement any such validations. However, this doesn't prevent pricing from being executed in case of any failed validations. So the better approach for condition type validation is to use requirement routines thus preventing access to the condition.
This wiki explains how to perform condition validations in IPC using a requirement routine with a simple example.
The scenario is to restrict user from adding more than one manual entry for the same condition type. If user adds an existing condition type more than once, an error message should be displayed and the condition exclusion indicator must be set.
Create a manual condition type and add it to a pricing procedure.
Create a requirement routine
Requirement userexits are used during condition finding on pricing procedure step/counter level and on condition access step level.Assign a formula number for the userexit ZYIDP_CHECK and assign attribute PRC_INDICATOR from the item communication structure
Assign the requirement routine 601 to condition type YIDP in the pricing procedure.
Create an userexit using any Java IDE, the userexits class must be inherited from RequirementAdapter. Use library com.sap.spe.base.util.event.WarningStatusEvent to throw warning messages when validation fails.
Overwrite the method checkRequirement. If this method returns false, the current access in not made.
Read the pricing indicator attribute passed to the userexit
Get item pricing condition types into an array and clear the status message initially.
In the pricing conditions check the number of occurrences of condition type YIDP. If YIDP is added more than once then set the warning message and return the check result, 'false' to avoid the access.
OSS Note 809820 Note containing IPC document and the prepared eclipse project.
Condition type validations using IPC routines