# SAP Object Dependency Syntax Template for Variant Configuration

> Source: https://netray.co/tools/sap-object-dependency-syntax-template
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Generate starter syntax for the four classic SAP dependency types from your own characteristic names and values.

## Category

sap

## Erp

SAP S/4HANA

## Audience

- SAP VC consultant
- SAP developer
- Product engineer

## Tool

**Kind:** template

**Output:** code

**Language:** text

**Fields:**

#### Driving characteristic

**Key:** char_a

**Type:** text

**Default:** ZPUMP_MOTOR_KW

#### Value of driving characteristic

**Key:** val_a

**Type:** text

**Default:** 55

#### Restricted characteristic

**Key:** char_b

**Type:** text

**Default:** ZPUMP_VOLTAGE

#### Value that must be hidden or required

**Key:** val_b

**Type:** text

**Default:** 230V

#### Characteristic to set by procedure

**Key:** char_c

**Type:** text

**Default:** ZPUMP_SEAL

#### Value to set

**Key:** val_c

**Type:** text

**Default:** MECH

#### Dependency name prefix

**Key:** dep_name

**Type:** text

**Default:** ZPUMP

**Blocks:**

#### Precondition (value of {{char_b}})

**Body:** * Dependency {{dep_name}}_PRE_01, created in CU01 as a precondition
* Attach to the value {{val_b}} of {{char_b}} so it is only offered when the rule is true
not ( {{char_a}} = '{{val_a}}' )

#### Selection condition (for a BOM item or characteristic)

**Body:** * Dependency {{dep_name}}_SEL_01, created in CU01 as a selection condition
* Forces an answer: the object is only valid when the characteristic has a value
{{char_a}} specified

#### Procedure (set a default or value)

**Body:** * Dependency {{dep_name}}_PRC_01, created in CU01 as a procedure
* Sets {{char_c}} to {{val_c}} when {{char_a}} is {{val_a}}
$self.{{char_c}} = '{{val_c}}' if {{char_a}} = '{{val_a}}'.

* Optional default form, which the user may overwrite
$set_default $self,{{char_c}},'{{val_c}}'

#### Constraint skeleton

**Body:** * Dependency {{dep_name}}_CON_01, created in CU01 as a constraint
* Constraints belong to a dependency net (CU21) and reference class-based objects
OBJECTS: PUMP IS_A (300) {{dep_name}}_VC
CONDITION: PUMP.{{char_a}} = '{{val_a}}'
INFERENCES: PUMP.{{char_c}} = '{{val_c}}'

**Notes:** These are starting skeletons for the classic SAP VC dependency editor. Syntax details, such as the period that ends a procedure statement and the exact constraint keywords, must be verified in your release using the dependency editor syntax check in CU01. Test every rule in configuration simulation (CU50) before releasing it.

## Content

**Intro:** Most variant configuration rules follow a few patterns, and people search for syntax examples every time they build a new one. This template produces starter code for a precondition, a selection condition, a procedure and a constraint skeleton from your own characteristic and value names. Copy the output into the dependency editor and adjust it.

**Sections:**

#### How to use the template

**Body:** Enter the driving characteristic and value, the characteristic you want to restrict, and the characteristic a procedure should set. The page substitutes your names into four standard patterns. Copy a block into the dependency editor in CU01, save, and run the syntax check. Then assign the dependency to a value, a characteristic, a BOM item or a configuration profile depending on its type. Always test the result in configuration simulation before it reaches a sales order.

**Bullets:**

- Change names and values only, keep the structure
- Run the syntax check in the editor every time
- Use a prefix so dependencies are easy to find in CU02

#### The four dependency types

**Body:** A precondition controls whether a value or characteristic can be offered at all. A selection condition decides whether a BOM item, operation or characteristic is relevant for a specific configuration. A procedure derives values, for example setting a default or computing a quantity. A constraint is evaluated continuously within a dependency net and can infer values both ways, which makes it powerful but harder to debug. Choose the simplest type that solves the problem; most models should rely mainly on preconditions, selection conditions and procedures.

**Bullets:**

- Precondition: hide or allow a value
- Selection condition: include or exclude a BOM item
- Procedure: set or derive a value
- Constraint: model relationships inside a network

#### Reading and testing the result

**Body:** A precondition like the one generated reads as a prohibition: the value is not offered when the driving characteristic has the stated value. A selection condition using specified becomes true once the user has answered the characteristic. A procedure runs when the model is evaluated, so a default set by $set_default can be overridden, while a direct assignment is stricter. Test each pattern with a value that should pass and a value that should fail, and record both in your test matrix so the behaviour is checked after every upgrade.

#### Common mistakes

**Body:** The usual errors are logic that works for one value but not for another, missing parentheses around negated conditions, and procedures that overwrite what a user has already chosen. Dependencies are also left unassigned, so they exist but never fire. Large models accumulate overlapping rules that contradict each other. Keep dependencies small, one purpose each, and document the reason in the long text. Remove obsolete dependencies using change numbers so history stays clean.

**Cta:** If you are moving a large dependency base to Advanced Variant Configuration, we can help review the rules and plan how to translate them. The template above stands on its own.

**Faq:**

#### What is the difference between a precondition and a selection condition?

**Answer:** A precondition decides whether a characteristic or value can be offered. A selection condition decides whether an object such as a BOM item, operation or characteristic is relevant for the configuration. Preconditions affect what users can choose, selection conditions affect what is built.

#### Where do I create dependencies in SAP?

**Answer:** Dependencies are created and edited in the dependency editor, started from transaction CU01 to create, CU02 to change and CU03 to display. You can also reach the editor from the object, for example from a BOM item or a characteristic value.

#### Can I use constraints for everything?

**Answer:** You can, but you probably should not. Constraints are evaluated in a dependency net and can be hard to trace when they fail. Use preconditions, selection conditions and procedures for most logic, and keep constraints for relationships that genuinely need two-way inference.

#### Will this syntax work in Advanced Variant Configuration?

**Answer:** Not unchanged. Advanced Variant Configuration uses its own model and rule definitions, and classic dependencies are migrated or rewritten for it. Treat these examples as classic VC syntax and check current SAP documentation for the target release.

## Search terms

sap object dependency syntax, sap vc precondition example, sap selection condition syntax, sap procedure dependency example, sap constraint syntax, cu01 dependency editor, sap variant configuration rules examples, sap set_default procedure

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
