×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

IC Transit Transfer Receipt- Different outcome when done by Macro

IC Transit Transfer Receipt- Different outcome when done by Macro

IC Transit Transfer Receipt- Different outcome when done by Macro

(OP)
ENVIRONMENT: Sage 300 2019 Premium | Server 2019 SQL 2012


RECREATE ISSUE:
  1. 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!)
  2. Start recording a Macro
  3. 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)
  4. Stop the Macro Recording
  5. Check the Transit Receipt you made
  6. Now run the Macro
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 --> VBA

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 


RE: IC Transit Transfer Receipt- Different outcome when done by Macro

I would test that field after each line to see what event is changing that field. Sometimes a UI has embedded logic - that's being removed but you might have found something that needs to be fixed. But I would try to pinpoint when that field is being initialized.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close