Skip to Content
Dec 07, 2016 at 11:08 PM

Is it possible to overwrite the Sales Unit of Measure in a Sales order from ABSL?

537 Views Last edit Dec 07, 2016 at 11:10 PM 2 rev

Dear BYD community,

I am getting crazy over this as it is so simple on paper.

I just want to overwrite the Quantity.unitcode of a Sales Order Item from ABSL coding.

Moreover, I can see from the documentation it is possible as some code is shown to overwrite the quantity.content as well as the quantity.unitcode.

My code is not returning any error when I create my FirstRequestedScheduleLine.

And when I debug I can see my values from my custom object are good, like I have a Unit Code = Case of 15, and Quantity = 80.

But when the assignment is done, only the Quantity.content of the item gets red (chaging value) with the 80 value assigned.

The Quantity.unitcode on the contratry stays black in the debugger (no value changed) and keeps the default value from the Product Master Data -> Sales sectoin -> Sales UoM, which is Each.

I am just not able to overwrite this master data value Each from ABSL coding.

I can change it from the UI, but not from the backend.

To be noticed, my ABSL coding is in an custom Action run by an Mass Data Run.

Any help on this?

Thank you very much for your attention.

Best regards.

Jacques-Antoine Ollier

In case you need the code, but I know it is right ;)

NouveauSalesOrder_Item.ItemProduct.ProductKey.ProductID.content = RowItem.ItemProductID.content;

NouveauSalesOrder_Item.FirstRequestedItemScheduleLine.Quantity.unitCode = RowItem.RequestedQuantity.unitCode;
NouveauSalesOrder_Item.FirstRequestedItemScheduleLine.Quantity.content = RowItem.RequestedQuantity.content;	
NouveauSalesOrder_Item.FirstRequestedItemScheduleLine.DateTimePeriod.StartDateTime.content = RowItem.DateToBeDelivered;

var QuantityTrace = NouveauSalesOrder_Item.FirstRequestedItemScheduleLine.Quantity;
var stop = "stop";

else if(!NouveauSalesOrder_Item.FirstRequestedItemScheduleLine.IsSet())
var NouveauSalesOrder_Item_lines: elementsof NouveauSalesOrder_Item.ItemScheduleLine;
NouveauSalesOrder_Item_lines.Quantity.unitCode = RowItem.RequestedQuantity.unitCode;
NouveauSalesOrder_Item_lines.Quantity.content = RowItem.RequestedQuantity.content;	
NouveauSalesOrder_Item_lines.DateTimePeriod.StartDateTime.content = RowItem.DateToBeDelivered;

var UomTrace = NouveauSalesOrder_Item.ItemScheduleLine.Create(NouveauSalesOrder_Item_lines);
var stop2 = "stop";