planetbluau
Programmer
ENVIRONMENT: Sage 300 2019 Premium | Server 2019 SQL 2012
RECREATE ISSUE:
[ol 1]
[li]Create a Transit Transfer with a couple of detail lines and make the transit QTY requested say 10 (so you can try this a few times!)[/li]
[li]Start recording a Macro[/li]
[li]Create a Transit Receipt and receipt a QTY of 1 for one or all of the lines and zero for the rest (we want to repeat this action by macro)[/li]
[li]Stop the Macro Recording[/li]
[li]Check the Transit Receipt you made[/li]
[li]Now run the Macro[/li]
[/ol]
MY RESULT: In the manually entered receipt the GIT Location Description for line 1 is fine. However, when done by the Macro, the Description is now Blank!
Any ideas?
UNEDITED MACRO CODE BELOW
RECREATE ISSUE:
[ol 1]
[li]Create a Transit Transfer with a couple of detail lines and make the transit QTY requested say 10 (so you can try this a few times!)[/li]
[li]Start recording a Macro[/li]
[li]Create a Transit Receipt and receipt a QTY of 1 for one or all of the lines and zero for the rest (we want to repeat this action by macro)[/li]
[li]Stop the Macro Recording[/li]
[li]Check the Transit Receipt you made[/li]
[li]Now run the Macro[/li]
[/ol]
MY RESULT: In the manually entered receipt the GIT Location Description for line 1 is fine. However, when done by the Macro, the Description is now Blank!
Any ideas?
UNEDITED MACRO CODE BELOW
Code:
Sub MainSub()
'
' Sage 300 Macro file: D:\apps\sageshared\MACROS\TransferRecieptFollow.avb
' Recorded at: Thu Aug 22 19:53:59 2019
'
On Error GoTo ACCPACErrorHandler
' TODO: To increase efficiency, comment out any unused DB links.
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkSysRW = OpenDBLink(DBLINK_SYSTEM, DBLINK_FLG_READWRITE)
Dim temp As Boolean
Dim ICTRE1header As AccpacCOMAPI.AccpacView
Dim ICTRE1headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "IC0740", ICTRE1header
Set ICTRE1headerFields = ICTRE1header.Fields
Dim ICTRE1detail1 As AccpacCOMAPI.AccpacView
Dim ICTRE1detail1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "IC0730", ICTRE1detail1
Set ICTRE1detail1Fields = ICTRE1detail1.Fields
Dim ICTRE1detail2 As AccpacCOMAPI.AccpacView
Dim ICTRE1detail2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "IC0741", ICTRE1detail2
Set ICTRE1detail2Fields = ICTRE1detail2.Fields
Dim ICTRE1detail3 As AccpacCOMAPI.AccpacView
Dim ICTRE1detail3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "IC0735", ICTRE1detail3
Set ICTRE1detail3Fields = ICTRE1detail3.Fields
Dim ICTRE1detail4 As AccpacCOMAPI.AccpacView
Dim ICTRE1detail4Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "IC0733", ICTRE1detail4
Set ICTRE1detail4Fields = ICTRE1detail4.Fields
Dim ICTRE1detail5 As AccpacCOMAPI.AccpacView
Dim ICTRE1detail5Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "IC0738", ICTRE1detail5
Set ICTRE1detail5Fields = ICTRE1detail5.Fields
ICTRE1header.Compose Array(ICTRE1detail1, ICTRE1detail2)
ICTRE1detail1.Compose Array(ICTRE1header, Nothing, Nothing, Nothing, Nothing, Nothing, ICTRE1detail3, ICTRE1detail5, ICTRE1detail4)
ICTRE1detail2.Compose Array(ICTRE1header)
ICTRE1detail3.Compose Array(ICTRE1detail1)
ICTRE1detail4.Compose Array(ICTRE1detail1)
ICTRE1detail5.Compose Array(ICTRE1detail1)
ICTRE1header.Order = 3
ICTRE1header.FilterSelect "(DELETED = 0)", True, 3, 0
ICTRE1header.Order = 3
ICTRE1header.Order = 0
ICTRE1headerFields("TRANFENSEQ").PutWithoutVerification ("0") ' Sequence Number
ICTRE1header.Init
temp = ICTRE1detail1.Exists
ICTRE1detail1.RecordClear
ICTRE1header.Order = 3
temp = ICTRE1header.Exists
temp = ICTRE1header.Exists
temp = ICTRE1header.Exists
ICTRE1headerFields("DOCTYPE").Value = "3" ' Document Type
temp = ICTRE1header.Exists
ICTRE1headerFields("FROMNUM").Value = "TRF06860" ' From Transfer Number
temp = ICTRE1header.Exists
ICTRE1headerFields("HDRDESC").Value = "By Macro" ' Description
ICTRE1detail1Fields("LINENO").PutWithoutVerification ("-2") ' Line Number
ICTRE1detail1Fields("LINENO").PutWithoutVerification ("-2") ' Line Number
ICTRE1detail1.Read
ICTRE1detail1Fields("QUANTITY").Value = "1.0000" ' Quantity Transferred
ICTRE1detail1Fields("FUNCTION").PutWithoutVerification ("104") ' Function
ICTRE1detail1.Process
ICTRE1detail1.Update
ICTRE1detail1Fields("LINENO").PutWithoutVerification ("-2") ' Line Number
ICTRE1detail1.Read
ICTRE1header.Insert
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