Creating Item with BOI - VBScript - CI_ItemCode_bus

I need to create an item using BOI in Sage 100 Premium , and I'm leveraging existing code that works for Standard and Advanced editions. However, the VBScript for creating a new item is failing on this line:

Set oCIItemCode = oScript.NewObject("CI_ItemCode_bus", oSS)

The error message indicates the reason for this is that the W/O module cannot be found; unfortunately, the license I'm working with doesn't include that module with Premium. My question, consequently, is why does creating a new ItemCode business object dependent on the W/O module, and is there a way to work around this?

Thanks

Parents
  • 0

    Greetings,

    Creating a new item should not require the W/O Module.  Can you post back with the version of Sage 100 Premium that you are using and the full script that is being executed.

    Thank you,

    Kent

  • 0 in reply to Kent Mackall

    The version is Sage 100 ERP Premium Version 5.10.0.1

    Here's the script:

    Set oScript = CreateObject ("ProvideX.Script")

    oScript.Init("C:\\Sage\\Sage 100 Premium ERP\\MAS90\\Home")

    Set oss = oScript.NewObject("SY_SESSION")

    retVAL = oSS.nLogon()

    If retVAL = 0 Then

       retVAL = oSS.nSetUser("****","****")

    End If

    If retVAL = 0 Then

       WScript.Echo("0|Login failed")

       oSS.nCleanup()

       oSS.DropObject()

       Set oSS = Nothing    

       WScript.Quit

    End If

    retVal = oSS.nSetCompany("001")

    If retVAL = 0 Then

       WScript.Echo("0|Failed to set company")

       oSS.nCleanup()

       oSS.DropObject()

       Set oSS = Nothing    

       WScript.Quit

    End If

    retVal = oSS.nSetDate("C/I","20141119")

    retVal = oss.nSetModule("C/I")

    retVal = oss.nSetProgram(oss.nLookupTask("CI_ItemCode_UI"))

    Set oCIItemCode = oScript.NewObject("CI_ItemCode_bus", oSS)  <---  line of code failling

    MsgBox(oSS.sLastErrorMsg)

    retVal = oCIItemCode.nSetKey("133455789")

    retVal = oCIItemCode.nSetValue("ItemCodeDesc$","Advance Maxi")

    retVal = oCIItemCode.nSetValue("ItemType$","1")

    retVal = oCIItemCode.nSetValue("SalesUnitOfMeasure$","")

    retVal = oCIItemCode.nSetValue("PurchaseUnitOfMeasure$","")

    retVal = oCIItemCode.nSetValue("StandardUnitOfMeasure$","")

    retVal = oCIItemCode.nSetValue("TaxClass$","NT")

    retVal = oCIItemCode.nSetValue("PurchasesTaxClass$","NT")

    retVal = oCIItemCode.nSetValue("ProductType$","F")

    retVal = oCIItemCode.nSetValue("ProductLine$","ITEM")

    retVal = oCIItemCode.nSetValue("Valuation$", "1")

    retVal = oCIItemCode.nSetValue("CommentText$","")

    retVal = oCIItemCode.nSetValue("ShipWeight$","")

    retVal = oCIItemCode.nSetValue("ImageFile$","")

    retVal = oCIItemCode.nSetValue("StandardUnitCost",0)

    retVal = oCIItemCode.nSetValue("StandardUnitPrice",10.00000)

    retVal = oCIItemCode.nSetValue("SuggestedRetailPrice",0)

    retVal = oCIItemCode.nSetValue("PrimaryVendorNo$", "")

    retVal = oCIItemCode.nSetValue("DropShip$", "Y")

    retVal = oCIItemCode.nSetValue("InactiveItem$", "N")

    oCIItemCode.sExtDescriptionText = ""

    retVal = oCIItemCode.nWrite()

    If retVal = 0 Then

     WScript.Echo("0|Failed to insert item (CI_ItemCode_bus)")

     oCIItemCode.DropObject()

     oSS.nCleanup()

     oSS.DropObject()

     Set oCIItemCode = Nothing

     Set oSS = Nothing

     Set oScript = Nothing

     WScript.Quit

    End If

    oCIItemCode.DropObject()

    Set oCIItemCode = Nothing

    errCode = 1

    errMsg = ""

    Set oIMItemWarehouse = oScript.NewObject("IM_ItemWarehouse_bus", oSS)

    retVal = oIMItemWarehouse.nSetKeyValue("ItemCode$", "133455789")

    retVal = oIMItemWarehouse.nSetKeyValue("WarehouseCode$", "")

    retVal = oIMItemWarehouse.nSetKey()

    retVal = oIMItemWarehouse.nSetValue("ReorderPointQty", 0)

    retVal = oIMItemWarehouse.nWrite()

    oIMItemWarehouse.DropObject()

    Set oIMItemWarehouse = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Failed to set warehouse re-order point (IM_ItemWarehouse_bus)"

    End If

    Set oIMTransaction = oScript.NewObject("IM_Transaction_bus", oSS)

    retVal = oIMTransaction.nSetValue("TransactionType$","6")

    strEntryNo = ""

    retVal = oIMTransaction.nGetNextEntryNo(strEntryNo)

    retVal = oIMTransaction.nSetKeyValue("EntryNo$", strEntryNo)

    retVal = oIMTransaction.nSetKey()

    retVal = oIMTransaction.nSetValue("TransactionDate$","20141119")

    retVal = oIMTransaction.nSetValue("DefaultFromWhseCode$", "000")

    retVal = oIMTransaction.nSetValue("Comment$", "nChannel")

    retVal = oIMTransaction.oLines.nAddLine()

    retVal = oIMTransaction.oLines.nSetValue("ItemCode$", "133455789")

    retVal = oIMTransaction.oLines.nSetValue("WarehouseCode$", "")

    retVal = oIMTransaction.oLines.nSetValue("TransactionQty", 20.00000)

    retVal = oIMTransaction.oLines.nWrite()

    retVal = oIMTransaction.nWrite()

    oIMTransaction.DropObject()

    Set oIMTransaction = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Inventory adjustment transactions failed (IM_Transaction_bus)"

    End If

    Set oIMTransactionRegister = oScript.NewObject("IM_TransactionRegister_upd", oSS)

    retVal = oIMTransactionRegister.nUpdateInit()

    retVal = oIMTransactionRegister.nUpdateMain()

    retVal = oIMTransactionRegister.nUpdateCleanup()

    oIMTransactionRegister.DropObject()

    Set oIMTransactionRegister = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Register inventory adjustment transactions failed (IM_TransactionRegister_upd)"

    End If

    Set oAPVendor = oScript.NewObject("AP_Vendor_bus", oSS)

    retVal = oAPVendor.nSetKeyValue("APDivisionNo$", "")

    retVal = oAPVendor.nSetKeyValue("VendorNo$", "")

    retVal = oAPVendor.nSetKey()

    retVal = oAPVendor.nSetValue("VendorName$", "Affinity")

    retVal = oAPVendor.nSetValue("PrimaryContact$", "")

    retVal = oAPVendor.nSetValue("AddressLine1$", "")

    retVal = oAPVendor.nSetValue("AddressLine1$", "")

    retVal = oAPVendor.nSetValue("City$", "")

    retVal = oAPVendor.nSetValue("State$", "")

    retVal = oAPVendor.nSetValue("ZipCode$", "")

    retVal = oAPVendor.nSetValue("EmailAddress$", "")

    retVal = oAPVendor.nSetValue("TelephoneNo$", "")

    retVal = oAPVendor.nSetValue("FaxNo$", "")

    retVal = oAPVendor.nWrite()

    oAPVendor.DropObject()

    Set oAPVendor = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Vendor insert/update failed (AP_Vendor_bus)"

    End If

    Set oIMItemVendor = oScript.NewObject("IM_ItemVendor_bus", oSS)

    retVal = oIMItemVendor.nSetKeyValue("ItemCode$", "133455789")

    retVal = oIMItemVendor.nSetKeyValue("APDivisionNo$", "")

    retVal = oIMItemVendor.nSetKeyValue("VendorNo$", "")

    retVal = oIMItemVendor.nSetKey()

    retVal = oIMItemVendor.nSetValue("VendorAliasItemNo$", "")

       retVal = oIMItemVendor.nSetValue("LastUnitCost", 0)

    retVal = oIMItemVendor.nWrite()

    oIMItemVendor.DropObject()

    Set oIMItemVendor = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Item vendor insert/update failed (IM_ItemVendor_bus)"

    End If

    WScript.Echo(errCode & errMsg)

    oSS.nCleanup()

    oSS.DropObject()

    Set oss = Nothing

    Set oScript = Nothing

    WScript.Quit

