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

  • 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

  • 0
    SUGGESTED

    Manuel before the NewObject line, maybe you did not SetProgram with the LookupTask to the related rpt UI object. 

    oSS.nSetProgram(oSession.nLookupTask("SO_SalesOrderPrinting_UI"))

  • 0 in reply to Alnoor

    Hi Alnoor,

    I do have the statement in...

     oSEC = oss.nSetProgram(oSS.nLookupTask("SO_SalesOrderPrinting_UI"))

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

    Regards,

    Manuel Roman

  • 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
  • 0 in reply to mroman

    OK, 

    No luck... i tried both statements and got errors on both.  I am using the following....

    Set oscript = CreateObject("ProvideX.Script")
    oscript.Init ("C:\Sage Software\MAS 90\Version4\MAS90\Home\")

    Set oss = oscript.NewObject("SY_SESSION")

    retval = oss.nSetProgram(oss.nLookupTask("SO_SalesOrderPrinting_UI")) --> retval is = to 0

    'SET soPrint = oScript.NewObject("SO_SalesOrderPrinting_rpt", oss) --->> here i get <NEWOBJECT Error:200>
    Set soPrint = oss.AsObject(oss.GetObject("SO_SalesOrderPrinting_rpt", oss)) ---> Object doesn't support 'GetObject'

    Any suggestions ????

    Regards,

    Manuel Roman

  • 0 in reply to mroman

    I got the correct syntax, first of all i was using the wrong user code and password.

    that worked and was able to  to run the script except that i am getting "No Data selected for Printing message".

    i copied the script to try it on the customer with sage 100 2015 which is going to be update to 2017 next month and  now i am gong back to the same issues.

    retval = oss.nSetProgram(oss.nLookupTask("SO_SalesOrderPrinting_UI")) --> reval = 0

    I run the same script on 4.4 and works fine except the "Data not Selected" message....

    Do i need to use a different object in 2015?..

    Regards,

  • 0 in reply to mroman
    SUGGESTED

    Never mind ... it is working.

    i guess i need to pay more attention to what i need to set.

    The path was not the correct...

    Thanks for the input..

    Regards,

    Manuel Roman

  • 0 in reply to mroman

    Getting an error when printing the Sales Order.

    Prints once ok when printing another Order i gatting an Error that the Printer Doesn't have permissions.

    I can print an order thru Sage and when i try to print using the script prints fine the first order but fails on the second time.

    Regards,

    Manuel Roman