Skip to Content
0
Former Member
Sep 28, 2016 at 06:50 AM

Create item in quote and set list price via ABSL

281 Views

Hey community,

I am trying to create an item in a customer quote but am not able to set the list price without errors ("Mandatory List Price missing for the price calculation"). This is my ABSL code:

var itemData : elementsof CustomerQuote.Item;

itemData.ID = (Numeric.ParseFromString(customerQuote.Item.GetLast().ID) + 10).ToString();

var item = customerQuote.Item.Create(itemData);

item.ItemProduct.ProductKey.ProductID.content = "3";

// Retrieve measure unit code from service

var query = ServiceProduct.QueryByDescription;

var selectionParams = query.CreateSelectionParams();

selectionParams.Add(query.ProductID.content, "I", "EQ", "3");

var resultData = query.Execute(selectionParams);

if (item.FirstRequestedItemScheduleLine.IsSet()) {

item.FirstRequestedItemScheduleLine.Quantity.content = 1;

item.FirstRequestedItemScheduleLine.Quantity.unitCode = resultData.GetFirst().Common.BaseMeasureUnitCode;

} else {

item.FirstRequestedItemScheduleLine.Create();

item.FirstRequestedItemScheduleLine.Quantity.content = 1;

item.FirstRequestedItemScheduleLine.Quantity.unitCode = resultData.GetFirst().Common.BaseMeasureUnitCode;

}

if (item.PriceAndTaxCalculationItem.IsSet()) {

if (item.PriceAndTaxCalculationItem.ItemMainPrice.IsSet()) {

item.PriceAndTaxCalculationItem.ItemMainPrice.Rate.DecimalValue = 0.0;

item.PriceAndTaxCalculationItem.ItemMainPrice.Rate.CurrencyCode = "EUR";

} else {

item.PriceAndTaxCalculationItem.ItemMainPrice.Create();

item.PriceAndTaxCalculationItem.ItemMainPrice.Rate.DecimalValue = 0.0;

item.PriceAndTaxCalculationItem.ItemMainPrice.Rate.CurrencyCode = "EUR";

}

}

Also the quote gets saved properly, but the error gets thrown anyway - and if I switch to the tab "Pricing and Invoicing" all error messages dissapear, which is somewhat of a strange behaviour.

Can you provide me ABSL code which sets the list price without errors?

Thanks in advance and best regards,

Jürgen