Sage 100

 View Only
Expand all | Collapse all

Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

  • 1.  Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-10-2024 16:48

    I recently upgraded a client from 2020 Standard to 2024 Advanced with 64 Bit.

    The following was a button script that was running successfully on the old version, but fails in the new one.

    Changes that may be impacting this. new Sage, new Crystal Version, upgrade to Advanced, or 64 Bit.

    The button script was on Sales Order Entry and just previewed a Crystal Report for the selected customer that was in Sales Order Entry.

    In the new version, it is erroring out on this line.

    OLE Error Number : 424
    Description : Object required: 'oSession'
    Language : VBScript

    Set oReportEngine=oSession.ASObject(oSession.NewObject("Sy_ReportEngine"))

    Any suggestions would be appreciated.

    Thank you,

    Michael

    Full Script

    Set oReportEngine=oSession.ASObject(oSession.NewObject("Sy_ReportEngine"))

    'Open the report at the location in which it is stored
    reportname="OpenSO_CUSTOM.rpt"
    retval=oReportEngine.OpenReport(oSession.pathRoot + "Reports\"+Reportname)

    'Grab the DivisionNo and Customer
    ARDiv=""
    ARCustomer=""
    SalesOrderNo=""

    retval=oBusObj.GetValue("ARDivisionNo",ARDiv)
    retval=oBusObj.GetValue("CustomerNo",ARCustomer)

    'use the selection criteria (similar to a Where clause)
    retval=oReportEngine.SetSelectionFormula("{SO_SalesOrderHeader.ARDivisionNo}="+ARDiv)
    retval=oReportEngine.SetSelectionFormula("{SO_SalesOrderHeader.CustomerNo}="+ARCustomer)

    'Preview your report
    retval=oReportEngine.Databaselogon()
    retval=oReportEngine.Preview()

    #scripting



    ------------------------------
    Michael Davis
    Warren Averett Technology Group
    ------------------------------


  • 2.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-10-2024 17:56

    Often an "object required" error is caused by the Allow External Access flag not being clicked on in Company Maintenance.



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 3.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-10-2024 18:10

    Is always good to check the basics. The box for external access is checked.

     

    Any other ideas?

     

    Thank you

    Michael

     

     

    Michael  H . Davis

    CPA.CITP, MCSE

    Senior Consultant

    Michael.Davis@warrenaverett.com

    (D) 

    205.313.4734

    (O) 

    205.313.4700   

    (F) 

    205.592.9991

    2500 Acton Road, Birmingham, AL 35243

    Ranked as one of the top managed service providers (MSP)
    and managed security service providers (MSSP) 
    in the world several years in a row. 

     

     

     

    To contact our Software Support Team call 844.712.6223 or email software@warrenaverett.com.
    To contact our Technical Services Team call 888.419.9090 or email resource.center@warrenaverett.com

    Confidentiality Notice: This email and any attachments may contain confidential and privileged information intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient, please delete this message and notify the sender immediately. Thank you.

     






  • 4.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-10-2024 18:15

    I don't know the reporting objects at all.  The only suggestion I have is to separate out your object creation into two pieces like this (which includes a permission check).

    oBankCode = oSession.GetObject("GL_Bank_bus")

    if oBankCode <> 0 then

            Set oBankCode = oSession.AsObject(oBankCode)

    else        

            retVal = oSession.AsObject(oSession.UI).MessageBox("", "Access to GL_Bank_bus is required for the ... script to work.")

            exit sub

    end if



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 5.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-11-2024 01:11

    The following works for me on a 64-bit installation of 2023.  The LastErrorMsg and LastErrorNum properties of oSession may or may not contain useful information as they hold both errors and warnings.  They get overwritten throughout various methods too so you want to reset them before your method that may generate an error (can optionally check and store off the values prior to resetting them too) and then check them after your method that may generate an error.

    If the nSY_ReportEngine variable comes back as a 0, then something in the ON_CREATE block of code of the SY_ReportEngine class is causing it to fail.  I would try a clean uninstall of the Sage 100 workstation, the 32 and 64-bit crystal runtimes, reboot, perform a clean install of the workstation (which should also install the crystal runtimes), and test the script again.

    nSY_ReportEngine = 0 : oSession.LastErrorNum = "" : oSession.LastErrorMsg = "" : nSY_ReportEngine = oSession.NewObject("SY_ReportEngine")
    oSession.AsObject(oSession.UI).MessageBox "nSY_ReportEngine: " & nSY_ReportEngine & vbCrLf & "oSession.LastErrorNum: " & oSession.LastErrorNum & vbCrLf & "oSession.LastErrorMsg: " & oSession.LastErrorMsg
    oSession.DropObject nSY_ReportEngine
    nSY_ReportEngine = 0


    ------------------------------
    David Speck II
    Blytheco LLC
    ------------------------------



  • 6.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-11-2024 06:43

    I don't have any input to assist with fixing this, but the subject line intrigues me.

     

    Would it be possible to launch a standard report that uses a worktable with a BOI script outside of Sage?  We occasionally (often) have requests to automate and email reports on the Sage 100 menu. We typically create a custom crystal report that doesn't need a worktable and use Visual Cut or Sage Alerts to run and email them.

     

     

     

    David Overholt

    DWD Technology Group, Inc.

    9921 Dupont Circle Drive West, Suite 300 | Fort Wayne, IN 46825

    260.423.2414 main

    260.399.8655 Direct

    800.232.8913 toll free

    sagesupport@dwdtechgroup.com

    www.dwdtechgroup.com

     

    A black background with white text  Description automatically generated

     






  • 7.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-11-2024 07:47

    @David Overholt, yes, for example, I've used a BOI script to Print Preview all the module Setup Options and Trial Balance reports so that I could easily print them to PDF before running an upgrade. But, ironically, I prefer creating and using the custom reports, especially on Premium....



    ------------------------------
    Steve Iwanowski, NextStep Technology Advisors, aka DSD Lancaster PA ¯\_(ツ)_/¯
    ------------------------------



  • 8.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-11-2024 07:51

    Thanks Steve,

    Just knowing that it is an option might open a whole new world of possibilities that I never considered

     

     

     

    David Overholt

    DWD Technology Group, Inc.

    9921 Dupont Circle Drive West, Suite 300 | Fort Wayne, IN 46825

    260.423.2414 main

    260.399.8655 Direct

    800.232.8913 toll free

    sagesupport@dwdtechgroup.com

    www.dwdtechgroup.com

     

    A black background with white text  Description automatically generated

     






  • 9.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-28-2024 14:54

    I have been some more testing on the script program. Once I deleted the C.O Button Link on the Sales Order Screen, and re-added it with the setting to "Execute Script on Server".  It works when I am on the server as the domain administrator user. 

    On the clients' machine, nothing happens. No more script errors, but not report either. It does work in MAS90 mode. 

    The service account is setup to run as Domain\Administrator.

    Also with setting "Execute Script on Client" - I get the above error messages.

    Any suggestions will be appreciated.

    Thank you

    Michael



    ------------------------------
    Michael Davis
    Warren Averett Technology Group
    ------------------------------



  • 10.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-28-2024 15:07

    It works in MAS90 Mode from the client but not Advanced?  What path is being returned for the path root?

    retMSG = oSession.AsObject(oSession.UI).MessageBox("", oSession.pathRoot)



    ------------------------------
    Steve Iwanowski, NextStep Technology Advisors, aka DSD Lancaster PA ¯\_(ツ)_/¯
    ------------------------------



  • 11.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-28-2024 15:30

    That was it. 

    The oSession.pathRoot was pointing to the C drive.

    I change to script to point the UNC path of the server and removed the path root line. Everything is working from the client now. Thank you



    ------------------------------
    Michael Davis
    Warren Averett Technology Group
    ------------------------------



  • 12.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-29-2024 11:21

    You can check the oSession.CS property, if not equal to zero, use the oSession.PathCSRoot property instead of the oSession.PathRoot property.  This should make sure the script works flawlessly across different editions of Sage 100.



    ------------------------------
    David Speck II
    Blytheco LLC
    ------------------------------



  • 13.  RE: Launch Crystal Report Via Sage 100 Script 2024 and 64 Bit

    Posted 10-29-2024 11:25

    Michael it sounds like you want oSession.PathCSRoot. I run into this with regular programming too. A good way to test what you need to use is first check for oSession.CS. A value greater than 0 means you are on Advanced or Premium. This will make your script more reusable. Also, oSession.SQL tells you if you are on Premium. 



    ------------------------------
    Alnoor Cassim
    Accounting Systems, Inc. (ASI)
    ------------------------------