Sage 100

 View Only
  • 1.  Code error

    Posted 11-28-2023 23:08

    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
    ------------------------------


  • 2.  RE: Code error

    Posted 11-29-2023 10:22

    Error 106 is Keyed file error (Bad key block hdr).

    Check Activity log for possible help to rebuild file.



    ------------------------------
    Lee Graham
    Friendly Systems, Inc.
    ------------------------------



  • 3.  RE: Code error

    Posted 11-30-2023 09:37
    Edited by Alnoor Cassim 11-30-2023 09:37

    Bob - Do you know why they need to NewObject to AP_Options_bus and then GetValue from CalcSalesTaxInAPDataEntry$. There is a GetParameter method from the session object made for doing stuff like that. This is how it would be done in BOI / VBScript with their variables:

    sCalcSalesTaxInAPDataEntry = ""
    retVal = sySession.nGetParameter("A/P", "CalcSalesTaxInAPDataEntry$", sCalcSalesTaxInAPDataEntry)



    ------------------------------
    Alnoor Cassim
    ------------------------------



  • 4.  RE: Code error

    Posted 11-30-2023 10:13

    Hi Alnoor

      No, I don't know why they are doing it the way they are.  Their comment was that it had been working up till recently.    Based on what they are saying, and what I know about an error 106 I couldn't see what would cause it.   I will pass this along and thanks much!

     

    Thank you,

     

    Bob Osborn

    ACI Consulting

    p 714.282.0378 ext. 402    f 714.282.0235

     

    Bob@ACIconsulting.com

     

     ACISignature1                  

    MCP_SE_Small.bmp

    This communication, including attachments, is confidential and may contain proprietary information intended only for the proposed recipient. Please notify the sender and delete this message if you believe that you have received this message in error or if you are not the proposed recipient. Unauthorized disclosure, copying, or distribution of the information is strictly prohibited.