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!

help Please Required optional field insert?

Status
Not open for further replies.

tyjung

Programmer
Oct 30, 2015
1
KR
Hi~
sorry English is not enough

Environment : use Sage 2014

I/C Setup --> I/C optional fields (IC6130) -> Transfer and Transfer detail required yes setting

<code>
AccpacDB_Company.OpenView "IC0740", IC_Transfer_Header ' Transfer Headers IC0730, IC0741
Set IC_Transfer_Header_Fields = IC_Transfer_Header.fields

AccpacDB_Company.OpenView "IC0730", IC_Transfer_Detail1 ' Transfer Details ICTRED, IC0740, IC0310, IC0750, IC0370, IC0290, IC0100, IC0735, IC0738, IC0733
Set IC_Transfer_Detail1_Fields = IC_Transfer_Detail1.fields

AccpacDB_Company.OpenView "IC0741", IC_Transfer_Detail2 ' Transfer Optional Fields ICTREHO, IC0740
Set IC_Transfer_Detail2_Fields = IC_Transfer_Detail2.fields

AccpacDB_Company.OpenView "IC0735", IC_Transfer_Detail3 ' Transfer Detail Optional Fields ICTREDO, IC0730
Set IC_Transfer_Detail3_Fields = IC_Transfer_Detail3.fields

AccpacDB_Company.OpenView "IC0733", IC_Transfer_Detail4 ' Transfer Detail Lot Numbers ICTREDL, IC0730
Set IC_Transfer_Detail4_Fields = IC_Transfer_Detail4.fields

AccpacDB_Company.OpenView "IC0738", IC_Transfer_Detail5 ' Transfer Detail Serial Numbers ICTREDS, IC0730
Set IC_Transfer_Detail5_Fields = IC_Transfer_Detail5.fields

IC_Transfer_Header.Compose Array(IC_Transfer_Detail1, IC_Transfer_Detail2)

IC_Transfer_Detail1.Compose Array(IC_Transfer_Header, Nothing, Nothing, Nothing, Nothing, Nothing, IC_Transfer_Detail3, IC_Transfer_Detail5, IC_Transfer_Detail4)

IC_Transfer_Detail2.Compose Array(IC_Transfer_Header)

IC_Transfer_Detail3.Compose Array(IC_Transfer_Detail1)

IC_Transfer_Detail4.Compose Array(IC_Transfer_Detail1)

IC_Transfer_Detail5.Compose Array(IC_Transfer_Detail1)

'================================================================

Public Function GF_IC_Transfer(ObjSpd As Object, TransferNum As String, TransDate As String, DESCR As String, DEPT As String) As Boolean

On Error GoTo Err_Code

Dim i As Long
Dim BU As String

GF_IC_Transfer = False

Accpac_Session.Errors.Clear

IC_Transfer_Header.order = 3
IC_Transfer_Header.FilterSelect "(DELETED = 0)", True, 3, 0
IC_Transfer_Header.order = 3
IC_Transfer_Header.order = 0

IC_Transfer_Header_Fields("TRANFENSEQ").PutWithoutVerification ("0") ' Sequence Number

IC_Transfer_Header.Init
IC_Transfer_Detail1.RecordClear
'IC_Transfer_Detail2.RecordClear
IC_Transfer_Header.order = 3

IC_Transfer_Header_Fields("PROCESSCMD").PutWithoutVerification ("1") ' Process Command

IC_Transfer_Header.Process

IC_Transfer_Header_Fields("DOCTYPE").Value = "1" ' Document Type(Transfer)

IC_Transfer_Header_Fields("TRANSDATE").Value = TransDate ' Document Date
IC_Transfer_Header_Fields("DATEBUS").Value = TransDate ' Posting Date
IC_Transfer_Header_Fields("HDRDESC").Value = TransferNum ' Description
IC_Transfer_Header_Fields("REFERENCE").Value = DESCR ' Reference

For i = 1 To ObjSpd.MaxRows

