printing a sales order using BOI

SUGGESTED

Hi Forum,

I am trying to create a BOI script to print a sales order.

i cannot go pass the following code:

Set soPRINT = oScript.NewObject("SO_SalesOrderPrinting_rpt", oss)

The code is from a script that i found on the forum and when i run it i get  and error message...

<NewObject error: 200>   

Code: 80020009

Source: ProvideX.Script.1

I am browsing the Internet and i cannot find an answer to the error.

Any suggestions?..

Regards,

Manuel Roman

Parents
  • 0
    SUGGESTED

    If you are using this in a BOI script that is triggered with a Sage event, I believe you want to use oSesson instead of oScript and get the object:

    Set soPrint = oSession.AsObject(oSession.GetObject("SO_SalesOrderPrinting_rpt"))

    retVal = soPRINT.SelectReportSetting("CUSTOM")    'put your report setting here, otherwise STANDARD will be printed

    soPRINT.QuickPrint = soNo

    retVal = soPRINT.ProcessReport("PRINT")
    if retVal = 0 then
    retval = msgbox(soPRINT.LastErrorMsg)
    end if

Reply
  • 0
    SUGGESTED

    If you are using this in a BOI script that is triggered with a Sage event, I believe you want to use oSesson instead of oScript and get the object:

    Set soPrint = oSession.AsObject(oSession.GetObject("SO_SalesOrderPrinting_rpt"))

    retVal = soPRINT.SelectReportSetting("CUSTOM")    'put your report setting here, otherwise STANDARD will be printed

    soPRINT.QuickPrint = soNo

    retVal = soPRINT.ProcessReport("PRINT")
    if retVal = 0 then
    retval = msgbox(soPRINT.LastErrorMsg)
    end if

Children
  • 0 in reply to hyanaga

    Hi, thanks for responding.

    This is what i have at the top of the script...

    Set oscript = CreateObject("ProvideX.Script")
    oscript.Init ("C:\Sage Software\MAS 90\Version4\MAS90\Home\")
    Set oss = oscript.NewObject("SY_SESSION")
    I've used oss, oscript, oSession and nothing works.
    Regards,
    Manuel Roman