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?

  • 0 in reply to Kent Mackall

    HI Kent,

    I'm trying to print a regular Custom Report that I created, that has been added to the 'Custom Reports' menu under Sales Order.  Ideally, this report would be run from a button link on a Sage panel.  If the menu name of the report is 'My Report', can you help me with the syntax?   Would the 'STANDARD' argument be required if it is a custom report added via Report Manager?  Any help would be greatly appreciated - the below returns 'Report file not found or does not exist' when calling both LoadReport and ProcessReport.

    retVaL = oSession.SetProgram(oSession.LookupTask("SY_ReportRuntime_ui"))

    myCRh = oSession.GetObject ("SY_ReportRuntime_rpt")

    If myCRh= 0 Then

    ' Show error message

    End If

    Set myCRo = oSession.AsObject(myCRh)

    sCompanyKey = oSession.CompanyKey

    sUserKey = oSession.UserKey

    sReportFile = ""

    tmp = myCRo.LoadReport("My Report","STANDARD","SO",sCompanyKey,sUserKey, sReportFile)

    retVal = myCRo.ProcessReport("print")

  • 0 in reply to Justin K

    This is the same script I'm trying above and getting nothing.  How are you getting it to return "Report file not found"  

  • 0 in reply to dlevasseur

    I'm displaying the myCRo.LastErrorMsg property after calling LoadReport and ProcessReport

  • 0 in reply to Justin K

    Greetings,

    Custom reports added through Report Manager use a different object (SY_ReportListing_UI) to print than the BIR Reports (SY_ReportRuntime_UI).  I don't think I have ever written a sample script to print a Report Manager custom report.  If someone has, please share it.  If not, I'll add it to my list but I don't know when I would be able to get to it.

    Thank you,

    Kent Mackall

  • 0 in reply to Kent Mackall

    The original script I posted DID WORK at one time, so they must have changed it up.

  • 0 in reply to dlevasseur

    I've updated my script to this:

    retVaL = oSession.SetProgram(oSession.LookupTask("SY_ReportListing_ui"))

    myCRh = oSession.GetObject ("SY_ReportRuntime_rpt")

    // I left the above - there is no SY_ReportListing_rpt object

    If myCRh= 0 Then

    ' Show error message

    End If

    Set myCRo = oSession.AsObject(myCRh)

    sCompanyKey = oSession.CompanyKey

    sUserKey = oSession.UserKey

    sReportFile = ""

    tmp = myCRo.LoadReport("My Report","STANDARD","SO",sCompanyKey,sUserKey, sReportFile)

    //The above line is what I am unclear about.  Should the first parameter be the FILE name of the report or the name as it exists on the MAS menu?  Also, what should be passed into the second parameter for a custom report?

    //I'm trying all different combinations of parameters but to no avail :(

    retVal = myCRo.ProcessReport("print")

    If anyone has experience with this please chime in!  I really need to get this going.

  • 0 in reply to dlevasseur

    Dan, were you able to get anywhere with this?

  • 0 in reply to Justin K

    Nope.  Without any further help from Sage, I really don't know what else to do.

    I know the button script worked back in 4.4  That's when I created the original button I had on the panel and the script in my OP.  I wouldn't have made a button, a script, and a report, that didn't work and leave it on the menu.

  • 0 in reply to dlevasseur

    Kent,

    You mentioned back in April that you were going to try and run a test with this.  If you could help clear up some of the questions we have here it would be a really big help.  I'm sure any info you might provide may also help other folks in the future.  Thanks!

  • 0 in reply to Justin K

    Greetings,

    I know I mentioned that I would try and look into this but I didn't make much progress before having to set this aside for other projects.  Let me see if I can get back into it.  In the meantime, would one of you (Dan or Justin) open a case with Customer Support for this issue?  That will make sure that the issue gets tracked and resources assigned accordingly.

    Thank you,

    Kent