Skip to Content

G/L Account is missing

Jul 17, 2017 at 05:54 PM


avatar image


I am trying to add a down payment invoice to a sales order using the SAP Business One SDK. My code is as follows (the Sales order is already successfully created:

SAPbobsCOM.Documents oPayment = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDownPayments);

oPayment.DownPaymentPercentage = 100;

oPayment.DownPaymentType = SAPbobsCOM.DownPaymentTypeEnum.dptInvoice;

oPayment.ControlAccount = "_SYS00000000010";

//oPayment.ControlAccount = "12100000-01-001-01";

// Open Debts account from Business Partner

//oPayment.ControlAccount = "11100000-01-001-01" ;

//oPayment.ControlAccount = "52300000-01-001-01"; // General Ledger decrease account

//oPayment.ControlAccount = "62300000-01-001-01";

// Overpayment A/P account - Purchasing

//oPayment.ControlAccount = 62200000-01-001-01" ;

// underpayment A/P account - Purchasing

//oPayment.ControlAccount = "12100000-01-001-01" ;

oPayment.DocumentsOwner = 11;

oPayment.StartDeliveryDate = DateTime.Now.Date;

oPayment.EndDeliveryDate = DateTime.Now.Date;

foreach (XmlNode prodLineItem in xmlNode["OrderItems"]) {

quantity = 0;

if (double.TryParse(prodLineItem["Quantity"].InnerText, out quantity)) oPayment.Lines.Quantity = quantity;

if (double.TryParse(prodLineItem["PriceExclTax"].InnerText, out BasePrice)) { oPayment.Lines.UnitPrice = BasePrice;


oPayment.Lines.BaseLine = i;

oPayment.Lines.BaseType = 17; // 17 for oOrder

oPayment.Lines.BaseEntry = Int32.Parse(sNewObjCode); oPayment.Lines.DiscountPercent = Convert.ToDouble(0.00);

oPayment.Lines.ItemCode = prodLineItem["ProductId"].InnerText; oPayment.Lines.ItemDescription = prodLineItem["Name"].InnerText; oPayment.Lines.Quantity = quantity;

oPayment.Lines.Price = 0;

oPayment.Lines.UnitPrice = BasePrice;

oPayment.Lines.TaxCode = "";




lRetCode = oPayment.Add();

When the oPayment object is added, I get the error: -5002: G/L Account is missing.

I have checked the G/L Account Determination under Administration->Setup. All of the sales, inventory, purchasing etc accounts are defined. One thing I am not sure of is what account to set the

ControlAccount for the downpayment to. Is it suppose to be the A/R Overpayment account, A/R underpayment account, A/P overpayment account, A/P underpayment account, the Open Debts account from Business Partner or some other account. When I try to assign one of these accounts to the ControlAccount, I get the error:

CServiceData::SetPropertyValueString failed; Value too long in property 'ControlAccount' of 'Document'

at the line where the assignment is being performed. (It does not even get to the oPayment.Add line. I don't know how to get rid of this error.

Also, for the product item in the downpayment and sales order, the Item Master data->Inventory shows by Warehouse but when I go to Administration->Inventory->Warehouse setup, there is no Accounting tab where I can specify accounts. I have tried changing to Item Level but still get the G/L Account is missing error. Also, there is no Downpayment A/R account under Control Accounts for the business partner. Does there have to be one?

Please help.


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers