LoadReport & ProcessReport no longer working

We have a few custom reports that I created button launchers for in various places.  As far as I know, they have always worked until recently.  I would assume the update to 2013 broke these.  Here is the code I was using:

'---------------------------------------------------------------------
'Log on to MAS90
'---------------------------------------------------------------------
Set oScript = CreateObject ("ProvideX.Script")
oScript.Init("S:\Sage 100 Standard ERP\MAS90\Home")
Set oSS = oScript.NewObject("SY_Session")
r = oSS.nLogon()
If r=0 Then
r = oSS.nSetUser("scriptrunner","password")
'msgbox(r)
End If
r = oSS.nSetCompany("MX1")
'---------------------------------------------------------------------
'Run Report
'---------------------------------------------------------------------
retVal = oSS.nSetDate("A/R", "20140101")
retVal = oSS.nSetModule("A/R")
retVal = oSS.nSetProgram(oSS.nLookupTask("SY_REPORTRUNTIME_UI"))
If retVAL = 0 Then
MsgBox(oSS.sLastErrorMsg & vbCRLF & "Report Runtime is not available. Quiting.")
End If
Set oSORpt = oScript.NewObject("SY_REPORTRUNTIME_RPT",oSS)
sCompanyKey = oSS.sCompanyKey
sUserKey = oSS.sUserKey
sReportFile = ""
r = oSORpt.sLoadReport("Customer Statement Report","STANDARD","AR",sCompanyKey,sUserKey, sReportFile)
msgbox(r) <--Returns Nothing
r = oSORpt.nProcessReport("preview")  <--Script bombs here with "Error 712 in method ProcessReport
msgbox(r)

The report being requested is in the Custom Reports menu, though I have also tried a standard report resulting in the same error.  I tried using my admin user for the login, same results.

Suggestions?

Parents
  • 0 in reply to dlevasseur

    Dan,

    I had a few minutes to look at this today and I don't see how the code you shared could work.  Maybe I missing something or there is more to your setup.  If you can replicate this using a standard report in a prior version then please contact Customer Support with details so that they can create a case.

    In a standard Sage 100 installation, there is no task for SY_ReportRunTime_UI in the system so the SetProgram method being used would always fail. Another issue is that the first argument being passed to the LoadReport method is not correct.  It should be the UI for the report printing program (i.e. AR_StatementPrinting_UI).

    Is the intent of this script just to print the customer statements?  If so, this is not the way we would reccomend going about that.  There are other posts on the forum that deal with printing that you should refer to for information.

    Thanks

    Kent Mackall

  • 0 in reply to Justin K

    That worked! Thank you Justin. I was running that from the server, but using the drive letter worked.

    I still need to get the methods of the "SY_ReportRuntime_rpt" object working that are the original title of this post (i.e. LoadReport, ProcessReport). that  said used to work. Anyone?  @kent-mackall (either as a UDS or a BOI script)

  • 0 in reply to connex

    , this does work for me on 2021.   I just ran this from a button script but did have success, granted my report isn't very sophisticated.

    oRpt = oSession.GetObject("SY_ReportRuntime_rpt")
    Set oRpt = oSession.AsObject(oRpt)
    
    sCompKey = oSession.CompanyKey
    sUserKey = oSession.UserKey
    
    sReportRet = ""
    sCrystalRpt = ""
    
    sReportRet = oRpt.LoadReport("TestReport", "STANDARD", "A/P", sCompKey, sUserKey, sCrystalRpt)
    
    ' note that the first argument is the ReportID from SY_ReportWizardMain
    
    retVal = oRpt.ProcessReport("PREVIEW")
    

    Let me know if that works

    E

  • 0 in reply to jepritch

    Thanks  for the example, but I'm finding that even though I have many custom reports the ..\MAS_System\SY_ReportWizardMain file doesn't include any records. I found an archived system that has a few records in it, but none are for its custom reports.

    File "Sy_ReportSetting.m4T" has entries for my custom report (including "ReportSetting=STANDARD", but the ReportID there (the file name including the extension) didn't work either. I also tried it w/o the extension. I checked all other MAS_System files modified since the custom report was added and could not find anything that worked. I am testing as a button script on Sage 100 Std Version 2021 Version 7.00.2.0.

  • 0 in reply to connex

    The above report I did through Business Insights Reporter, which uses a wizard to define the report and then add it to the menu. This also adds it to SY_ReportWizardMain.   The SY_ReportRuntime_rpt requires the report to be setup in that SY_ReportWizardMain.     Did you use Report Manager to create your report?  

    I'll have to review how to do that via scripting (if possible).  I assume you want this to run without a UI?  

    E

  • 0 in reply to jepritch

    Thanks again. Yes, I need it for reports added to the  Custom Reports menu with Report Manager and without the UI if possible.

  • 0 in reply to connex

    The report manager uses a different object to run everything through, so I just modified your script above, and this seems to work for me here.

    retVal = oSS.nSetDate("A/R", "20140101")
    retVal = oSS.nSetModule("A/R")
    retVal = oSS.nSetProgram(oSS.nLookupTask("SY_Listing_ui"))
    If retVal = 0 Then
        MsgBox(oSS.sLastErrorMsg & vbCRLF & "Report Runtime is not available. Quiting.")
    End If

    Set oSORpt = oScript.NewObject("SY_ReportManagerGeneratedListing_rpt", oSS, "AR_whateverCustom.rpt", "Report Caption")
    r = oSORpt.nProcessReport("preview")

    Give that a try.

    E

  • 0 in reply to jepritch

    Thanks  Testing this now, in a UDS what is the equivalent of this for in a UDS?

    Set oSORpt = oScript.NewObject("SY_ReportManagerGeneratedListing_rpt", oSS, "AR_whateverCustom.rpt", "Report Caption")

    I tried both of these statements below but get the same error message "Error 88 Invalid/unknown property name, Wrong number of arguments or invalid property assignment: 'oSession.NewObject'

    Set oSORpt = oScript.NewObject("SY_ReportManagerGeneratedListing_rpt", oSession, "GL_My_Custom.rpt", "My Caption")
    Set oSORpt = oSession.NewObject("SY_ReportManagerGeneratedListing_rpt", oSession, "GL_My_Custom.rpt", "My Caption")

  • 0 in reply to connex

    That's kind of the kicker.  In a user-defined script there really isn't a way to instantiate an object with multiple arguments.  However, you should be able to write it as a vbs script and then connect it to either a button script or an event script.  For an event script you'll have to define it as a user-defined script, but I think it should still work.

    E

  • 0 in reply to jepritch

     Thanks again for the response. This does clear things up. I don't want to use a BOI script because I can't leave the credentials in clear text and don't want to have to compile it to every time they need to be changed.

Reply Children
No Data