Creating Quote Templates Tags

Objectives

After completing this lesson, you will be able to:
  • Explain the purpose of template tags
  • Describe template tags and how quote data is entered on a document
  • Describe commonly used document generation tags
  • Add new documents and images to an existing document template

Purpose of Template Tags

For data to be displayed in generated documents, dedicated tags must be entered in the template. Each tag can retrieve specific quote details, configuration, customer, or user-related information that is meant to be displayed in the output document. The list of tags and a detailed explanation with examples can be found in the Document Generation Tags section. Alternatively, you can use the standard CTX tags instead of quote template tags to retrieve data.

You can include any information in the quote template. Most common is to include the customer information, such as Bill To, Ship To, or End User fields. In addition, the template will include the items from the cart. This, along with any other information, can be included through the use of SAP CPQ quote template tags.

Quote Template Tags are used to transfer information from SAP CPQ into the Word document. This is done by adding these tags to the document using normal text. For example, you could include the following in a Word document: "Total price of the quote is: «Q_QUOTE(TOTAL)»". This tag is used as a quote template tag which retrieves the total price of the cart when the quotation is generated.

Expressions are entered into a Word document in the areas or order they are displayed. Virtually every piece of information existing in CPQ can be inserted in a Word quote document. Each tag has prefix character(s) that represent how the tag is used. The Q tags represent information that is pulled from the quote.

The second type of tags are C tags or Cart item tags. These can only be used within a C2 repeatable quote tag.

Finally ST tags are special tags that may fall outside the cart or quote tags. Q and ST tags are used anywhere in the document without being restricted to the C2 repeatable quote tags.

Template Tags and Entering Data

Quote Tags

Quote tags (or Q tags) are used to retrieve general quote information, including currency, user and owner data, and more.

A Q tag can be added anywhere in the document template. Examples of Q tags may include the following General Q tags:

  • <<Q_Quote(Comment)>>,<<Q_QUOTE(VALID_UNTIL)>>
  • Quote User Tags: <<Q_User(Name)>>, <<Q_User(City)>>
  • Company Tags: <<Q_COMP(NAME)>>, <<Q_COMP(ADDRESS1)>>
  • Quote Owner Tags: <<Q_OWNER(USERNAME)>>, <<Q_OWNER(EMAIL)>>
  • Other tags: <<Q_FILE()>>, <<Q_TAG(<*CTX(Quote.Total.Amount.Display)*>)>>

Note

Every tag that inserts files supports the formats docx, and pdf, and images bmp, emf, gif, ico, jpg, jpeg, pcx, png, tif, tiff, and wmf.

The SAP CPQ Help Portal link:

lists all supported Q tags

Commonly Used Document Generation Tags

C2 tags will iteratively display products and line items in the cart following these rules:

  • The tag outputs its MAIN and LI tags once for every product in the cart.
  • The MAIN section displays the product.
  • The LI section displays line items under that product.
  • C Tags are used in these sections to show product/item attributes.

C2 tags can be added only to main and line items. C2 loop inside a C2 loop cannot be added, while a condition inside a C2 loop is supported. Adding too many C2 tags (500 tags and more) can negatively affect the performance of the document generation process.

Use C2 loop tags in the following example:

<<C2>> <<HEADER>> Display Header (usually a table header) <<HEADER_END>> <<MAIN>> Display Product Data (usually in table row) <<C_STOP>> <<MAIN_END>> <<LI>> Display Line Item Data (usually in table row) <<C_STOP>> <<LI_END>> <<FOOTER>> Display footer (normally totals) <<FOOTER_END>><<C_END>>

Opening and closing tags, such as <<LI>> and <<LI_END>>, must each be displayed in a separate row.

A C2 tag can optionally have four sections (header, main items, line items, and footer) and each of them is described in more details below.

Header:

A header is displayed only once at the beginning of a C2 tag. You can add only Q tags inside the header because other tags aren't parsed. If there's a table in your template, the table header should be displayed

Note

If you have a table that displays on more than one page, check the Repeat as header row at the top of each page in Word to display the header on each page.
Main Items

The main tag retrieves all main items in a quote. There should be one set of MAIN tags for each main item. For the system to properly process the items, you need to add the <<C_STOP>> tag before the closing main tag. If there is a parent/child item structure, the system treats child items as main items. If tabular representation is needed, you should add table rows that contain item data.

Line Items

The line item tag retrieves line items in a quote. There should be one set of LINE ITEM tags for each line item. For the system to properly process the items, you need to add the <<C_STOP>> tag before the closing line item tag. If you need to represent line items in a table, add table rows within the line item tags.

