Scripting

  • 1.  I am using an external VB Script to add invoices t

    Posted 03-03-2015 11:21
    I am using an external VB Script to add invoices to an A/P invoice batch. My customer is able to post this batch at the same time i am adding new invoices to it. I am not getting any indication from retVal when I SelectBatch() or write(). I am looking for a method to tell me the batch is not in use before I proceed. There is a object called SY_BatchManager_Bus, but i can't open it ( tring to use Sy_BatchManagerSelect_UI). Any suggestions?


  • 2.  RE: I am using an external VB Script to add invoices t

    Posted 03-03-2015 11:40
    Doug, Sy_BatchManager_bus does have two methods that will give you the status of a batch. Are you getting an error trying to open it?


  • 3.  RE: I am using an external VB Script to add invoices t

    Posted 03-03-2015 13:04
    Yes. The UI isn't available. Sy_BatchManagerSelect_UI. Is there another UI?


  • 4.  RE: I am using an external VB Script to add invoices t

    Posted 03-03-2015 13:53
    Doug, I'm not seeing another one you can try, unfortunately.


  • 5.  RE: I am using an external VB Script to add invoices t

    Posted 03-03-2015 14:32
    My original expectation was if i opened AP_Invoice_Bus and called ""nSelectBatch"" i would get a retVal response that would not permit access to a batch that is opened by another user or in an update status but retval consistently returns ""1"" and accepts invoices at any time. There is an object called GL_CompanyActiveBatch. Every new batch is added to this table when it is created and removed when it posted. There is a field called BatchStatus$. But it is blank regardless of what is going on with the batch.


  • 6.  RE: I am using an external VB Script to add invoices t

    Posted 03-03-2015 15:04
    Yes, you would think the SelectBatch would do it but I looked and it doesn't call the two aforementioned methods that really does check the status. That GL_CompanyActiveBatch object, unfortunately, isn't going to give you what you want.


  • 7.  RE: I am using an external VB Script to add invoices t

    Posted 04-07-2015 09:14
    Hi Marcos, Thanks for your comments. I did finally resolve this and thought i would share with the rest of the 90minds community. Use this logic to evaluate the status of any batch in Sage 100: I am looking for the status of an A/P invoice batch. set oSS = oscript.NewObject(""SY_SESSION"") oSS = nSetProgram oss.nlookupTask(""AP_Invoice_UI) I need to use SY_BatchManager_Bus and must know the batch type code. Use DFDM to find the batch type in ..\MAS_SYSTEM\SY_BatchManager.m4t. There is a ""BatchType$"" code associated with every type of batch in Sage 100. Module: ""A/P"" Batch Type: ""01"" Data Entry: True/False set oBatch = oScript.NewObject (""Sy_BatchManager_Bus"", oSS, ""A/P"", ""01"", 1) Use ReadBatchStatus () to send a batch number. The business object will return the batch status in the variable tmpBatchStatus. tmpBatchNo = ""00001"" tmpBatchStatus = """" retVal = oBatch .nReadBatchStatus(tmpBatchNo, tmpBatchStatus) tmpBatchStatus return values are: Available Purged $$ - null (must be an invalid batch number) Print/Update In Use Interrupted


  • 8.  RE: I am using an external VB Script to add invoices t

    Posted 04-10-2015 07:03
    Doug, very nice. I will put it in my script collection.