on 2022 Aug 24 4:30 PM
Dear SAP-Community,
I am currently using Quote 2.0. I would like to create a Quote Table with a Custom Action called “Add Product”. By this action I want to add selected products from the table to the quote.
To do so I want to use a python script to create the custom action (Add Product) as below:
quoteTable = context.Quote.QuoteTables['Accessory_N']
for quoteRow in quoteTable.Rows:
if quoteRow['Select_Product']:
itemsAdded = context.Quote.AddItem('Accessory_N_cpq')
for item in itemsAdded:
if not item.PartNumber:
item.PartNumber = str(quoteRow['Part_Number'])
item.Description = str(quoteRow['Description'])
item.ListPrice = quoteRow['Price']
item.Cost = quoteRow['Cost']
context.Quote.Calculate()
But it shows the errors:
Line 4: AddItem() takes exactly 2 arguments (1 given)
Line 11: Calculate() takes exactly 1 argument (0 given)
How must the code snippet look like to add product to a quote based on system id or part number?
Look forward to your Answers.
Best Regards
Nuzat
nuzatantora
you can use this in your script and loop from your quote table.ProductHelper.CanBeAddedToQuote('1234')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi yoganandamuthaiah,
Thank you so much for your response. Unfortunately I could not solve the issue with this suggestion. I think ProductHelper.CanBeAddedToQuote('1234') determines whether the product can be added to a quote or not, but not actually add the product to the quote.
I had found the method named AddItem which is responsible for adding a product to a quote, but I do not understand how it should be written. As it shows the javascript and other options to write but there is no python option available.
Best regards
Nuzat
User | Count |
---|---|
9 | |
4 | |
3 | |
3 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.