Financial Management Blogs by Members
Dive into a treasure trove of SAP financial management wisdom shared by a vibrant community of bloggers. Submit a blog post of your own to share knowledge.
cancel
Showing results for 
Search instead for 
Did you mean: 
Gauri
Active Participant
6,101
SAP (CallidusCloud) CPQ is the industry-leading cloud-based sales tool which automates the quote and proposal process enabling companies to produce accurate and highly configured sales quotes for customers. SAP CPQ is designed to calculate even the most complicated and lengthy quotes instantly and fits perfectly between SFA, ERP, CLM, Billing. One of the key solution component is the out of box APIs which are available in order to perform multiple set of activities. It is essential to understand how the APIs can be invoked or used as part of overall solution for successful on time on budget implementation.

In this blog I have shared how out of the box API’s can be invoked from external software’s like SOAPUI or POSTMAN while working in SAP CPQ and integrating with other products. The main focus of the blog is to demonstrate XML request formation in order to trigger the API successfully for quote, product and user creation in SAP CPQ system.

First step is to download the WSDL file from SAP CPQ system.

To access SAP CPQ’s API, use the following URLs:


  • <tenant url>/wsAPI/CPQAPI.asmx - this is the set of user-level functions


  • <tenant url>/wsAPI/wssrv.asmx      - this is the set of administrator-level fu


Lets start with Examples:-

First API :- NewQuote


Endpoint URL:-  <tenant url>/wsAPI/CPQAPI.asmx

The standard web service definition gives the request as follows:-
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<NewQuote xmlns="http://webcominc.com/">
<username>string</username>
<password>string</password>
<owner>string</owner>
<xml>xml</xml>
</NewQuote>
</soap:Body>
</soap:Envelope>

The xml for new quote will include market code, Pricebook, Product name, Catalogue code, Customer details.

In the below XML username, password and owner needs to be replaced with actual names. I have given placeholders.

MarketCode, PriceBookCode, ProductName, CatalogueCode are also placeholders. We need to give actual code in the tags. CatalogueCode is product partnumber code.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://webcominc.com/">
<soap:Header/>
<soap:Body>
<web:NewQuote>
<web:username>sapcpquser#domain</web:username>
<web:password>password</web:password>
<web:owner>owner</web:owner>
<web:xml>
<Cart>
<MarketCode>MarketCode</MarketCode>
<PricebookCode>PriceBookCode</PricebookCode>
<ShippingMethod/>
<ShippingPrice>1</ShippingPrice>
<TaxExempt>0</TaxExempt>
<CartComment/>
<Items>
<Item>
<Quantity>1</Quantity>
<ProductName>Name of the Product</ProductName>
<CatalogueCode>PartNumber</CatalogueCode>
<ItemPrice>680</ItemPrice>
<Attributes>
<Attribute>
<Name>ExampleName</Name>
<Value>100</Value>
<Value>101</Value>
</Attribute>
</Attributes>
</Item>
</Items>
<Properties>
<Property>
<Name>Project Name</Name>
<Value>Pilot</Value>
</Property>
</Properties>
<Customers>
<Customer CustomerRoleType="1">
<Id/>
<ExternalId/>
<FirstName>Harry</FirstName>
<LastName>Peter</LastName>
<Company>ABCD Company, The</Company>
<Address1>ABCD Plaza</Address1>
<Address2/>
<City>Cincinnati</City>
<StateAbbrev>OH</StateAbbrev>
<ZipCode>45402</ZipCode>
<CountryAbbrev>US</CountryAbbrev>
<TerritoryName/>
<BusinessPhone>(513) 698-6421</BusinessPhone>
<BusinessFax>(513) 983-4381</BusinessFax>
<EMail>test@gmail.com</EMail>
</Customer>
<Customer CustomerRoleType="2">
<Id/>
<ExternalId/>
<FirstName>Harry</FirstName>
<LastName>Peter</LastName>
<Company>ABCD Company, The</Company>
<Address1>ABCD Plaza</Address1>
<Address2/>
<City>Cincinnati</City>
<StateAbbrev>OH</StateAbbrev>
<ZipCode>45402</ZipCode>
<CountryAbbrev>US</CountryAbbrev>
<TerritoryName/>
<BusinessPhone>(513) 698-6421</BusinessPhone>
<BusinessFax>(513) 983-4381</BusinessFax>
<EMail>test@yahoo.com</EMail>
</Customer>
<Customer CustomerRoleType="3">
<Id/>
<ExternalId/>
<FirstName>Harry</FirstName>
<LastName>Peter</LastName>
<Company>ABCD Company, The</Company>
<Address1>ABCD Plaza</Address1>
<Address2/>
<City>Cincinnati</City>
<StateAbbrev>OH</StateAbbrev>
<ZipCode>45402</ZipCode>
<CountryAbbrev>US</CountryAbbrev>
<TerritoryName/>
<BusinessPhone>(513) 698-6421</BusinessPhone>
<BusinessFax>(513) 983-4381</BusinessFax>
<EMail>test@rediff.com</EMail>
</Customer>
</Customers>
</Cart>
</web:xml>
</web:NewQuote>
</soap:Body>
</soap:Envelope>

