Code Builder

Tags and Expressions are a powerful part of CPQ. To help reduce errors and simplify the process, the Code Builder is available to create expressions. To access the Code Builder, click the Check, Assist, or button next to the field where the expression will go. This button is available any time an expression can be used. Clicking a Code Builder button will bring up the code builder window. Code Builder changes according to the settings the expression is being created for. For example, if an expression is being added for a Rule (see the chapter on Rules) or Trigger (see the chapter on Triggers), then an additional Triggers/Rules box will be displayed with the Code Builder. In addition, if you are building an expression that is related to a quote, such as quote visibility rules, then the window will look like the figure on the left. The basic principles for using the Code Builder are the same despite what setting the expression is being created for.

Quote related Code Builder

Product Rule Action Code Builder

The Code Builder window is divided into two sections. The main box at the bottom is where the expression is formed. Expressions can be typed in manually if necessary and in certain instances, phrases can be entered into the box to be displayed to the user. The Check Syntax button checks the expression to ensure that the Tags have been joined correctly and that all punctuation is correct. Any errors will be displayed at the bottom of the window. It is a good idea to check an expression before inserting it to ensure it functions correctly and that it does not produce an error for the user. When finished, the Update button inserts the created expression into the field.
The top section of the Code Builder windows contains boxes to build the expression. In most cases, to build an expression, select the attribute, value, sequence, etc that an action will be performed on then select the action. The top section is also categorized. To the right, you have operators, and to the left you have context sensitive options divided into 3 tabs (“Variables” , “Actions / Conditions” (context depending) , “Sequences”). Note that you sometimes may see “Actions” and sometimes “Conditions” as second tab, depending on context. Sometimes both are unavailable. When Syntax checker opens, it will activate the tab that contains the most appropriate options for the given context.

An Insert Operator box is available in every Code Builder window to create conditional statements and Boolean logic. Click the Operator in the box and then click Insert to insert the Operator into the expression. In most cases the Operator is added in its full syntax, with all parenthesis, and user only needs to fill in the parameters. The figure below shows an example of an expression using an Operator. This example states that the Hard Dive Attribute Value HD200 AND the Memory Attribute Value 2GB need to be selected in order for this expression to be true.

Code Builder Example

To create an expression in the code builder, select an action/condition/variable, then (if needed) select attribute(s). Attribute Value(s) can also be selected for the expression if necessary. Click the Insert button to add the new Tag to the expression. Sequences can also be used in expressions by selecting the sequence from the Select a Sequence Operator box then selecting the sequence for it.(see the chapter on Sequences). Click the Insert button to add the new Tag to the expression.
The Attributes displayed in the box will only be those selected for that product or category, depending on what you are creating the expression for. This is the case for every Code Builder window. If a certain object or attribute is not available, make sure it is checked, selected, or even created for the settings the expression is being created for. This should also be considered when selecting Attribute Values.
The actions, Macros in this case, will also be different for each Code Builder window. For information on what an action does, check Appendix A for a list and description of all Tags. There is also information there on the proper way to join Tags and create expressions. While the Code Builder aids in the process of creating expressions, Tags need to be joined and built correctly in order for the expression to function accurately.
Please note that some variables that are available are quite complicated to be built by Syntax checker itself. Such is the case with <* CTX(…) *> and <* TABLE(…) *> objects. When you need to insert these, once you select them from the list, a new button will be shown, that will invoke new popup window where you can build your complex tag. Example of this is shown on figure below:

Code Builder allows you to invoke Table Tag Builder

Once you have finished building your complex tag, you can insert it into syntax builder window and continue building the rest of your formula. For more information on complex tags and their builders, please refer to Table Tag Builder and CTX Syntax Builder.
Each Code Builder also has a Visualize button that can ease formula creation.

Since CPQ formulas essentially are expressions and not the algorithm (the program) a tree control can be used to display them. Tag names are colored blue and operators are colored green.
Tags are displayed as nodes that may have child nodes if tag has arguments. If another tag is in the argument of a tag, same definition is recurrently applied.
<*AUX(price, Price, Part_Number,<*ValueCode(Cell Kits)*>)*> codebuilderb7.jpg As exception, tags that take comma/colon and comma/colon/bar arguments are shown differently.
<*ANYSEL(Bulkhead Connector:IE6MTImp,Housing Material:Delrin)*> codebuilderb8.jpg <*DissallowAllValuesExcept(Cover Accessories: 3 Pos and light | 3 pos and pb)*> codebuilderb9.jpg Operators are shown as a node with parameters as child nodes.
[OR](a,b,c) codebuilderb10.jpg Special operator IF is shown as a main node with tree child nodes representing condition, true and false branches.
[IF](some condition){do if true}{do if false}[ENDIF]
codebuilderb11.jpg Some real, complex formula may look like this
[IF]([OR]([EQ](<*VALUECODE(Product Code Identifier)*>,A0200B),[EQ](<*VALUECODE(Product Code Identifier)*>,A0200B),[EQ](<*VALUECODE(Product Code Identifier)*>,A0200B))){0}{<*AUX(Prices, ListPrice, ProductPartCode, CON-H0004-1)*>}[ENDIF]

You are here: SAP CPQ Online HelpAdmin Page HelpAdministrationCode Builder