Creating Quote Tables

Objectives

After completing this lesson, you will be able to:
  • Describe quote tables in SAP CPQ
  • Create quote table actions

Quote Tables

Quote tables allow you to display information on a quote tab in table format. The data, which displays in a quote table is usually copied from a custom table by a script. A script can load data into quote table and take action based on user selection.

Quote tables are used to display purely informative data, which is displayed on the generated quote document using dedicated tags. They can also be used to offer the user choices by selecting a checkbox in one of the row's cells.

A quote table can also be used to offer user choices among a list of items. For example, a quote table can be used to display purchase history, add cross-sell products to the quote or select among multiple shipping addresses. You may create any number of quote tables. The administrator selects SetupQuotesQuote Tables to define and edit quote tables.

Quote Table Actions

Define a quote table by selecting Setup > Quote > Quote Tables.

The Define Table tab allows you to specify the table's label, which tab it displays, and user visibility. It defines its rank, which is used if you have more than one quote table on that tab. It also specifies whether columns are searchable and if the table content can be uploaded from Excel.

Define Columns

The Define Columns tab allows the administrator to define columns for the quote table with the following:

  • A label which is displayed as the column header.
  • A column name which is used in scripts.
  • A column type, including number, decimal, string, date, money, Boolean, or attribute, validation rules, and permissions. The default permission is read-only. By modifying the permissions, you can make the column editable, or hidden.
Actions

A quote table may be manipulated by actions. The standard actions are add, delete, and copy row. Each of these actions is available if the active checkbox is selected and if permissions allow. Each can also be customized by specifying pre-actions or post-action scripts. A script may be defined to run each time a cell is changed.

In addition, entirely new custom table actions can be defined as scripts. These may be made active/inactive and restricted by permissions.

Let's add a quote table and define quote table actions in the next exercise!

Add a Quote Table and Defining Quote Table Actions

Business Scenario

Supertech wants to add a table on the quote listing available decals customers can use to decorate the computer hardware they’re purchasing. Information about these decals will be loaded from a custom table and will be used to modify the properties of a product our script will add to the cart.

Task Flow

In this exercise, you’ll learn how to create a quote table and define its columns and write custom actions as Python scripts.

Exercise options

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

To start the simulations, choose Start Exercise in the figures below.

Task 1: Create a Custom Table for the Available Decals

Steps

  1. Create a custom table for the available decals.

    Use the following data:

    ProductNamePartNumberDescriptionPriceCost
    Eiffel Tower decalADD1Decal of the Eiffel Tower1812
    Chrysler Building decalADD2Decal of the Chrysler Building1912
    Taj Mahal decalADD3Decal of the Taj Mahal2112
    Pyramids decalADD4Decal of the Great Pyramids1712
    Sydney Opera decalADD5Decal of the Sydney Opera House2012

    1. Use Excel to create a file called AdditionalProducts.xlsx containing the information from the table above.

    2. Navigate to SetupProduct CatalogCustom Tables.

    3. Choose Import New.

    4. For Table Name, enter: AdditionalProducts.

    5. Choose Choose File and select AdditionalProducts.xlsx.

    6. Choose Save.

Task 2: Create a Simple Product to Add a Decal to the Quote

Steps

  1. Add a new product.

    Use the following data:

    FieldValue
    NameAdditional Product
    Display TypeSimple Product
    Product TypeAccessories
    CategoryHardware > Computer Systems

    1. Navigate to SetupProduct CatalogProducts.

    2. Choose Add New Product.

    3. On the Definition tab, enter the information provided in the table above.

    4. Choose Save & Go Back.

Task 3: Create a Quote Table

Steps

  1. Create a quote table.

    Use the following data:

    FieldValue
    Table LabelAdditional Products
    Table NameAdditional_Products
    Quote Tab to show this table onQuotation
    Table Rank10

    1. Navigate to SetupProduct CatalogProducts.

    2. Choose Add New.

    3. On the Define Table tab, enter the information provided in the table above.

    4. Choose Add Permission.

    5. Check Select All Statuses.

    6. Choose Add.

    7. Choose Save.

