wysiwygGER01
Programmer
Hello,
I'm using Accpac 5.5.
I've got the below code for entering a PO.
When I enter a PO manually Accpac automatically fills in vendor details such as vendor item number if the item has been set up for the vendor.
With my code this does not work. I would have thought by using the COMAPI it's done automatically just when entering it manually?
Would anyone have a sample of code on how to get the vendor item number inserted as well?
I'm using Accpac 5.5.
I've got the below code for entering a PO.
When I enter a PO manually Accpac automatically fills in vendor details such as vendor item number if the item has been set up for the vendor.
With my code this does not work. I would have thought by using the COMAPI it's done automatically just when entering it manually?
Would anyone have a sample of code on how to get the vendor item number inserted as well?
Code:
POPOR1headerFields("PORHSEQ").PutWithoutVerification ("0") ' Purchase Order Sequence Key
Temp = POPOR1header.Exists
POPOR1header.Init
POPOR1header.Order = 1
Temp = POPOR1detail1.Exists
POPOR1detail1.RecordClear
Temp = POPOR1detail3.Exists
POPOR1detail3.Init
Temp = POPOR1detail2.Exists
POPOR1detail2.Init
Temp = POPOR1header.Exists
POPOR1header.Init
POPOR1header.Order = 0
POPOR1headerFields("PORHSEQ").PutWithoutVerification ("0") ' Purchase Order Sequence Key
Temp = POPOR1header.Exists
POPOR1header.Init
POPOR1header.Order = 1
Temp = POPOR1detail1.Exists
POPOR1detail1.RecordClear
Temp = POPOR1detail3.Exists
POPOR1detail3.Init
Temp = POPOR1detail2.Exists
POPOR1detail2.Init
POPOR1headerFields("VDCODE").Value = vendor ' Vendor
POPOR1headerFields("PROCESSCMD").PutWithoutVerification ("1") ' Command
POPOR1header.Process
POPOR1headerFields("WORKFLOW").Value = workflow ' Workflow
POPOR1headerFields("COSTCTR").Value = costCtr
POPOR1headerFields("STCODE").Value = shipTo
POPOR1headerFields("BTCODE").Value = billTo ' Bill-To Location
POPOR1headerFields("VIACODE").Value = shipVia ' Ship-Via
POPOR1headerFields("DESCRIPTIO").Value = description ' Description
POPOR1headerFields("REFERENCE").Value = reference
POPOR1headerFields("FOBPOINT").Value = FOBPoint
POPOR1headerFields("DATE").Value = DateSerial(Year(PODate), Month(PODate), Day(PODate))
POPOR1headerFields("TEMPLATE").Value = template
POPOR1headerFields("TERMSCODE").Value = terms
' Reference
Temp = POPOR1detail1.Exists
POPOR1detail1.RecordClear
Temp = POPOR1detail1.Exists
For i = 1 To numOfLines
POPOR1detail1.RecordCreate 0
POPOR1detail1Fields("ITEMNO").Value = itemNo(i) ' Item Number
POPOR1detail1Fields("PROCESSCMD").PutWithoutVerification ("1") ' Command
POPOR1detail1.Process
'POPOR1detail1Fields("LOCATION").Value = 1
POPOR1detail1Fields("LOCATION").Value = "99DUB" 'Location
POPOR1detail1Fields("OEONUMBER").Value = ordernumber
POPOR1detail1Fields("OQORDERED").Value = quantity(i) ' Quantity Ordered
POPOR1detail1Fields("UNITCOST").Value = unitCost(i) ' Unit Cost
POPOR1detail1.Insert
Next
Temp = POPOR1header.Exists
POPOR1header.Insert