Once the request is executed then Quote is created in SAP CPQ system. The output of the web service is shown as follows:-
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<NewQuoteResponse xmlns="http://webcominc.com/">
<NewQuoteResult>
<Result xmlns="">
<Status>OK</Status>
<Message>New Quote Created</Message>
<QuotationNumber>01180050</QuotationNumber>
<QuoteLink>http://<SAPCPQ URL>/Login.aspx?quote=CFCECEC7CFCFCACF</QuoteLink>
</Result>
</NewQuoteResult>
</NewQuoteResponse>
</soap:Body>
</soap:Envelope>

The Quote can be seen in SAP CPQ system


Second API :- UserAdministration


Endpoint URL:- <tenant url> /wsAPI/wssrv.asmx

Request for User Administration Web service part of standard documentation comprises of the following
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<UserAdministration xmlns="http://webcominc.com/">
<userNameAtDomain>string</userNameAtDomain>
<password>string</password>
<action>string</action>
<xDoc>xml</xDoc>
</UserAdministration>
</soap:Body>
</soap:Envelope>

To create a new user, We will use below XML request where the user related tags are passed to the XML and actual user gets created in the system

In the below XML, replace sapcpquser with actual user, domain with actual domain and password with the actual password.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://webcominc.com/">
<soap:Header/>
<soap:Body>
<web:UserAdministration>
<web:userNameAtDomain>sapcpquser#domain</web:userNameAtDomain>
<web:password>password</web:password>
<web:action>ADDORUPDATE</web:action>
<web:xDoc>
<USERPROPERTIES>
<USERNAME>scn_test</USERNAME>
<PASSWORD AllowSameAsExisting="1">Welcome1</PASSWORD>
<TITLE>Mr.</TITLE>
<FIRSTNAME>scn</FIRSTNAME>
<LASTNAME>test</LASTNAME>
<TYPE>Sales</TYPE>
<EMAILADDRESS>scn_test@mycompany.com</EMAILADDRESS>
<ADDRESS1>Malad</ADDRESS1>
<ADDRESS2/>
<ADMINISTRATOR>TRUE</ADMINISTRATOR>
<CITY>Mumbai</CITY>
<STATE>Maharashtra</STATE>
<ZIPCODE>400097</ZIPCODE>
<COUNTRY>India</COUNTRY>
<PHONENUMBER>262-785-8320</PHONENUMBER>
<FAXNUMBER/>
<COMPANYCODE>CALD</COMPANYCODE>
<MUSTCHANGEPASSWORD>0</MUSTCHANGEPASSWORD>
<PASSWORDLOCKED>0</PASSWORDLOCKED>
<DEFAULTDICTIONARY>US English</DEFAULTDICTIONARY>
</USERPROPERTIES>
</web:xDoc>
</web:UserAdministration>
</soap:Body>
</soap:Envelope>

The Response of the web service is as follows:-
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<UserAdministrationResponse xmlns="http://webcominc.com/">
<UserAdministrationResult>
<Response xmlns="">
<Result>OK</Result>
<Message>User scn_test added</Message>
</Response>
</UserAdministrationResult>
</UserAdministrationResponse>
</soap:Body>
</soap:Envelope>

The Results of executing the web service can be seen in SAP CPQ tenant as follows:-




Third API:-  SimpleProductAdministration


Lets check the SimpleProductAdministration web service XML request and response

Endpoint URL:- <tenant url>/wsAPI/wssrv.asmx

The standard documentation gives the XML request as follows:-
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SimpleProductAdministration xmlns="http://webcominc.com/">
<userName>string</userName>
<password>string</password>
<action>string</action>
<xDoc>xml</xDoc>
</SimpleProductAdministration>
</soap:Body>
</soap:Envelope>

In this request the xml formation is shown in the below XML code snippet. The product has few tags like ProductName, Categories which have language associated with them. The value of such tags in the XML needs to be given with language tag in addition as shown below. If language tag like <USEnglish> and the description should be given in the format as <![CDATA[Description]] > to give a successful call to SAP CPQ system else the web service will give invalid product name, invalid categories, etc and won't create product in SAP CPQ.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webcominc.com/">
<soapenv:Header/>
<soapenv:Body>
<web:SimpleProductAdministration>
<web:userName>sapcpquser#domain</web:userName>
<web:password>password</web:password>
<web:action>ADDORUPDATE</web:action>
<web:xDoc>
<Products SkipCategoriesOnProductUpdate="True">
<Product>
<ProductName>
<USEnglish><![CDATA[Product Speaker]]> </USEnglish>
</ProductName>
<DisplayType>Simple</DisplayType>
<ProductType>Hardware</ProductType>
<Categories>
<USEnglish><![CDATA[Speakers]]></USEnglish>
</Categories>
</Product>
</Products>
</web:xDoc>
</web:SimpleProductAdministration>
</soapenv:Body>
</soapenv:Envelope>

Response:-
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<SimpleProductAdministrationResponse xmlns="http://webcominc.com/">
<SimpleProductAdministrationResult>
<Result xmlns="http://webcominc.com/">
<Status>OK</Status>
<Message>Action successful.</Message>
</Result>
</SimpleProductAdministrationResult>
</SimpleProductAdministrationResponse>
</soap:Body>
</soap:Envelope>

Web service once executed the product can be found in SAP CPQ system.



I have shown three main API in this blog. I am sure this information will be helpful to SAP CPQ consultants while execution of SAP CPQ projects.

 

Best Regards,

Gauri

 
11 Comments
Labels in this area
Top kudoed authors