Syntax documentation Constraints: Referring to Objects Locate the document in its SAP Library structure

You must declare all objects that are relevant to a constraint in the OBJECTS: section of the constraint.

Caution

All of the characteristics in the OBJECTS section of the constraint must be used in the other sections of the constraint (RESTRICTIONS and CONDITION). If you declare a characteristic that is not used in the constraint, the constraint is not processed.

Class and Class Type

The usual way to identify an object in a constraint is by entering the class and class type. If you want to use a constraint to refer to a PC classified in class PC of class type 300, you enter the PC as follows:

(300) PC

Object Key

If you want to refer to a specific material, you enter the identification for the object type, the class type, and the object key.

· MATERIAL in this example is the object identification for materials. You define the object identification for referring to objects in dependencies in Customizing for Classification, by choosing Maintain object types.

· The object key for materials is the material number. The object key is also defined in Customizing for Classification. In the step Maintain object keys, you define which fields are used to refer to an object. You also enter the identification that is used to refer to the fields. The material number is referred to by formal parameter NR. An object key can consist of several partial keys, as is the case for documents:

(Document)(017)(TYPE = ‘DRW’, VERSION = ‘00’, PART = ‘000’, NR = ‘D4545’)

· For the class type, enter the class type in which the object is classified. If the object is not classified, do not enter a class type. However, you must enter empty parentheses as a place holder.

(Material)()(NR = ‘MAT_A’)

Declaring Several Objects

If you want to refer to other objects in your constraint, you must declare these objects in the constraint, too. You use a comma to separate the individual objects.

OBJECTS:

PC IS_A (300) PC,

PT IS_A (001) PRINTER,

EX IS_A (001) EXTRAS

In this constraint, the objects referred to are PC, Printer, and Extras. The objects are referred to by their class and class type.

Defining Variables

PC IS_A (300) PC

O IS_OBJECT (Material)(001)(NR=‘M4711’)

?PC IS_A (300) PC

Example

Usually, it is hard to use a constraint to calculate the total weight of a component by calculating the sum of the weights of its individual parts, because all the relevant objects must be entered in the constraint. If one of the objects is not selected in the configuration process, the constraint cannot be used because one of the input parameters is missing. This means that you can only define a constraint for this task if all the objects concerned must always be selected.

Referring to Characteristics

Characteristics are always referred to in the context of the object to which they belong. Characteristics are identified by their language-independent name. If no variables are defined for objects in the OBJECTS section of the constraint, you must enter a complete expression consisting of class and class type before the characteristic:

(300)PC.HARD_DISK = ‘1275’

This shows that the characteristic belongs to an object in class PC of class type 300.

If you have defined a variable for an object, you see the variable instead of the object:

PC.HARD_DISK = ‘1275’

Note

Characteristic values are only case sensitive if the characteristic format defines them as such.

Defining Variables

In the OBJECTS section, you can also define variables for characteristics. These variables are connected to the object to which they belong using the keyword WHERE.

PC IS_A (300) PC
WHERE HD = HARD_DISK

This shows that the characteristic belongs to class PC, so the characteristic is referred to afterwards with just the variable HD:

HD = ‘1275’

You can also define variables for several characteristics. Use a semicolon to separate the characteristics from each other:

PC IS_A (300) PC
WHERE HD = HARD_DISK;C = CASING;CPU = CPU

Multiple-Value Characteristics

If you want your constraint to refer to several values of a multiple-value characteristic, you must define several variables:

OBJECTS:
(300) PC
Where Var1 = Color_multi; Var2 = Color_multi

CONDITION:
Var1 = ‘red’ and Var2 = ‘yellow’

RESTRICTIONS:
false

This constraint refers to 2 values of multiple-value characteristic COLOR_MULTI. This is why it is necessary to declare two variables, one for each value.

If values 'red' and 'yellow' are set for characteristic COLOR_MULTI, the constraint triggers an inconsistency message.

 

Leaving content frame