If GF_ssGetEdit(ObjSpd, 1, i) = "1" Then
IC_Transfer_Detail1.RecordClear
IC_Transfer_Detail1.RecordCreate 0

IC_Transfer_Detail1_Fields("ITEMNO").Value = GF_ssGetEdit(ObjSpd, 3, i) ' Item Number
IC_Transfer_Detail1_Fields("PROCESSCMD").PutWithoutVerification ("1") ' Process Command

IC_Transfer_Detail1.Process

IC_Transfer_Detail1_Fields("FROMLOC").Value = GF_ssGetEdit(ObjSpd, 8, i) ' From Location
IC_Transfer_Detail1_Fields("TOLOC").Value = Right(GF_ssGetEdit(ObjSpd, 10, i), 6) ' To Location

IC_Transfer_Detail1_Fields("QTYREQ").Value = CDbl(GF_ssGetValue(ObjSpd, 6, i)) ' Quantity Requested

IC_Transfer_Detail1_Fields("LINENO").PutWithoutVerification (i * -1) ' Line Number
IC_Transfer_Detail1_Fields("FUNCTION").PutWithoutVerification ("100") ' Function

IC_Transfer_Detail1_Fields("FUNCTION").PutWithoutVerification ("100") ' Function

IC_Transfer_Detail3.RecordClear
IC_Transfer_Detail3.RecordCreate 0

IC_Transfer_Detail3_Fields("OPTFIELD").PutWithoutVerification ("BU") ' Optional Field
IC_Transfer_Detail3.Read

IC_Transfer_Detail3_Fields("OPTFIELD").Value = "BU" ' Optional Field
IC_Transfer_Detail3_Fields("SWSET").Value = "1" ' Value Set
IC_Transfer_Detail3_Fields("VALIFTEXT").Value = Trim(BU) ' Text Value

IC_Transfer_Detail3.Insert
IC_Transfer_Detail3.Read

IC_Transfer_Detail3_Fields("OPTFIELD").PutWithoutVerification ("DEPT") ' Optional Field
IC_Transfer_Detail3.Read

IC_Transfer_Detail3_Fields("OPTFIELD").Value = "DEPT" ' Optional Field
IC_Transfer_Detail3_Fields("SWSET").Value = "1" ' Value Set
IC_Transfer_Detail3_Fields("VALIFTEXT").Value = Trim(DEPT) ' Text Value

IC_Transfer_Detail3.Insert
IC_Transfer_Detail3.Read

IC_Transfer_Detail1_Fields("FUNCTION").PutWithoutVerification ("100") ' Function

IC_Transfer_Detail1.Process
IC_Transfer_Detail1.Insert

End If

Next i

IC_Transfer_Detail2.Read

IC_Transfer_Detail2_Fields("OPTFIELD").PutWithoutVerification ("BU") ' Optional Field
IC_Transfer_Detail2.Read

IC_Transfer_Detail2_Fields("OPTFIELD").Value = "BU" ' Optional Field
IC_Transfer_Detail2_Fields("SWSET").Value = "1" ' Value Set
IC_Transfer_Detail2_Fields("VALIFTEXT").Value = Trim(BU) ' Text Value

IC_Transfer_Detail2.Update
IC_Transfer_Detail2.Read

IC_Transfer_Detail2_Fields("OPTFIELD").PutWithoutVerification ("DEPT") ' Optional Field
IC_Transfer_Detail2.Read

IC_Transfer_Detail2_Fields("OPTFIELD").Value = "DEPT" ' Optional Field
IC_Transfer_Detail2_Fields("SWSET").Value = "1" ' Value Set
IC_Transfer_Detail2_Fields("VALIFTEXT").Value = Trim(DEPT) ' Text Value

IC_Transfer_Detail2.Update
IC_Transfer_Detail2.Read

IC_Transfer_Header.Process
IC_Transfer_Header.Insert [highlight #EF2929]<-- Incorrect procedure. Optional Field DEPT is missing but is required as defined in I/C Optional Fields for Transfer Details.
[/highlight]

GF_IC_Transfer = True

Exit Function
Exit Function

</code>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top