Sage 100

 View Only
Expand all | Collapse all

For all #scripting experts (and novices, too) -- O

  • 1.  For all #scripting experts (and novices, too) -- O

    Posted 05-08-2012 09:58
    For all #scripting experts (and novices, too) -- On the Sage community there is a discussion about moving an entry from one batch to another (http://community.sagemas.com/t5/Business-Object-Interface/VerifyBatch-Method/td-p/43082/page/3). Is there an easier way, or do we just have to do it like this? My client wants to check inventory levels in B/M production, and if there is insufficient on-hand quantity, put the selected entry into a ""HOLD"" batch. I can change the ""BatchNo$"" value without any problems, but the batch totals don't get updated on the batch manager screen.


  • 2.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-08-2012 10:06
    I haven't tried this myself, but under the SY_BatchManager_BUS there is a ""VerifyBatch"" function.


  • 3.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-08-2012 11:00
    The VerifyBatch method is probably what needs to run, but I get errors when I use it. The LastErrorMsg is ""This entry already exists in batch HOLD."" Any thoughts?


  • 4.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-08-2012 11:07
    When I changed it to Verify the ""HOLD"" batch, it returned no error, but it didn't update the totals in the Batch Manager screen. I'm guessing that I'm going to have to use the method demonstrated on the community website.


  • 5.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-08-2012 12:01
    I've never relied on any batch totals other than a cash receipt batch, which seems to be the only batch function in MAS that verifies totals to detail. I tell clients not to trust batch totals. For some this is hard to do, but they get over it and realize since they don't enter an indpenedent batch total, the totals in MAS provide very little control over data entry.


  • 6.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-08-2012 12:26
    Changing minds is harder than changing software. Usually.


  • 7.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-08-2012 13:25
    People actually use the batch total amounts???? That is so 1980! Have them compare the batch total tape to the DTR update total.


  • 8.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-08-2012 13:58
    I suppose I should clarify -- the record count is off. Production Entry doesn't have batch totals, but it does have record counts, and that's what making them nervous.


  • 9.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-08-2012 23:04
    @AaronClark the Batch Manager UI actually uses the RepairBatch method when you click Verify (go figure). Here is my pvx code from SYZCON that is updating the record counts properly. I'm not showing you the scripting equivalent because I can't seem to remember late at night when you do a GetObject if you can pass more than just the oSession handle (I think you can). You can see here I also need the module code, batch type (01), and a numeric for data entry flag. coSession = %SYS_SS coSession'SetModule(""B/M"") tmpModCode$ = ""B/M"", tmpBatchType$ = ""01"", tmpDataEntry = 0, tmpBatchNo$ = ""HOLD"" oBatch = NEW(""SY_BATCHMANAGER_BUS"", coSession, tmpModCode$, tmpBatchType$, tmpDataEntry) retVal = oBatch'RepairBatch(tmpBatchNo$,1)


  • 10.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-09-2012 07:52
    @AlnoorCassim: I will give this a shot and let you know what happens. Thanks for the tip!


  • 11.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-09-2012 12:36
      |   view attached
    I get an error when I call the RepairBatch method. Relevant code is here below. I did test your code in SYZCON, and it worked just fine. Help? sBatch = ""HOLD"" Dim oPVX Set oPVX = CreateObject(""Providex.Script"") oPVX.Init(oSession.PathRoot) Set oSS = oPVX.NewObject(""SY_Session"") retVal = oSS.nLogon() retVal = oSS.nSetUser(""ajclark"","""") retVal = oSS.nSetCompany(""XYZ"") retVal = oSS.nSetModule(""B/M"") retVal = oSS.nSetProgram(oSS.nLookupTask(""BM_Production_UI"")) Set oBatch = oPVX.NewObject(""SY_BatchManager_bus"",oSS,""B/M"",""01"",0) retVal = oBatch.RepairBatch(sBatch,nRepaired)


  • 12.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-09-2012 12:47
    Have you have defined 'nRepaired' as 1 like Alnoor?


  • 13.  RE: For all #scripting experts (and novices, too) -- O

    Posted 05-09-2012 16:32
    I defined it before I started setting objects, but that just touched something off in my brain: Since I'm in VB, it's not RepairBatch(), it's nRepairBatch().... and it worked. Dim oPVX Set oPVX = CreateObject(""Providex.Script"") oPVX.Init(oSession.PathRoot) Set oSS = oPVX.NewObject(""SY_Session"") retVal = oSS.nLogon() retVal = oSS.nSetUser(""ajclark"","""") retVal = oSS.nSetCompany(oSession.CompanyCode) retVal = oSS.nSetModule(""B/M"") retVal = oSS.nSetProgram(oSS.nLookupTask(""BM_Production_UI"")) Set oBatch = oPVX.NewObject(""SY_BatchManager_bus"",oSS,""B/M"",""01"",0) retVal = oBatch.nRepairBatch(sBatch,nRepaired) retVal = oBatch.nRepairBatch(HOLD_BATCH,nRepaired) You guys rock! Thanks!