Former Member

### Adding a document setting quantity and total after VAT

Hello, everyone:

I need your help because I'm not able to figure it out how to do this.

I'm making an addon with DI API, and I set the values for a Sales Order. The idea is that the customer select an item, set the quantity of them, and then set the price after VAT, because it want to round the final value. Ok, I got all the data and calculate those that I don't have.

I set the header data (CardCode, CardName, DocDate, DocDueDate, TaxDate, FederalTaxID, SalesPersonCode and DownPaymentType)

I set the BaseLine and ItemCode of the line and then, here it comes my question:

The Idea was to set the quantity and price after VAT for that item in the line, and let SAP calculate the percent discount, leaving the unit price the same as the price list table. For example, I want to order 4 items of 100\$, with a 75% discount (100\$ total).

- If I set only the Quantity and the PriceAfterVAT in the document object, SAP sets the quantity (4 units) but it ignores the discount (no discount percent (0%), the total is quantity*unitPrice (400\$)...).

- If I set Quantity and the LineTotal (calculated by the addon) SAP sets the quantity (4 units) and the total is what I want (100\$), but it changes the UnitPrice (33\$ per item) and discount is 0%

- Same if I set Quantity, LineTotal and DiscountPercent.

- If I set Quantity (4 units), PriceAfterVat (100\$) and DiscountPercent (75%), I got 4 items, a 75% of discount on the line, and the item still cost 100\$, but DocTotal is 400\$. Also, in the DataBase, Quantity is 4, DiscountPrcnt is 75%, but UnitPrice is 33\$, DocTotal is 100\$ and LineTotal is 400\$ (pretend that document header VAT is 0% for simplifing the calculations).

I tried several combinations, but I can't get the same behaviour than SAP: select an item, set the quantity, set the discount percent or line price after VAT, and save it.

Could you help me, please? Thank you.

10|10000 characters needed characters exceeded
• Manuel,

I think you flagged an incorrect Primary Tag for your question.

TRE