Sage 100 BOI Script to Create Inventory Transactions

SOLVED

I'm writing a BOI script to create Inventory Adjustment Transactions.  I want to use the next available entry number so I have the GetNextEntryNo(refNo$) function in my script.  What I can't figure out is what the "refNo$" needs to be.  Does anyone have a listing of the valid values?  I tried "6" but that doesn't work.  It returns a "0" to my variable.  Thanks.

Parents
  • 0

    Hello, how were you able to complete the transaction? I'm trying, but I always receive the error "The distribution is out of balance."

    using DispatchObject oLines = new(invTransactionEntry.GetProperty("oLines"));
    retVal = (int)oLines.InvokeMethod("nAddLine");
    string error2 = (string)oLines.GetProperty("sLastErrorMsg");
    retVal = (int)oLines.InvokeMethod("nSetValue", "ItemCode$", adjustment.ItemId);
    retVal = (int)oLines.InvokeMethod("nSetValue", "UnitOfMeasure$", adjustment.UomId);
    retVal = (int)oLines.InvokeMethod("nSetValue", "TransactionQty", adjustment.Quantity);
    retVal = (int)oLines.InvokeMethod("nWrite");
    string error5 = (string)oLines.GetProperty("sLastErrorMsg");
    retVal = (int)invTransactionEntry.InvokeMethod("nWrite");
  • 0 in reply to rcdev

    It looks like your item code is a lot/serial item.  You need to do lot/serial distribution.

Reply Children
  • 0 in reply to Natasha Chang

    How? Do you have any examples?"

    I'm trying this but now it's giving this error: 'You cannot set unless transaction type is sales or issues.'

    using DispatchObject oLines = new(invTransactionEntry.GetProperty("oLines"));

    using DispatchObject oDistribution = new(oLines.GetProperty("oDistribution"));

    retVal = (int)oDistribution.InvokeMethod("nSetValue", "TransactionQty", adjustment.Quantity);

    string error3 = (string)oDistribution.GetProperty("sLastErrorMsg");

    retVal = (int)oDistribution.InvokeMethod("nSetValue", "LotSerialFullyDistributed$", "Y");

    retVal = (int)oDistribution.InvokeMethod("nWrite"); string error4 = (string)oLines.GetProperty("sLastErrorMsg");

  • 0 in reply to rcdev

    This works for me.  The is ProvideX syntax but you get the idea.

    o = new("IM_Transaction_bus", %sys_ss)

    r = o'SetKeyValue("TransactionType$","6")
    r = o'SetKeyValue("EntryNo$","00000011")
    r = o'SetKey()
    if r = 2 {
          r = o'Lines'AddLine()
          r = o'Lines'SetValue("ItemCode$", "2480-8-50")
          r = o'Lines'SetValue("WarehouseCode$", "000")
          r = o'Lines'SetValue("TransactionQty", 1)
          r = o'Lines'Distribution'AddDistributionLine("101")
          r = o'Lines'Distribution'SetValue("TransactionQty", 1)
          r = o'Lines'Distribution'Write()
          r = o'Lines'Write()
          r = o'Write()
    }