Upsert API Method for pricebook

Please note that this is different web method - not the standard Pricing API method.

Following logic is implemented:


  • When going through rows in XML, API method will look for part number and price code provided in row. If there is no price code, only part number will be used. If part number is empty, error “Part Number Column empty” will be sent as error for this row.
  • If part number and price code are provided, API method will look for pricebook entries by part number and price code. If price code is not provided, API method will look for pricebook entries with same part number and empty price code.
  • If API method finds pricebook entry(s) by part number (and possibly price code), all rows that match this condition will be updated with provided data in same row. Row will be updated with only provided columns. Columns that are not provided will not be updated.
  • If API method doesn’t find pricebook entry by part number (and possibly price code), new entry will be added to the pricebook. When adding new entry to the pricebook, entered data will be same as if entry was added manually (with zeros set for empty prices and decimal places added at the end of the number). If price code or Price Description are empty, they will be left empty in new pricebook entry.
  • If columns Delete is found in the row, it will be managed :If value is 1 :When adding new entry, this row will be skipped. When updating existing entry, this row will be deleted. If value is 0 or empty:Row will be created/updated as if column Delete was not sent
  • Depending on Root node attribute “OnError” :If node is not included or if its value is “IGNORE”, CPQ will commit all changes to rows where no errors happened. If value of the node is “STOP”, CPQ will not commit any changes to the table. However, all rows will be processed and all errors will be reported in return XML.
  • Depending on Root node “Report”: If node is not included or if its value is “ERRORS_ONLY”, CPQ will return only errors in result XML. If node’s value is “ALL”, CPQ will return result of all rows in return XML
  • When creating result XML, for each row CPQ will return :Part Number and Price Code used for entry identification, Status – OK or NOK, Message: If upsert is successful, message will be :Entry inserted (when insert occurred), Entry updated (when updated occurred), Entry deleted (when delete occurred. If upsert is not successful, message will be sent according to the error that happened.“Incorrect characters found in price” – if non-numeric values are sent for price or “Part Number Column empty” – if row is missing part number.
  • Maximum number of entries that can be handled in one call is 2000.

Input Parameters

TagData TypeDescriptionRequiredComments
UsernameStringOnly CPQ admin users can execute this function. CPQ user is defined in CPQ admin.YesCPQ admin user name
PasswordStringOnly CPQ admin users can execute this function. Password is defined in CPQ admin.YesCPQ admin password for the admin user name provided in the username element
Pricebook CodeStringCode of pricebook that is being updatedYesCode of pricebook that is being updated
XMLStringData for populating pricebookYesXML should contain columns and rows(entries) to pricebook. Columns must be defined first. Only column PartNumber is required. Other columns are optional.Value for column Delete may be 1, 0 or empty

Input XML Example

<?xml version="1.0" encoding="utf-8"?>
<Root OnError="IGNORE" Report="ALL">
<Columns>
    <Column>PartNumber</Column>
    <Column>PriceCode</Column>
    <Column>Price</Column>
    <Column>Cost</Column>
    <Column>RecurringPrice</Column>
    <Column>RecurringCost</Column>
    <Column>PriceDescription</Column>
    <Column>Delete</Column>
  </Columns>
  <Rows>
    <Row>
      <Value>PartNumberXYZ</Value>
      <Value></Value>
      <Value>100</Value>
      <Value>50</Value>
      <Value></Value>
      <Value></Value>
      <Value>0</Value>
      <Value>0</Value>
    </Row>
  </Rows>
</Root>

Result XML Example

<?xml version="1.0" encoding="utf-8"?>
<Result>
  <Status>ALL_ENTRIES_IMPORTED</Status>
  <Message></Message>
  <Root>
  <Columns>
    <Column>PartNumber</Column>
    <Column>PriceCode</Column>
    <Column>Status</Column>
   <Column>Message</Column>
  </Columns>
  <Rows>
    <Row>
      <Value>PartNumberXYZ</Value>
      <Value></Value>
      <Value>OK</Value>
      <Value>Entry Inserted</Value>
    </Row>
  </Rows>
  </Root>
</Result>

Possible status nod values in result XML

ALL_ENTRIES_IMPORTED
If all rows have been inserted/updated/deleted successfully
ERRORS_FOUND_WHEN_IMPORTING
If error occurred when importing at least one row
NO_PART_NUMBER_COLUMN_PROVIDE
If part number column hasn’t been provided in columns header.
INCORRECT_USERNAME_AND_PASSWORD
If username/password combination is not correct.
DOMAIN_NOT_PROVIDED
If domain name has not be provided
NO_INPUT_XML
If XML wasn’t provided
PRICEBOOK_CODE_DOESNT_EXIST
Pricebook with provided pricebook code doesn’t exits
INVALID_COLUMN_NAME
If invalid column name has been specified
MAXIMUM_NUMBER_OF_ROWS_EXCEEDED
If allowed number of rows has been exceeded.
You are here: SAP Sales Cloud CPQ Online HelpSAP CPQ APIPricing APIUpsert API Method for pricebook