Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I Mark Multiple GL Batches "Ready to Post" Easily 1

Status
Not open for further replies.

HowardF

Vendor
Sep 8, 2003
2
US
I have a client that does not post to their GL regularly. They call on me 2 or 3 times a year to post GL batches and produce financials. Since they always have hundreds of GL batches to post, I'm looking for some method of marking all the batches "Ready to Post" without having to do each batch individually. I cannot find any of the 'common' ways to do this in the UI.

The installed version is Sage 300, 2014.

Thanks,
Howard
 
Sub MainSub()
'
' Sage 300 Macro file: C:\Data\Macros\make batches post.avb
' Recorded at: Fri Sep 21 16:19:30 2018
'

On Error GoTo ACCPACErrorHandler

Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)

Dim GLBATCH1batch As AccpacCOMAPI.AccpacView
mDBLinkCmpRW.OpenView "GL0008", GLBATCH1batch

Dim GLBATCH1header As AccpacCOMAPI.AccpacView
mDBLinkCmpRW.OpenView "GL0006", GLBATCH1header

Dim GLBATCH1detail1 As AccpacCOMAPI.AccpacView
mDBLinkCmpRW.OpenView "GL0010", GLBATCH1detail1

Dim GLBATCH1detail2 As AccpacCOMAPI.AccpacView
mDBLinkCmpRW.OpenView "GL0402", GLBATCH1detail2

GLBATCH1batch.Compose Array(GLBATCH1header)
GLBATCH1header.Compose Array(GLBATCH1batch, GLBATCH1detail1)
GLBATCH1detail1.Compose Array(GLBATCH1header, GLBATCH1detail2)
GLBATCH1detail2.Compose Array(GLBATCH1detail1)


Dim GLPOST2 As AccpacCOMAPI.AccpacView
mDBLinkCmpRW.OpenView "GL0030", GLPOST2


GLBATCH1batch.Browse "BATCHSTAT = 1", True

Do While GLBATCH1batch.Fetch
GLBATCH1batch.Fields("PROCESSCMD").PutWithoutVerification ("2") ' Lock Batch Switch
GLBATCH1batch.Process
GLBATCH1batch.Fields("RDYTOPOST").Value = "1" ' Ready to Post
GLBATCH1batch.Update
GLBATCH1batch.Fields("PROCESSCMD").PutWithoutVerification ("0") ' Lock Batch Switch
GLBATCH1batch.Process
Loop

MsgBox "Done"


Exit Sub

ACCPACErrorHandler:
Dim lCount As Long
Dim lIndex As Long

If Errors Is Nothing Then
MsgBox Err.Description
Else
lCount = Errors.Count

If lCount = 0 Then
MsgBox Err.Description
Else
For lIndex = 0 To lCount - 1
MsgBox Errors.Item(lIndex)
Next
Errors.Clear
End If
Resume Next

End If

End Sub

Sage 300 Whisperer
 
Thanks, Jay. This works perfectly and quickly set 250 batches to "ready to post". Beats wearing out a keyboard!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top