Reply
  • 0 in reply to Kent Mackall

    The version is Sage 100 ERP Premium Version 5.10.0.1

    Here's the script:

    Set oScript = CreateObject ("ProvideX.Script")

    oScript.Init("C:\\Sage\\Sage 100 Premium ERP\\MAS90\\Home")

    Set oss = oScript.NewObject("SY_SESSION")

    retVAL = oSS.nLogon()

    If retVAL = 0 Then

       retVAL = oSS.nSetUser("****","****")

    End If

    If retVAL = 0 Then

       WScript.Echo("0|Login failed")

       oSS.nCleanup()

       oSS.DropObject()

       Set oSS = Nothing    

       WScript.Quit

    End If

    retVal = oSS.nSetCompany("001")

    If retVAL = 0 Then

       WScript.Echo("0|Failed to set company")

       oSS.nCleanup()

       oSS.DropObject()

       Set oSS = Nothing    

       WScript.Quit

    End If

    retVal = oSS.nSetDate("C/I","20141119")

    retVal = oss.nSetModule("C/I")

    retVal = oss.nSetProgram(oss.nLookupTask("CI_ItemCode_UI"))

    Set oCIItemCode = oScript.NewObject("CI_ItemCode_bus", oSS)  <---  line of code failling

    MsgBox(oSS.sLastErrorMsg)

    retVal = oCIItemCode.nSetKey("133455789")

    retVal = oCIItemCode.nSetValue("ItemCodeDesc$","Advance Maxi")

    retVal = oCIItemCode.nSetValue("ItemType$","1")

    retVal = oCIItemCode.nSetValue("SalesUnitOfMeasure$","")

    retVal = oCIItemCode.nSetValue("PurchaseUnitOfMeasure$","")

    retVal = oCIItemCode.nSetValue("StandardUnitOfMeasure$","")

    retVal = oCIItemCode.nSetValue("TaxClass$","NT")

    retVal = oCIItemCode.nSetValue("PurchasesTaxClass$","NT")

    retVal = oCIItemCode.nSetValue("ProductType$","F")

    retVal = oCIItemCode.nSetValue("ProductLine$","ITEM")

    retVal = oCIItemCode.nSetValue("Valuation$", "1")

    retVal = oCIItemCode.nSetValue("CommentText$","")

    retVal = oCIItemCode.nSetValue("ShipWeight$","")

    retVal = oCIItemCode.nSetValue("ImageFile$","")

    retVal = oCIItemCode.nSetValue("StandardUnitCost",0)

    retVal = oCIItemCode.nSetValue("StandardUnitPrice",10.00000)

    retVal = oCIItemCode.nSetValue("SuggestedRetailPrice",0)

    retVal = oCIItemCode.nSetValue("PrimaryVendorNo$", "")

    retVal = oCIItemCode.nSetValue("DropShip$", "Y")

    retVal = oCIItemCode.nSetValue("InactiveItem$", "N")

    oCIItemCode.sExtDescriptionText = ""

    retVal = oCIItemCode.nWrite()

    If retVal = 0 Then

     WScript.Echo("0|Failed to insert item (CI_ItemCode_bus)")

     oCIItemCode.DropObject()

     oSS.nCleanup()

     oSS.DropObject()

     Set oCIItemCode = Nothing

     Set oSS = Nothing

     Set oScript = Nothing

     WScript.Quit

    End If

    oCIItemCode.DropObject()

    Set oCIItemCode = Nothing

    errCode = 1

    errMsg = ""

    Set oIMItemWarehouse = oScript.NewObject("IM_ItemWarehouse_bus", oSS)

    retVal = oIMItemWarehouse.nSetKeyValue("ItemCode$", "133455789")

    retVal = oIMItemWarehouse.nSetKeyValue("WarehouseCode$", "")

    retVal = oIMItemWarehouse.nSetKey()

    retVal = oIMItemWarehouse.nSetValue("ReorderPointQty", 0)

    retVal = oIMItemWarehouse.nWrite()

    oIMItemWarehouse.DropObject()

    Set oIMItemWarehouse = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Failed to set warehouse re-order point (IM_ItemWarehouse_bus)"

    End If

    Set oIMTransaction = oScript.NewObject("IM_Transaction_bus", oSS)

    retVal = oIMTransaction.nSetValue("TransactionType$","6")

    strEntryNo = ""

    retVal = oIMTransaction.nGetNextEntryNo(strEntryNo)

    retVal = oIMTransaction.nSetKeyValue("EntryNo$", strEntryNo)

    retVal = oIMTransaction.nSetKey()

    retVal = oIMTransaction.nSetValue("TransactionDate$","20141119")

    retVal = oIMTransaction.nSetValue("DefaultFromWhseCode$", "000")

    retVal = oIMTransaction.nSetValue("Comment$", "nChannel")

    retVal = oIMTransaction.oLines.nAddLine()

    retVal = oIMTransaction.oLines.nSetValue("ItemCode$", "133455789")

    retVal = oIMTransaction.oLines.nSetValue("WarehouseCode$", "")

    retVal = oIMTransaction.oLines.nSetValue("TransactionQty", 20.00000)

    retVal = oIMTransaction.oLines.nWrite()

    retVal = oIMTransaction.nWrite()

    oIMTransaction.DropObject()

    Set oIMTransaction = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Inventory adjustment transactions failed (IM_Transaction_bus)"

    End If

    Set oIMTransactionRegister = oScript.NewObject("IM_TransactionRegister_upd", oSS)

    retVal = oIMTransactionRegister.nUpdateInit()

    retVal = oIMTransactionRegister.nUpdateMain()

    retVal = oIMTransactionRegister.nUpdateCleanup()

    oIMTransactionRegister.DropObject()

    Set oIMTransactionRegister = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Register inventory adjustment transactions failed (IM_TransactionRegister_upd)"

    End If

    Set oAPVendor = oScript.NewObject("AP_Vendor_bus", oSS)

    retVal = oAPVendor.nSetKeyValue("APDivisionNo$", "")

    retVal = oAPVendor.nSetKeyValue("VendorNo$", "")

    retVal = oAPVendor.nSetKey()

    retVal = oAPVendor.nSetValue("VendorName$", "Affinity")

    retVal = oAPVendor.nSetValue("PrimaryContact$", "")

    retVal = oAPVendor.nSetValue("AddressLine1$", "")

    retVal = oAPVendor.nSetValue("AddressLine1$", "")

    retVal = oAPVendor.nSetValue("City$", "")

    retVal = oAPVendor.nSetValue("State$", "")

    retVal = oAPVendor.nSetValue("ZipCode$", "")

    retVal = oAPVendor.nSetValue("EmailAddress$", "")

    retVal = oAPVendor.nSetValue("TelephoneNo$", "")

    retVal = oAPVendor.nSetValue("FaxNo$", "")

    retVal = oAPVendor.nWrite()

    oAPVendor.DropObject()

    Set oAPVendor = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Vendor insert/update failed (AP_Vendor_bus)"

    End If

    Set oIMItemVendor = oScript.NewObject("IM_ItemVendor_bus", oSS)

    retVal = oIMItemVendor.nSetKeyValue("ItemCode$", "133455789")

    retVal = oIMItemVendor.nSetKeyValue("APDivisionNo$", "")

    retVal = oIMItemVendor.nSetKeyValue("VendorNo$", "")

    retVal = oIMItemVendor.nSetKey()

    retVal = oIMItemVendor.nSetValue("VendorAliasItemNo$", "")

       retVal = oIMItemVendor.nSetValue("LastUnitCost", 0)

    retVal = oIMItemVendor.nWrite()

    oIMItemVendor.DropObject()

    Set oIMItemVendor = Nothing

    If Not retVal = 1 Then

     errCode = 2

     errMsg = errMsg & "|Item vendor insert/update failed (IM_ItemVendor_bus)"

    End If

    WScript.Echo(errCode & errMsg)

    oSS.nCleanup()

    oSS.DropObject()

    Set oss = Nothing

    Set oScript = Nothing

    WScript.Quit

Children
  • 0 in reply to trobinson

    Greetings,

    I don't see anything out of the ordinary with this script around the point of failure.  Do you know if there are any 3rd party enhancements on this system?  Was this installation a clean install or are you using data that was converted/migrated from a previous version?  While there should not be a W/O Module in Sage 100 Premium, check the SY_Module table to be sure that there isn't a W/O Module record.  Also, check the MAS90 folder to make sure there isn't a WO folder.

    If all of that checks out OK, then you should open a case with Sage 100 Customer Support so that they can get copies of your script and data in order to try and duplicate the issue and figure out what is happening.

    Thank you,

    Kent

  • 0 in reply to trobinson
    Did you resolve this...happen to remember what the issue was in your code.

    Set oCIItemCode = oScript.NewObject("CI_ItemCode_bus", oSS) <--- line of code failling

    I get the same error 'W/O' module when creating the object.

    I also have an errors with the session and script objects indicating I can't use
    the object unless I'm in an online environment.

    Thanks in advance for comments