Syntax documentation Constraints: Restrictions Locate the document in its SAP Library structure

In the RESTRICTIONS section of a constraint, you enter the consistency checks that the constraint is to make. The constraint returns an inconsistency if the restrictions section is not true.

Note

You cannot enter non-declarative expressions, such as NOT SPECIFIED (refer to Declarative Object Dependencies).

Example:

You can use a constraint to define that the print drive for a WIN95 printer must be selected if operating system WIN95 is selected for a PC:

OBJECTS:
(300) PC
where OS = OPERATING_SYSTEM,
(300) PRINTER
where PD = PRINT_DRIVE

RESTRICTIONS:
PD = ‘Drive_WIN95’ if S eq ‘WIN95’

You can also enter more than one restriction. You enter a comma to separate the different restrictions. There is an AND relationship between the restrictions. OR relationships are not supported.

Example:

RESTRICTIONS:
PD = ‘Drive_WIN95’ if OS eq ‘WIN95’,
PD = ‘Drive_OS/2’ if OS eq ‘OS/2’,
PD = ‘Drive_NT’ if OS eq ‘NT’.

False

You can also use the statement FALSE as a restriction. This means that situations described in the condition section are inconsistent. If these situations occur, an inconsistency message is returned.

Example:

OBJECTS:
PC IS_A (300) PC

CONDITION:
PC.CPU = ‘486’ and PC.EXTRAS = ‘CO_processor’.

RESTRICTIONS:
FALSE.

This constraint returns an inconsistency as soon as the value ‘486’ is assigned to the CPU and the value ‘CO_processor’ is assigned to EXTRAS.

Table Calls

In the RESTRICTIONS section of a constraint, you can also call tables that you defined previously. This makes a constraint a powerful tool, since you can replace a large number of preconditions by using a table call in a constraint.

You can use tables in constraints to ensure the consistency of assigned values or to infer values. For restrictable characteristics, you can also use a table to dynamically restrict the allowed values of the characteristic. For example, you can use a table call to define the combinations of values for the casing and hard disk of a PC. If you refer to a table in a constraint, only the combinations of values defined in the table are valid.

Settings Values in the Restrictions Section

In some cases, values can be inferred from your entries in the restrictions section without having to use the INFERENCES section. This is the case for equations where the left-hand side contains exactly one variable for a characteristic. The characteristic cannot be restrictable.

Example

Voltage = Resistance * Current

CPU = ‘486’

In the first example, the voltage of a circuit is inferred automatically from the equation without having to enter anything under INFERENCES. In the second example, the value ‘486’ is set automatically for the CPU in the configuration.

 

Leaving content frame