For a newly created Sales Order I want to add positiv or negativ discounds, on document and line level.
Discounts by percentage work find. On document level I create a new SOOrderDiscountDetail, set Type = ‘B’, IsManual = true and DiscountPct. On line level I just set SOLine.DiscPct.
But I have problems to set discounts by amount. If I set SOOrderDiscountDetail.DiscountAmt or SOLine.DiscAmt, it is set back to 0,0.
The lines and discount details are created any persisted like this.
What is the correct way to set a discount amount on document and line level code?