Hello, I am prototyping the creation of new AR Invoices using BOI. I am running into some issues when it is time to create new lines. I am able to get the next invoice number and set the values for all of the fields (ret_val = 1). But once I try to use nAddLine the ret_val returns as 0. I am not sure why. I have attached the code below. Thanks in advance. Public Const CONST_ACCOUNTS_RECEIVABLE_MODULE = "A/R" Dim accounts_receivable_module As Object Dim accounts_receivable_lines As Object Dim ret_val As String Dim invoice_number As String = "" _providerx_object = CreateObject( "ProvideX.Script" ) _providerx_object.Init(_mas90_directory + "Home" ) _sy_session = _providerx_object.NewObject( "SY_Session" ) _sy_session.nSetUser(_mas90_user_code, _mas90_password) _sy_session.nSetCompany(company_code) _sy_session.nSetModule(CONST_ACCOUNTS_RECEIVABLE_MODULE) _sy_session.nSetDate(CONST_ACCOUNTS_RECEIVABLE_MODULE, Now.Year & Right( "0" & Now.Month, 2) & Right( "0" & Now.Day, 2)) _sy_session.nSetProgram(_sy_session.nLookupTask( "AR_Invoice_UI" )) accounts_receivable_module = _providerx_object.NewObject( "AR_Invoice_bus" , _sy_session) ret_val = accounts_receivable_module.nGetNextInvoiceNo(invoice_number) ret_val = accounts_receivable_module.nSetValue("InvoiceNo$", invoice_number) ret_val = accounts_receivable_module.nSetValue( "InvoiceType$" , "IN" ) ret_val = accounts_receivable_module.nSetValue( "BatchNo$" , "T" & Right( "0" & Now.Month, 2) & Right( "0" & Now.Day, 2)) ret_val = accounts_receivable_module.nSetValue( "InvoiceDate$" , "20140707" ) ret_val = accounts_receivable_module.nSetValue( "ARDivisionNo$" , "01" ) ret_val = accounts_receivable_module.nSetValue( "CustomerNo$" , "1ST001" ) ret_val = accounts_receivable_module.nSetValue( "InvoiceDueDate$" , "20140707" ) ret_val = accounts_receivable_module.nSetValue( "DiscountDueDate$" , "20140707" ) � accounts_receivable_lines = accounts_receivable_module.oLines ret_val = accounts_receivable_lines.nAddLine() ---------------- FAILS HERE ret_val = accounts_receivable_lines.nSetValue( "ItemCode$" , "C" ) '' Write Line ret_val = accounts_receivable_lines.nWrite() ret_val = accounts_receivable_module.nWrite()
↧