Skip to Content

Adding a document setting quantity and total after VAT

Mar 01 at 06:02 PM


avatar image

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 left characters exceeded


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

Glad you solved the issue.


* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Manuel García Mar 02 at 11:08 AM

Finally, I can do it by myself.

I had to set the UnitPrice, Quantity, PriceAfterVat, LineTotal and DiscountPercent. I'm not sure if Line total is mandatory, but I added it anyway.

The problem I had was that I was setting the line total wit VAT to PriceAfterVat, instead the unit price with VAT. With that in mind, and setting all the values I said before, SAP was able to save the document with the unit price, the discount percent per line, and the line total with VAT perfectly rounded as the customer needed.

10 |10000 characters needed characters left characters exceeded