Hi Folks
We sometimes advise a company that has an AP integration with Sage 100. They are reporting getting an error 106 when running a task that was said to have been working for a couple of years and there has been no change made to Sage. The details are below. As I don't write Providex can't ready help much. Hope someone that knows code would know what the issue is. Below is the error that they are getting and below that is the code.
System.Runtime.InteropServices.COMException: <NewObject Error: 106>
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
This error happens when we try to get the value of the flag `CalcSalesTaxInAPDataEntry$` in A/P module.
===========================
dynamic pvx = new PvxDynamic("ProvideX.Script");
ExecuteMethodNoReturn(pvx, (FunctionVoidReturn)(() => { pvx.Init(homeDir); }), "connecting to Sage 100");
and session:
dynamic sySession = pvx.NewObject(SY_SESSION);
ExecuteMethodIntegerReturn(sySession, (FunctionIntegerReturn)(() => { return sySession.nSetUser(user, pass); }), "setting user credentials");
ExecuteMethodIntegerReturn(sySession, (FunctionIntegerReturn)(() => { return sySession.nSetCompany(company); }), "connecting to the company");
ExecuteMethodIntegerReturn(sySession, (FunctionIntegerReturn)(() => { return sySession.nSetDate(AP_MODULE, sySession.sSystemDate); }), "connecting to the company");
ExecuteMethodIntegerReturn(sySession, (FunctionIntegerReturn)(() => { return sySession.nSetModule(AP_MODULE); }), "connecting to the company");
SetUIClass(sySession, "AP_Invoice_ui");
we call:
pvx.NewObject("AP_options_bus", sySession);
and this throws an exception. We know that this is not a general issue as it's working for our other
------------------------------
Bob Osborn
Consultant
ACI Consulting
------------------------------