Skip to Content

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

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";
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Dec 08, 2016 at 04:56 PM

    Finally I found it!

    The documentation forgot to mention that we also need to oiverwrite the QuantityUnitOfMeasure at the ItemProduct node level.

    It is not sufficient to simply overwrite the RequestScheduleLine if the Sales Base UoM is different.

    Thus I needed to add this code before the one I pasted in my first post:

    NewSalesOrderItem.ItemProduct.QuantityMeasureUnitCode = RowItem.RequestedQuantity.unitCode;

    And now this is working!

    So guys, when you try to oiverwrite the UnitCode in hte IFrstRequestedScheduleLine of a Sales Order Item, do not forget to first overwrite the SalesOrder.Item.ItemProduct.QuantityMeasureUnitCode field.

    Thank you for your attention.

    Best regards.


    Add comment
    10|10000 characters needed characters exceeded

  • Dec 08, 2016 at 06:51 AM


    Did you specified Quantity Conversions for your required unit in Product master?



    Add comment
    10|10000 characters needed characters exceeded

    • Hello May Thitsa Oo,

      Yes, the functional consultant has set Each as the Base Sales UoM and set like 100 conversions from Cases to Each.

      All the type of cases are there. But when I try to populate the unit code with like Z15 (case of 15) instead of Each, it stays at Each even though the conversion 1 Z15 = 15 EA is in the conversoins rules.

      I tested to change the Base Sales UoM to Z15 (case of 15) and to input in my code EA.

      And nopw I have Z15 as the unit code in my sales order item, and it is impossible to overwrite with EA.

      Every time the config is taking over. The only way I can change it is manually through the UI.

      I tried to do it in a Before-save on the Sales Order Item, same things, cannot change it. And what is weird is I do not get a single message in the debugger.

      Thank you for your attention.

      Best regards.

      Jacques-Antoine Ollier

  • avatar image
    Former Member
    Sep 18, 2017 at 01:36 AM

    Hi ,

    Could you please let me know whether you have found the solution about this. I really need you help.

    Thanks and Regards.


    Add comment
    10|10000 characters needed characters exceeded