cancel
Showing results for 
Search instead for 
Did you mean: 

Import 'Product configurations' from excel limitation

dmonta
Explorer
507

Hello Community,


at this link SAP simple script can be found in order to activate import from excel feature on a specific product:

https://help.sap.com/docs/SAP_CPQ/7fc27540a0f14bd1a10b639117a9d4d7/be93644b52b44bb897ba36ea4c77b70b....

Whit this file you can set value on attributes product configuration.

We've just changed the code in order to import an excel file containing only the attributes that we want to import, to make the script more flexible.

#adds message that will be shown to user in the responder part of the configurator<br>Product.Messages.Add("start")<br>#Gets the uploaded Excel spreadsheet "Sheet1" and loads<br># all cells between B2 and 'end' into an array<br>rows = Workbook.GetSheet("Sheet1").Cells.GetRowCount<br>end = Workbook.GetSheet("Sheet1").Cells.GetLastColumnPosition + str(rows)<br>arr = Workbook.GetSheet("Sheet1").Cells.GetRange("A2", end)<br>for x in range(0, rows-1):<br>    <strong>Product.Attributes.GetBySystemId(arr[x,0]).SelectValue(arr[x,1])</strong><br>Product.Messages.Add("end")<br>


SelectedValue() method works only for 'user selection' attributes, so it does not work for free text attributes.

Does anybody knows if there is a method that we can use to set a string on a free text attribute?

Is it a known limitation?

Please let me know if there's a way to obtain that.

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

patrick_latour3
Explorer

Hi Davide,

Try to use the AssignValue() for these.

Cheers,

Patrick

Answers (1)

Answers (1)

corey_shewell
Discoverer

Hi Davide,

Patrick is correct, .AssignValue() can be used to set the value of free input attributes.

For future reference, the various methods to interact with the CPQ scripting objects, such as product attributes, can be found in the Script Workbench under API snippets. Which method to use isn't always obvious at first, but with some trial and error you should be able to find what you need.

Hope this helps!

Corey