Footer

A footer is displayed only once at the end of a C2 tag. Only add Q tags inside the footer because other tags are not parsed. If the template includes a table, the table footer should be displayed in the footer tags.

Note

There has to be at least one blank space (or a new line) after the <<C_END>> tag for the system to process properly.

The following are typical Cart Item Tags:

Cart Item Tags

TagDescription
<<C_TAG(...)>>Basic C tag. Place a modeling tag (CTX, table, etc.) between the parentheses
<<C_VALUE(RolledUpCartItem)>>Rolled up quote item IDs. For example 3, 3.1, 3.2
<<C_PIMAGE>>Product image
<<C_PATTR(...)>

Evaluates a product-level tag; used only for attributes added as line items.

For example, <*Value(AttributeName)*>

<<C_EMPTY>>Displays an empty space

C tags retrieve data for each item in a quote. The system processes C tags only if they are within C2 tags. In most situations, use a C_TAG to access quote item properties, for example:

<<C_TAG(<*CTX(Quote.CurrentItem.LineItemProperty)*>)>>

To display a quote item's ordinal number, where child items 3.1 and 3.2 appear as 4 and 5, enter the following:

<<C_TAG(<*CTX(Quote.CurrentItem.Rank)*>)>>

Consult the SAP CPQ Help Portal for a complete list of C2 Tags at

Sometimes information from a container will need to be displayed directly onto the quote document. Place the CONTAINER tag inside a C2 tag.

Inside CONTAINER sections, use CONTAINER_TAG with a CTX tag to retrieve data (for example, <<CONTAINER_TAG(<*CTX(Container(Project Tasks).Row(2).Column(Total).GetFormatted))*>)>> returns the value of the Total column for the second row in the container, keeping the original format).

Use the following container tags:

<<C2>> <<MAIN>> <<CONTAINER(PropContainer)>> <<CONTAINER_HEADER>> <<CONTAINER_HEADER_END>> <<CONTAINER_ITEM>> TAG: <<CONTAINER_TAG(<*CTX(Container(PropContainer).Row(3).Column(tag).GetFormatted))*>)>> <<CONTAINER_ITEM_END>> <<CONTAINER_FOOTER>> <<CONTAINER_FOOTER_END>> <<CONTAINER_END> <<MAIN_END>><<C_END>>

The content of quote tables can also be included in the quote document.

You can use the QUOTE_TABLE tag inside the header or footer of a document generation processing template.

To retrieve the content, use the following tags:

  • <<QUOTE_TABLE(TableNameHere)>>
  • <<QUOTE_TABLE_HEADER>> (Enter column definitions or what you want to display on header for the table).
  • <<QUOTE_TABLE_HEADER_END>>
  • <<QUOTE_TABLE_ROW>>
  • <<QUOTE_TABLE_COLUMN(NameOfColumnHere)>>
  • <<QUOTE_TABLE_COLUMN(AnotherColumnHere)>>
  • <<QUOTE_TABLE_ROW_END>>
  • <<QUOTE_TABLE_FOOTER>> (Enter column totals or what you want to display on footer for the table).
  • <<QUOTE_TABLE_FOOTER_END>>
  • <<QUOTE_TABLE_END>>

You may want to display information from a custom table in the quote document.

Use the following CUSTOM_TABLE tag to do this:

<<C2>> <<MAIN>> <<CUSTOM_TABLE(digital_devices)>> <<CUSTOM_TABLE_HEADER>> <<CUSTOM_TABLE_HEADER_END>> <<CUSTOM_TABLE_ROW>> P/N: <<CUSTOM_TABLE_COLUMN(Part_Number)>>

Name: <<CUSTOM_TABLE_COLUMN(Component_Name)>> <<CUSTOM_TABLE_ROW_END>> <<CUSTOM_TABLE_END>> <<MAIN_END>><<C_END>>

SAP CPQ allows you to create Microsoft Excel format quote documents. Use Excel to create the template with tags similar to Word templates. However, document generation tags in Excel use a different syntax than Word. Instead of closing tags, such as C_STOP and MAIN_END, the opening tag specifies:

An opening tag specifies:

  • How many of the following rows it is referencing.
  • How many columns it encompasses.

One example is the C2 Loop in Word we reviewed earlier.

In this example, the C2 tag spans rows 1 through 7. The tag is concerned with the 7 rows. The HEADER tag is concerned with one row. MAIN and LI are also concerned with one row. The tags encompass 4 columns. Remember that the document generation tags will not appear in the generated quote.

