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 Reply Children
  • 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 Kent Mackall

    Kent,

    This is to print a custom report that happens to be called customer statement report.  My intent is to fire a custom crystal report from a button.  I know I've been able to do this before.

  • 0 in reply to dlevasseur

    Dan,

    I was jsut getting back into this issue after realizing that SY_ReportRuntime_UI is the default UI class used when a custom Business Insights Report is added to the menu.  I had forgotten that.  

    In any case, I was about to retest when I saw this post which looks like it has the infomration you need as well:

    sagecity.na.sage.com/.../75104.aspx

    Please let me know if this helps resolve the issue for you.

    Thanks,

    Kent Mackall

  • 0 in reply to Kent Mackall

    I basically adapted his entire script to my module and report but the loadreport comesback as 0 failed.

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

    hBIR = oSession.GetObject ("SY_ReportRuntime_rpt")

    If hBIR = 0 Then

     msgbox("Failed")

    End If

    Set oBIR = oSession.AsObject(hBIR)

    sCompanyKey = oSession.CompanyKey

    sUserKey = oSession.UserKey  

    sReportFile = ""

    tmp = oBIR.LoadReport("Customer Statement Report","AR",sCompanyKey,sUserKey, sReportFile)

    msgbox tmp <-- Comes Back as 0

    retVal = oBIR.ProcessReport("preview")

  • 0 in reply to dlevasseur

    Greetings,

    Try changing the LoadReport to something like:

    tmp = oBIR.LoadReport("TEST","STANDARD","AR",sCompanyKey,sUserKey, sReportFile)

    You may also want to declare tmp as string because Load Report returns a string which should be the name of the report.  In this case, that is 'TEST'.  It also sets sReportFile to be the actual .rpt file for the report.

    Thanks,

    Kent Mackall

  • 0 in reply to Kent Mackall

    Sorry.  There was an error in my copy/paste.  What you have, is exactly how I have the LoadReport.  Assigning tmp = "" didn't help.  Since the LoadReport fails, sReportFile is not being populated.

  • 0 in reply to dlevasseur

    Does sReportFile bring back just the file name, or does it include the path?  Could I just set the sReportFile value?

  • 0 in reply to dlevasseur

    Oh.  And I'm running this from a button script, not a UDS, which could be the problem I guess?

  • 0 in reply to dlevasseur

    It brings back the path and filename.  You can't set it becasue it is read in from a file based on the report name you pass in.  I haven't tried it from a button script.  I will try that when I get a chance.

    Thanks,

    Kent Mackall

  • 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")