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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order Entry Cant Create Shipment and Invoice

Status
Not open for further replies.

shayd

Programmer
Dec 12, 2013
31
SA
Dear all i am build windows application on click i want to create new order entry and shipall the error when i press the button its create order entry but with no shipment and invoice id here the code




Dim OEORD1header As AccpacCOMAPI.AccpacView
Dim OEORD1headerFields As AccpacCOMAPI.AccpacViewFields
Dim OEORD1detail1 As AccpacCOMAPI.AccpacView
Dim OEORD1detail1Fields As AccpacCOMAPI.AccpacViewFields

Dim OEORD1detail2 As AccpacCOMAPI.AccpacView
Dim OEORD1detail2Fields As AccpacCOMAPI.AccpacViewFields
Dim OEORD1detail3 As AccpacCOMAPI.AccpacView
Dim OEORD1detail3Fields As AccpacCOMAPI.AccpacViewFields
Dim OEORD1detail4 As AccpacCOMAPI.AccpacView
Dim OEORD1detail4Fields As AccpacCOMAPI.AccpacViewFields
Dim OEORD1detail5 As AccpacCOMAPI.AccpacView
Dim OEORD1detail5Fields As AccpacCOMAPI.AccpacViewFields

Dim OEORD1detail6 As AccpacCOMAPI.AccpacView
Dim OEORD1detail6Fields As AccpacCOMAPI.AccpacViewFields

Dim OEORD1detail7 As AccpacCOMAPI.AccpacView
Dim OEORD1detail7Fields As AccpacCOMAPI.AccpacViewFields

Dim OEORD1detail8 As AccpacCOMAPI.AccpacView
Dim OEORD1detail8Fields As AccpacCOMAPI.AccpacViewFields

Dim OEORD1detail9 As AccpacCOMAPI.AccpacView
Dim OEORD1detail9Fields As AccpacCOMAPI.AccpacViewFields
Dim OEORD1detail10 As AccpacCOMAPI.AccpacView
Dim OEORD1detail10Fields As AccpacCOMAPI.AccpacViewFields
Dim OEORD1detail11 As AccpacCOMAPI.AccpacView
Dim OEORD1detail11Fields As AccpacCOMAPI.AccpacViewFields
Dim OEORD1detail12 As AccpacCOMAPI.AccpacView
Dim OEORD1detail12Fields As AccpacCOMAPI.AccpacViewFields
Dim ARCUSTOMER2header As AccpacCOMAPI.AccpacView
Dim ARCUSTOMER2headerFields As AccpacCOMAPI.AccpacViewFields
Dim ARCUSTOMER2detail As AccpacCOMAPI.AccpacView
Dim ARCUSTOMER2detailFields As AccpacCOMAPI.AccpacViewFields
Dim ARCUSTSTAT3 As AccpacCOMAPI.AccpacView
Dim ARCUSTSTAT3Fields As AccpacCOMAPI.AccpacViewFields
Dim ARCUSTCMT4 As AccpacCOMAPI.AccpacView
Dim ARCUSTCMT4Fields As AccpacCOMAPI.AccpacViewFields
Public Sub Create_IC_Shipment_IU(ByVal InvoiceID As Integer, ByVal Type As Integer, ByVal Customer As Integer, ByVal TransactionDate As Date, ByVal LocationId As Integer, ByVal Desc As String, ByVal Refe As String, ByVal PostFlage As Integer)

Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
mDBLinkCmpRW = Session.OpenDBLink(tagDBLinkTypeEnum.DBLINK_COMPANY, tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)

Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
mDBLinkSysRW = Session.OpenDBLink(tagDBLinkTypeEnum.DBLINK_SYSTEM, tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)


Dim temp As Boolean

mDBLinkCmpRW.OpenView("OE0520", OEORD1header)
OEORD1headerFields = OEORD1header.Fields



mDBLinkCmpRW.OpenView("OE0500", OEORD1detail1)
OEORD1detail1Fields = OEORD1detail1.Fields


mDBLinkCmpRW.OpenView("OE0740", OEORD1detail2)
OEORD1detail2Fields = OEORD1detail2.Fields



mDBLinkCmpRW.OpenView("OE0180", OEORD1detail3)
OEORD1detail3Fields = OEORD1detail3.Fields


mDBLinkCmpRW.OpenView("OE0526", OEORD1detail4)
OEORD1detail4Fields = OEORD1detail4.Fields


mDBLinkCmpRW.OpenView("OE0522", OEORD1detail5)
OEORD1detail5Fields = OEORD1detail5.Fields

mDBLinkCmpRW.OpenView("OE0508", OEORD1detail6)
OEORD1detail6Fields = OEORD1detail6.Fields


mDBLinkCmpRW.OpenView("OE0507", OEORD1detail7)
OEORD1detail7Fields = OEORD1detail7.Fields


mDBLinkCmpRW.OpenView("OE0501", OEORD1detail8)
OEORD1detail8Fields = OEORD1detail8.Fields


mDBLinkCmpRW.OpenView("OE0502", OEORD1detail9)
OEORD1detail9Fields = OEORD1detail9.Fields