Some Excel tags are different than their Word equivalents. For example, the 4 spreadsheet rows used to display the 6-column custom table My_Custom_Table are preceded by: <<QUOTE_CUSTOM_TABLE(4x6|My_Custom_Table)>>

Do not confuse this tag with the tag used to display an equivalent quote table: <<QUOTE_TABLE(4x6|My_Quote_Table)>>.

Standalone Condition Tags

Standalone conditions can be used anywhere in the template. They do not depend on other tags, and are characterized by the following rules:

  • They are the last tags to be evaluated.
  • Using too many will degrade performance.
  • Use = for equality and ! for inequality.
  • Multiple conditions are separated by | and always use OR logic.

For example: Show some content only if the product type of the current item is Service:

[CONDITION,<<C_TAG([NEQ](<*CTX( Quote.CurrentItem.ProductTypeName )*>,Service))>>]static text / tables / document generation tags[CONDITION_END]

Note

[CONDITION,…] tags don't support table tags (<*Table(SQL query)*>). Also, [CONDITION,…] tags must not be nested.

Tag Conditions

Tag conditions control how individual tags are displayed. Tag conditions are characterized by the following rules:

  • Works in both Word and Excel templates.
  • Multiple tags are separated with ( | ).

Format: <<TAG,testvalue=condition>> if tag value equals test value, perform condition.

General tag conditions:

  • D Delete a line.
  • d delete the value the tag returns.
  • P inserts a page break after value.
  • p inserts a page break before value.
  • U converts the value to uppercase.

Tag conditions inside Word tables:

  • DC delete contents of the cell.
  • DR deletes contents of entire row.
  • DCOL deletes contents of entire column.
  • DELETE_TABLE deletes entire table.

Contrived example: <<Q_BILLTO(COMPANY)=sap,U|=D|p>>

  • If billing company is sap, convert to SAP.
  • Otherwise, if no company value, delete the whole line.
  • Otherwise, precede company value with a page break.

When the company field is not set, then ,=DELETE_TABLE matches an empty field (nothing between the comma and the equal sign) and the action is to delete the entire table.

Involved Parties Tags

INVOLVED_PARTIES tags retrieve details of business partners and partner functions. The following represents the structure of the INVOLVED_PARTIES tags:

<<INVOLVED_PARTIES(ALL or partner function key of a specific partner function)>>

<<INVOLVED_PARTIES_HEADER>>

<<INVOLVED_PARTIES_HEADER_END>>

<<INVOLVED_PARTIES_LOOP>>

<<C_TAG(<*CTX( Quote.InvolvedParties.CurrentInvolvedParty.PartnerFunctionName)*>)>>

<<C_TAG(<*CTX( Quote.InvolvedParties.CurrentInvolvedParty.PartnerFunctionKey)*>)>>

<<INVOLVED_PARTIES_LOOP_END>>

<<INVOLVED_PARTIES_FOOTER>>

<<INVOLVED_PARTIES_FOOTER_END>>

<<INVOLVED_PARTIES_END>>

The INVOLVED_PARTIES_LOOP should contain the CTX tags inside the C_TAG.

The following SAP CPQ Help Portal link contains the supported Involved Parties CTX tags.

Inserting Additional Content via Manage Content Documents

Additional documents or images can be embedded in the generated document. Additional content must first be uploaded in the Manage Content Documents section in Setup Quotes.

The additional content is included in the generated document only if the following tags are in the template:

Additional content must first be uploaded in the Manage Content Documents section in Setup Quotes.

Embed managed content documents into the generated document using the following tags:

<<INCLUDE_DOCUMENTS>>

<<INCLUDE_DOCUMENTS_END>>

The tags must be used in separate lines. Files are included in the same order in which they're displayed to the user. If the checkbox "Don't include the same file more than once" is selected on the user side, SAP CPQ will not include duplicate files. Otherwise, duplicate files are included if found.

Attach documents in the quote's Documents tab.

Let's display the VAT in a word document template in the next exercise!

Display the VAT in a Microsoft Word Document Template

Business Scenario

Supertech wants the quote sent to customers to display the amount of Value Added Tax charged on each product in the quote.

Task Flow

In this exercise, you’ll learn how to display a quote item custom field on a quote document, using a Microsoft Word template.

Exercise options

To carry out this exercise, you can choose the following option: Platform Simulation: Watch the step-by-step instructions within the simulation.

To start the simulation, choose Start Exercise in the figure below.

Log in to track your progress & complete quizzes