Task 4: Define the Quote Table Columns

Steps

  1. Add a column.

    Use the following data:

    FieldValue
    Column LabelSelect Product
    Column NameSelect_Product
    Column TypeBoolean

    1. On the Define Columns tab of the Additional Products quote table, choose Add Column.

    2. Enter the information provided in the table above.

    3. Choose Set Permissions.

    4. Check Select All Permission Groups.

    5. Choose Save.

  2. Add the following columns.

    Use the following data:

    Column LabelColumn NameColumn TypePermissions
    NameNameStringread-only
    Part NumberPart_NumberStringread-only
    DescriptionDescriptionStringread-only
    PricePriceDecimalread-only
    CostCostDecimalread-only

    1. Repeat the steps described above to add the following columns (permissions default to read-only):

    2. Choose Save, when all columns are added.

Task 5: Create a Script to Load the Quote Table from the Custom Table

Steps

  1. Create a script to load the quote table from the custom table.

    Use the following data:

    FieldValue
    Action NameLoad quote table from custom table

    1. On the Actions tab of the Additional Products quote table, choose Add Custom Action.

    2. For Action Name, enter: Load quote table from custom table.

    3. Under Script, build a script to populate the quote table from the AdditionalProducts custom table.

      Code Snippet
      1234567891011
      customTable = SqlHelper.GetList("SELECT * from AdditionalProducts") quoteTable = context.Quote.QuoteTables['Additional_Products'] quoteTable.Rows.Clear() for customRow in customTable: newRow = quoteTable.AddNewRow() newRow['Name'] = customRow.ProductName newRow['Part_Number'] = customRow.PartNumber newRow['Description'] = customRow.Description newRow['Price'] = customRow.Price newRow['Cost'] = customRow.Cost
    4. Choose Save.

    5. On the row for this action, choose Permissions.

    6. Check Select All Permission Groups.

    7. Choose Save.

Task 6: Create the Add Product(s) Script

Steps

  1. Create the Add Product(s) script.

    1. On the Actions tab of the Additional Products quote table, choose Add Custom Action.

    2. For Action Name, enter: Add product(s).

    3. Under Script, build a script to populate the quote table from the AdditionalProducts custom table.

      Code Snippet
      123456789101112
      quoteTable = context.Quote.QuoteTables['Additional_Products'] for quoteRow in quoteTable.Rows: if quoteRow['Select_Product']: newItem= quoteRow['Part_Number'] addedItem = context.Quote.AddItem('Additional_Product_cpq',1) for item in context.Quote.GetAllItems(): if not item.PartNumber: item.PartNumber = str(quoteRow['Part_Number']) item.Description = str(quoteRow['Description']) item.ExtendedAmount = quoteRow['Price']
    4. Choose Save.

    5. On the row for this action, choose Permissions.

    6. Check Select All Permission Groups.

    7. Choose Save.

    8. Back on the Actions tab, choose Save.

Task 7: Deactivate Default Actions

Steps

  1. Deactivate default actions.

    1. Before you leave the Actions tab, unselect the Active checkbox for the following actions:

      • Add row
      • Delete row
      • Copy row

Task 8: Test the Quote Table

Steps

  1. Test the quote table.

    1. Exit Setup and create a new quote.

    2. Add one or more products to the quote.

    3. Choose Current Quote then choose View Quote.

    4. Delete all existing items added to quote.

    5. On the Quotation tab, under Custom Fields, choose the Load quote table from custom table button.

    6. Select one or more of the listed decals.

    7. Choose the Add product(s) button.

      The figure shows a screenshot, highlighting the Add produts tab.
    8. Verify that the selected products were added to the quote under Products.

      Note

      The decals will be listed as Additional Product under the Products section of the Quote.

Log in to track your progress & complete quizzes