cancel
Showing results for 
Search instead for 
Did you mean: 

Price property in Document Lines is ignored

pedro_magueija
Active Contributor
0 Kudos

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());
}
else
{
    application.StatusBar.SetSystemMessage(
        @"Operation completed successfully",
        BoMessageTime.bmt_Short,
        BoStatusBarMessageType.smt_Success);
}

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

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

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,

ANKIT CHAUHAN

SAP SME Support

pedro_magueija
Active Contributor
0 Kudos

Hi Ankit,

Thank you for your reply.

One thing the Note isn't clear about is the current behavior of the application. Am I correct in assuming that the default for that setting in the current B1 release 9.2 is enabled?

Kind regards,

Pedro Magueija

LinkedIn | Twitter | Blog

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Pedro,

Could you please have a look at the following link? It was discussed with our development team and replied here:

A/R Invoice Issue

Kind regards,

ANKIT CHAUHAN

SAP SME Support

Answers (0)