mDBLinkCmpRW.OpenView("OE0504", OEORD1detail10)
OEORD1detail10Fields = OEORD1detail10.Fields


mDBLinkCmpRW.OpenView("OE0506", OEORD1detail11)
OEORD1detail11Fields = OEORD1detail11.Fields


mDBLinkCmpRW.OpenView("OE0503", OEORD1detail12)
OEORD1detail12Fields = OEORD1detail12.Fields



Dim OEORD1header_arr() As AccpacView = {OEORD1detail1, Nothing, OEORD1detail3, OEORD1detail2, OEORD1detail4, OEORD1detail5}
Dim OEORD1detail1_arr() As AccpacView = {OEORD1header, OEORD1detail8, OEORD1detail12, OEORD1detail9, OEORD1detail6, OEORD1detail7}
Dim OEORD1detail2_arr() As AccpacView = {OEORD1header}
Dim OEORD1detail3_arr() As AccpacView = {OEORD1header, OEORD1detail1}
Dim OEORD1detail4_arr() As AccpacView = {OEORD1header}
Dim OEORD1detail5_arr() As AccpacView = {OEORD1header}
Dim OEORD1detail6_arr() As AccpacView = {OEORD1detail1}
Dim OEORD1detail7_arr() As AccpacView = {OEORD1detail1}
Dim OEORD1detail8_arr() As AccpacView = {OEORD1detail1}
Dim OEORD1detail9_arr() As AccpacView = {OEORD1detail1, OEORD1detail10, OEORD1detail11}
Dim OEORD1detail10_arr() As AccpacView = {OEORD1detail9}
Dim OEORD1detail11_arr() As AccpacView = {OEORD1detail9}
Dim OEORD1detail12_arr() As AccpacView = {OEORD1detail1}

OEORD1header.Compose(OEORD1header_arr)
OEORD1detail1.Compose(OEORD1detail1_arr)
OEORD1detail2.Compose(OEORD1detail2_arr)
OEORD1detail3.Compose(OEORD1detail3_arr)
OEORD1detail4.Compose(OEORD1detail4_arr)
OEORD1detail5.Compose(OEORD1detail5_arr)
OEORD1detail6.Compose(OEORD1detail6_arr)
OEORD1detail7.Compose(OEORD1detail7_arr)
OEORD1detail8.Compose(OEORD1detail8_arr)
OEORD1detail9.Compose(OEORD1detail9_arr)
OEORD1detail10.Compose(OEORD1detail10_arr)
OEORD1detail11.Compose(OEORD1detail11_arr)
OEORD1detail12.Compose(OEORD1detail12_arr)


OEORD1headerFields.FieldByName("DRIVENBYUI").Value = "1" ' Driven by UI

OEORD1header.Cancel()
OEORD1header.Cancel()
OEORD1header.Init()
OEORD1detail2.Browse("", 1)

OEORD1detail2Fields.FieldByName("PAYMENT").PutWithoutVerification("-32767") ' Payment Number

OEORD1detail2.Browse("", -1)
OEORD1detail2.Fetch()
OEORD1headerFields.FieldByName("CUSTOMER").Value = "006826-02" ' Customer Number
OEORD1detail2.Browse("", 1)

OEORD1detail2Fields.FieldByName("PAYMENT").PutWithoutVerification("-32767") ' Payment Number

OEORD1detail2.Browse("", -1)
OEORD1detail2.Fetch()
OEORD1headerFields.FieldByName("PROCESSCMD").PutWithoutVerification("1") ' Process OIP Command
OEORD1header.Process()
temp = OEORD1detail1.Exists
OEORD1detail1.RecordClear()
temp = OEORD1detail1.Exists
OEORD1detail1.RecordCreate(0)

OEORD1detail1Fields.FieldByName("ITEM").Value = "01-S02-P01" ' Item

OEORD1detail1.Process()

OEORD1detail1Fields.FieldByName("QTYORDERED").Value = "1.0000" ' Quantity Ordered

OEORD1detail1.Insert()

OEORD1detail1Fields.FieldByName("LINENUM").PutWithoutVerification("-1") ' Line Number

OEORD1headerFields.FieldByName("GOSHIPALL").PutWithoutVerification("1") ' Perform Ship All
OEORD1header.Process()

OEORD1headerFields.FieldByName("INVPRODUCE").Value=1 ' Invoice Will Be Produced
OEORD1headerFields.FieldByName("OECOMMAND").Value = 4 ' Process O/E Command

'vwOrderFields("GOSHIPALL").PutWithoutVerification("1") ' Perform Ship All

'vwOrder.Process()

'vwOrderFields("INVPRODUCE").Value = "1" ' Invoice Will Be Produced

'vwDetails.Read()
'vwOrderFields("GOCALCTAX").PutWithoutVerification("1") ' Perform Tax Calculation
'vwOrder.Process()

'vwOrderFields("INVNUMBER").Value = objInvoice.InvoiceNo

OEORD1header.Process()
temp = OEORD1header.Exists
OEORD1header.insert()
OEORD1header.Order = 1
OEORD1header.Read()
OEORD1header.Order = 0





