Skip to Content

Price property in Document Lines is ignored

Hi everyone,

I'm facing a situation where the Price property of a document is completely ignored.

The item used in the code has a price configured but it should override it with the one I provide. Note that we are providing the Price, not the UnitPrice.

Before running the code, make sure that the price for your A00002 in the price list for C20000 is not 100, otherwise, it will seem it works.

Here is the code:

var invoice = (Documents)company.GetBusinessObject(BoObjectTypes.oInvoices);
var items = invoice.Lines;

invoice.CardCode = @"C20000";
items.ItemCode = @"A00002";
items.Price = 100;

int result = invoice.Add();
if (result != 0)
    throw new Exception(company.GetLastErrorDescription());
        @"Operation completed successfully",

Expected to have an invoice for C20000 with one item, A0002, with a price after discount equal to 100.

Actually got an invoice for C20000 with one item, A0002, with a price after discount equal to 138.38 (which is the same as the UnitPrice).

Any ideas?

Kind regards,

Pedro Magueija

LinkedIn | Twitter | Blog

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 22, 2017 at 12:40 PM

    Hi Pedro,

    Have you been able to check SAP Note 1334050?

    Following is mentioned there:

    Price (DI API) = Price (field name)
    = Price after Discount (display in UI document)
    = Unit Price (field description)
    This is the item price before taxation and after discount. It can be updated in the UI and via the DI API and overwrites any settings in the discount accordingly.
    Notice that this field is disabled in the application when the option "Calculate the Row Total using the Unit Price"
    under > Administration > System Initialization > Document Settings > General tab is selected. [This option was available prior to SAP Version 8.82]
    That means the property becomes Read-Only in the DI API and any value set for Price will be ignored or set to 0. in certain cases you might get errors in the Tax Calculation due to this setting.
    In case this option is selected in your database, use the DI API property UnitPrice instead of Price for entering item prices in document lines.

    Kind regards,


    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded