Sage 100

 View Only
  • 1.  PVX Scripting

    Posted 06-20-2019 15:02
    I have a script that reads a spreadsheet and creates Sales Orders.  Usual kind of data in the sheet, customer, date, PO numbers, Item Codes, Qty, Price ...  Works just fine.  Now I have been asked to adapt it to use Alias Item Numbers instead of the usual Item Codes and I am not having much luck.... Has anyone worked this out?  TIA - Randy

    ------------------------------
    Randy Marion
    ------------------------------


  • 2.  RE: PVX Scripting

    Posted 06-20-2019 15:09
    Shouldn't the business object take an Alias value into the ItemCode field and auto-translate that into the correct Item?

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



  • 3.  RE: PVX Scripting

    Posted 06-20-2019 15:11
    I just built 2 VI jobs that both read the Alias and converts to the Item Code in SO Invoice.  I had the Item Code field read the Alias Item Column (in the source file) and it brought in the Item Code itself.

    Worked Great!

    ------------------------------
    Nancy Hanson
    Blytheco LLC
    Eagan MN
    ------------------------------



  • 4.  RE: PVX Scripting

    Posted 06-20-2019 15:35
    @Nancy Hanson & @Kevin Moyes. -- I tried setting the detail value of both the ItemCode and the AliasItemCode (separate testings of course), thinking the method would figure it out, but alas, it does not seem to work that way...  Was wondering it there was an Alias object that I needed...  Nice to know that VI does this though... If they can do it, I just need to figure it out.

    Thanks, Randy​​

    ------------------------------
    Randy Marion
    ------------------------------



  • 5.  RE: PVX Scripting

    Posted 06-20-2019 21:56
    I am assuming these are the customer alias numbers??  Or is it the general alias?

    ------------------------------
    Jeff Schwenk
    FORMER 90M Board Member
    Bottomline Software, Inc.
    Waynesboro VA
    540-221-4444
    ------------------------------



  • 6.  RE: PVX Scripting

    Posted 06-24-2019 14:40
    These are General alias numbers...

    ------------------------------
    Randy Marion
    ------------------------------



  • 7.  RE: PVX Scripting

    Posted 06-24-2019 17:24
    Edited by Jim Woodhead 06-24-2019 17:24
    Let me know if you want to share.  A customer today ask me for exactly the same thing?  What are the chances?

    ------------------------------
    Jim Woodhead
    DSD Business Systems
    619-990-3946
    ------------------------------



  • 8.  RE: PVX Scripting

    Posted 06-25-2019 10:02
    As is always the case, the client wants the solution immediately... what is new?  So, I am putting the finishing touches on a VI job to complete this task.  Once they are happy, I will return to this hopefully find a solution... When that happens, I will post ---  Thanks to everyone - Randy

    ------------------------------
    Randy Marion
    ------------------------------



  • 9.  RE: PVX Scripting

    Posted 06-26-2019 11:22
    Edited by Randy Marion 06-26-2019 11:23
    @Jim Woodhead - I have discovered that there exists an Alias Item service object that can be used to find the parent item numbers...  I adapted an example vbs script to test my theory - seems to work, at least for general aliases....

    ' Example - Sales Order Entry w/ Alias lookup for itemcode

    Function retChk(ret,sender)
    if ret = 0 then
    msgbox (sender.s_CLASS & " : " & sender.sLastErrorMsg)
    sender.DropObject()
    oss.nCleanup()
    oSS.DropObject()
    Set sender = Nothing
    Set oSS = Nothing
    Set oPVX = Nothing
    WScript.quit
    End If
    retChk = ret
    End Function

    'Get the ODBC path for the last accessed installation of MAS 90/200
    Const HKEY_CURRENT_USER = &H80000001
    Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
    oReg.GetExpandedStringValue HKEY_CURRENT_USER,"Software\ODBC\ODBC.INI\SOTAMAS90","Directory",PathRoot
    PathHome = PathRoot & "\Home"
    Set oReg = Nothing

    'Create ProvideX COM Object
    Set oPVX = CreateObject ("ProvideX.Script")

    'The Init method must be the first method called, and requires the path to the MAS90 home directory
    oPVX.Init(PathHome)

    'Create and Initialize Session Object
    Set oSS = oPVX.NewObject("Sy_Session")

    ' Obviously use your own credentials, company code, customer and the like....
    retVal = oSS.nSetUser("", "")
    retVal = oSS.nSetCompany("019")

    retval = oSS.nSetDate("S/O","20190626")
    oSS.nSetModule("S/O")

    TaskID = oSS.nLookupTask("SO_SalesOrder_ui")
    oSS.nSetProgram(TaskID)
    Set oSOOrder = oPVX.NewObject("SO_SalesOrder_bus",oSS)
    ' Create Alias Service Obj
    Set oIM_Alias_svc = oPVX.NewObject("IM_AliasItem_svc", oSS)

    OrderNo = ""
    Call retChk(oSOOrder.nGetNextSalesOrderNo(OrderNo), oSOOrder)
    Call retChk(oSOOrder.nSetKeyValue("SalesOrderNo$", OrderNo), oSOOrder)
    Call retChk(oSOOrder.nSetKey(), oSOOrder)
    Call retChk(oSOOrder.nSetValue("ARDivisionNo$", "00"), oSOOrder)
    Call retChk(oSOOrder.nSetValue("CustomerNo$", "0000275"), oSOOrder)
    Call retChk(oSOOrder.nSetValue("CustomerPONo$", "Test Cust PO"), oSOOrder)

    ' Create a new line for the GL-MD750 item and write to memory file
    ' Overriding the WarehouseCode$ so the serial number used in this example is available
    ' When the value of QuantityOrdered is set, the return value will
    Call retChk(oSOOrder.oLines.nAddline(), oSOOrder.oLines)
    ' In this case, we know the General Alias, but not the actual ItemCode - use the svc obj to look it up
    ItemCd = ""
    AliasCd = "LA66209"
    Call retChk(oIM_Alias_svc.nFindItem(AliasCd, ItemCd), oSOOrder.oLines)

    msgbox ("Alias Svc Returned: " & ItemCd )

    Call retChk(oSOOrder.oLines.nSetValue("ItemCode$",ItemCd), oSOOrder.oLines)
    Call retChk(oSOOrder.oLines.nSetValue("WarehouseCode$", "000"), oSOOrder.oLines)
    Call retChk(oSOOrder.oLines.nSetValue("QuantityOrdered", 2), oSOOrder.oLines)
    Call retChk(oSOOrder.oLines.nWrite(), oSOOrder.oLines)

    Call retChk(oSOOrder.oLines.nAddline(), oSOOrder.oLines)
    ItemCd = ""
    AliasCd = "AC060506"
    Call retChk(oIM_Alias_svc.nFindItem(AliasCd, ItemCd), oSOOrder.oLines)

    msgbox ("Alias Svc Returned: " & ItemCd )

    Call retChk(oSOOrder.oLines.nSetValue("ItemCode$",ItemCd), oSOOrder.oLines)
    Call retChk(oSOOrder.oLines.nSetValue("QuantityOrdered", 1), oSOOrder.oLines)
    Call retChk(oSOOrder.oLines.nWrite(), oSOOrder.oLines)

    Call retChk(oSOOrder.nWrite(), oSOOrder)

    msgbox ("End - Alias Example - Order: " & OrderNo & " created")

    ------------------------------
    Randy Marion
    ------------------------------