End Sub
 
thanks ettienne its fugly code coz its test code
 
Clean it up - no one wants to look at something like that and try to figure out what's wrong.
 
the code is work on TEST Comapny but when i try it on another company and change item and qty its create order entry but not shipped like TEST Company is it item setting or order entry setting i dont know :/ (the code working whatever its ugly or not)
 
if you cant help why you write on my post?????????????
 
Because... I can.
I can help, but I don't want to read through the crap you posted.
I simpler way to create invoices is set the qty shipped field.
 
OEORD1header.Init()
OEORD1detail2.Browse("", -1)
OEORD1detail2.Fetch()
OEORD1headerFields.FieldByName("CUSTOMER").Value = "006826-02" ' Customer Number
OEORD1detail2.Fetch()
OEORD1headerFields.FieldByName("PROCESSCMD").PutWithoutVerification("1") ' Process OIP Command
OEORD1header.Process()
temp = OEORD1detail1.Exists
OEORD1detail1.RecordClear()
temp = OEORD1detail1.Exists
OEORD1detail1.RecordCreate(0)

OEORD1detail1Fields.FieldByName("ITEM").Value = "01-S02-P01" ' Item

OEORD1detail1.Process()

OEORD1detail1Fields.FieldByName("QTYORDERED").Value = "1.0000" ' Quantity Ordered

OEORD1detail1.Insert()

OEORD1detail1Fields.FieldByName("LINENUM").PutWithoutVerification("-1") ' Line Number

OEORD1headerFields.FieldByName("GOSHIPALL").PutWithoutVerification("1") ' Perform Ship All
OEORD1header.Process()

OEORD1headerFields.FieldByName("INVPRODUCE").Value=1 ' Invoice Will Be Produced
OEORD1headerFields.FieldByName("OECOMMAND").Value = 4 ' Process O/E Command


OEORD1header.Process()
temp = OEORD1header.Exists
OEORD1header.insert()
OEORD1header.Order = 1
OEORD1header.Read()
OEORD1header.Order = 0
 
ettienne thanks for answer the problem the macro code cant perform the shipment and invoice i dont know why that mean when i record a micro and entered all the value and at then cant perform ship all in code.

i try to make your approach and put value in shipped QTY but its create order with no shipment too

is that problem coz item setting or order entry setting or any other restriction i am really want help
 
this code for shipped qty but there is somthing prevent shipmment and invoice creation :/





OEORD1headerFields.FieldByName("CUSTOMER").Value = "006826-02" ' Customer Number

OEORD1headerFields.FieldByName("PROCESSCMD").PutWithoutVerification("1") ' Process OIP Command
OEORD1header.Process()
temp = OEORD1detail1.Exists
OEORD1detail1.RecordClear()
temp = OEORD1detail1.Exists
OEORD1detail1.RecordCreate(0)

OEORD1detail1Fields.FieldByName("ITEM").Value = "01-S02-P01" ' Item

OEORD1detail1.Process()

OEORD1detail1Fields.FieldByName("QTYORDERED").Value = "1.0000" ' Quantity Ordered
OEORD1detail1Fields.FieldByName("QTYSHIPPED").Value = "1.0000" ' Quantity Shipped
OEORD1detail1Fields.FieldByName("LINENUM").PutWithoutVerification("-1") ' Line Number
OEORD1detail8Fields.FieldByName("OPTFIELD").PutWithoutVerification("CEDATE") ' Optional Field

OEORD1detail8Fields.FieldByName("OPTFIELD").PutWithoutVerification("CEDATE") ' Optional Field

OEORD1detail8.Read()

OEORD1detail8Fields.FieldByName("SWSET").Value = "1" ' Value Set

temp = OEORD1detail8.Exists

OEORD1detail8Fields.FieldByName("VALIFDATE").Value = DateSerial(2013, 11, 12) ' Date Value

OEORD1detail8.Insert()

OEORD1detail8Fields.FieldByName("OPTFIELD").PutWithoutVerification("CSDATE") ' Optional Field

OEORD1detail8.Read()

OEORD1detail8Fields.FieldByName("SWSET").Value = "1" ' Value Set

temp = OEORD1detail8.Exists

OEORD1detail8Fields.FieldByName("VALIFDATE").Value = DateSerial(2013, 11, 13) ' Date Value

OEORD1detail8.insert()

OEORD1detail8Fields.FieldByName("OPTFIELD").PutWithoutVerification("CSDATE") ' Optional Field

OEORD1detail8.Read()
OEORD1detail1.Insert()

OEORD1detail1Fields.FieldByName("LINENUM").PutWithoutVerification("-1") ' Line Number

OEORD1detail1.Read()
OEORD1headerFields.FieldByName("OECOMMAND").Value = "4" ' Process O/E Command
OEORD1header.Process()
OEORD1header.Insert()
 
again theres no error message its insert the order entry but didnt create shipment and invoice :/
 
yup i try error handler no error its add order entry correctly but not shipped and invoiced there is something not correct :/
 
thanks the error was in Fical calender for OE Period 12 :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top