You can create custom functions in Java and use them in product modeling.
To be able to use a Java function in product modeling, under Functions
, create a function with the same name as the Java function and then define which characteristics you will use as parameters in that function.
You can assign functions to classes and products as dependency type Function Formula
.
In the product model, choose Functions
and then choose New
.
Enter a function name and a description.
In section Function Parameters
, choose New
and open the input help for Characteristic
. A dialog box appears in which you can select the characteristics of the product model that you want to use in the function.
Set the Key
indicator for one or more characteristics.
Note
The meaning of this key is described in section "Assigning Functions as a Dependency Type to a Class or Product".
At this point, the status of the function is In Preparation
.To be able to assign the function to a class or product, set the status to Released
.
When you have edited a function and released it, in section Dependencies
, create a Function Formula
for a class or product and select a function.
Note
Only functions with status Released
appear in the selection list.
In the Mapping
section, you see the characteristics that you selected before, if you created them for the selected class or product.
For characteristics that you did not indicate as key characteristics, you can select from the following actions:
No Value
The system uses this option as the default. If you select No Value
, the function has no effect on this characteristic in the configuration.
Set Value
If you select Set Value
, the formula determines a value during the configuration. You cannot change this value.
For characteristics that you have defined as key characteristics, the system automatically selects the Read Value
action, which cannot be changed. The effect on configuration is that this value must be chosen by the user and cannot be determined by the function.
Also refer to SAP Note 870201: Implementing variant functions in Java
.