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!

OE View Call Failed when running under 5.3B

Status
Not open for further replies.

kitlee

Programmer
Mar 31, 2006
3
CA
Hi there,

I really ran out of idea, when I working on the Order Entry view, I can set the ORDERNUMBER field but as soon as I try to set the CUSTOMER the error will raise. From the RVSpy I got this message:

[3d4] AR0016: ARRTA [16:32:23.18].Get(view=0x0b44029c, field=2, size=60)
[3d4] 0 <==[16:32:23.18;t=0;ovh=0] {buffer='\31\2e\35\25\20\44\69\73\63\6f\75\6e\74\20\4e\65\74\20\33\30\20\44\61\79\73\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20\20' -> '1.5% Discount Net 30 Days '}
[3d4] AR0016: ARRTA [16:32:23.18].Get(view=0x0b44029c, field=6, size=2)
[3d4] 0 <==[16:32:23.18;t=0;ovh=0] {buffer='\00\00'}
[3d4] OE0500: OEORDD [16:32:23.18].????????()
[3d4] 0 <==[16:32:23.18;t=0;ovh=0] {}
[3d4] OE0500: OEORDD [16:32:23.18].????????()
[3d4] 0 <==[16:32:23.18;t=0;ovh=0] {}
[3d4] OE0500: OEORDD [16:32:23.18].????????()
[3d4] 0 <==[16:32:23.18;t=0;ovh=0] {}
[3d4] OE0500: OEORDD [16:32:23.18].????????()
[3d4] 0 <==[16:32:23.18;t=0;ovh=0] {}
[3d4] 100 <==[16:32:23.18;t=484;ovh=342] {**ERROR**}

Please help.... any idea? Thanks.
 
Set the customer number, then the order number.

Jay Converse
IT Director
Systemlink, Inc.
 
Thanks, Jay. I will give it a try. May I ask why I need to set CustomerID first then others?

Thanks,
 
I'm just guessing. But, I'm a pretty good guesser where Accpac is concerned.

Jay Converse
IT Director
Systemlink, Inc.
 
Thank for your reply, but it is still fail when I try to set the CUSTOMER number. The attached is my code that I ued for connect and update the Accpac. In C#:

// Initialize the value
ptrAccpac = new AccpacCOMAPI.AccpacSession();
ptrAccpac.Init("", "XZ", "XZ1000", "53A");
ptrAccpac.Open("ADMIN", "XXXX", "COMPANY", System.DateTime.Today, 0, "");

ptrDBLink = ptrAccpac.OpenDBLink(tagDBLinkTypeEnum.DBLINK_COMPANY, tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);

// Create the View
AccpacCOMAPI.AccpacView vwOrderHeader;
ptrDBLink.OpenView("OE0520", out vwOrderHeader); // This is the Main View where we need to make it post
AccpacCOMAPI.AccpacView vwOrderDetail;
ptrDBLink.OpenView("OE0500", out vwOrderDetail);
AccpacCOMAPI.AccpacView vwOptionalFieldHeader;
ptrDBLink.OpenView("OE0522", out vwOptionalFieldHeader);
AccpacCOMAPI.AccpacView[] arrOrderHeader = new AccpacCOMAPI.AccpacView[6];
arrOrderHeader[0] = vwOrderDetail;
arrOrderHeader[1] = null;
arrOrderHeader[2] = null;
arrOrderHeader[3] = null;
arrOrderHeader[4] = null;
arrOrderHeader[5] = vwOptionalFieldHeader;
AccpacCOMAPI.AccpacView[] arrOrderDetails = new AccpacCOMAPI.AccpacView[4];
arrOrderDetails[0] = vwOrderHeader;
arrOrderDetails[1] = null;
arrOrderDetails[2] = null;
arrOrderDetails[3] = null;
AccpacCOMAPI.AccpacView[] arrOptionalHeader = new AccpacCOMAPI.AccpacView[1];
arrOptionalHeader[0] = vwOrderHeader;

szBuffer = arrOrderHeader;
vwOrderHeader.Compose(ref szBuffer);
szBuffer = arrOrderDetails;
vwOrderDetail.Compose(ref szBuffer);
szBuffer = arrOptionalHeader;
vwOptionalFieldHeader.Compose(ref szBuffer);

// Do the insert
vwOrderHeader.Init();

string strCustomerNumber = "900182";
szBuffer = strCustomerNumber;
vwOrderHeader.Fields.get_FieldByName("CUSTOMER").set_Value(ref szBuffer);
szBuffer = "ORD123455";
vwOrderHeader.Fields.get_FieldByName("ORDNUMBER").set_Value(ref szBuffer);
szBuffer = "087";
vwOrderHeader.Fields.get_FieldByName("LOCATION").set_Value(ref szBuffer);
szBuffer = "PO12345";
vwOrderHeader.Fields.get_FieldByName("PONUMBER").set_Value(ref szBuffer);
szBuffer = "Comment";
vwOrderHeader.Fields.get_FieldByName("COMMENT").set_Value(ref szBuffer);

More interesting things is the error ONLY happen to a valid Customer, if I input "1234567" it just give me the customer not exist error.

Please help. Thanks.
 
1. Learn how to use the Error object, that will give you better information.

2. You compositions look way off. Record a VBA macro that adds an order, then duplicate those compositions.

Jay Converse
IT Director
Systemlink, Inc.
 
Your compose should look something like
vwOrderHeader.Compose Array(vwOrderDetail, Null, Null, Null, Null, vwOptionalFieldHeader)

This is for VB, sorry my C aint so sharp.
 
This is how I am opening my session and OE views

Public Function OpenSession() As Boolean
'//CREATE AN ACCPAC SESSION
On Error GoTo ACCPACErrorHandler

Set Session = New AccpacCOMAPI.AccpacSession
Session.Init "", "OE", "OE0520", "53A"
Session.Open modGlobals.UserID, modGlobals.Password, modGlobals.DBName, modGlobals.SessionDate, 0, ""
'//DATABASE LINK ISSDAT
Set mDBLinkCmpRW = Session.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)

'//DATABASE LINK ISSSYS
Set mDBLinkSysRW = Session.OpenDBLink(DBLINK_SYSTEM, DBLINK_FLG_READWRITE)

'//SET OE VIEW AND FIELDS
'////////////////////////////////////////////////////////////////////////
mDBLinkCmpRW.OpenView "OE0520", OEORD4header
Set OEORD4headerFields = OEORD4header.Fields


mDBLinkCmpRW.OpenView "OE0500", OEORD4detail1
Set OEORD4detail1Fields = OEORD4detail1.Fields


mDBLinkCmpRW.OpenView "OE0740", OEORD4detail2
Set OEORD4detail2Fields = OEORD4detail2.Fields


mDBLinkCmpRW.OpenView "OE0180", OEORD4detail3
Set OEORD4detail3Fields = OEORD4detail3.Fields


mDBLinkCmpRW.OpenView "OE0680", OEORD4detail4
Set OEORD4detail4Fields = OEORD4detail4.Fields


mDBLinkCmpRW.OpenView "OE0526", OEORD4detail5
Set OEORD4detail5Fields = OEORD4detail5.Fields


mDBLinkCmpRW.OpenView "OE0522", OEORD4detail6
Set OEORD4detail6Fields = OEORD4detail6.Fields


mDBLinkCmpRW.OpenView "OE0501", OEORD4detail7
Set OEORD4detail7Fields = OEORD4detail7.Fields


mDBLinkCmpRW.OpenView "OE0502", OEORD4detail8
Set OEORD4detail8Fields = OEORD4detail8.Fields


mDBLinkCmpRW.OpenView "OE0504", OEORD4detail9
Set OEORD4detail9Fields = OEORD4detail9.Fields


mDBLinkCmpRW.OpenView "OE0503", OEORD4detail10
Set OEORD4detail10Fields = OEORD4detail10.Fields

'//////////////////////////////////////////////////////////////////////////

OEORD4header.Compose Array(OEORD4detail1, OEORD4detail4, OEORD4detail3, OEORD4detail2, OEORD4detail5, OEORD4detail6)

OEORD4detail1.Compose Array(OEORD4header, OEORD4detail7, OEORD4detail10, OEORD4detail8)

OEORD4detail2.Compose Array(OEORD4header)

OEORD4detail3.Compose Array(OEORD4header, OEORD4detail1)

OEORD4detail4.Compose Array(OEORD4header, OEORD4detail1)

OEORD4detail5.Compose Array(OEORD4header)

OEORD4detail6.Compose Array(OEORD4header)

OEORD4detail7.Compose Array(OEORD4detail1)

OEORD4detail8.Compose Array(OEORD4detail1, OEORD4detail9)

OEORD4detail9.Compose Array(OEORD4detail8)

OEORD4detail10.Compose Array(OEORD4detail1)

IsSessionOpened = Session.IsOpened

Exit Function

ACCPACErrorHandler:
Dim lCount As Long
Dim lIndex As Long
Dim Errors As String

If Session.Errors Is Nothing Then
MsgBox Err.DESCRIPTION
Else
lCount = Session.Errors.Count

If lCount = 0 Then
MsgBox Err.DESCRIPTION
Else
For lIndex = 0 To lCount - 1
Errors = Errors & Session.Errors.ITEM(lIndex) & vbCrLf
Next
'//RAISE EVENT ERROR
RaiseEvent ImportCanceled(Errors)
Session.Errors.Clear
End If
Session.Close
End If
End Function
 
And this is how I am creating my OE order


Public Function ImportOEInvoice(Header As clsOEORDH, _
HeaderOpt As clsOEORDHO, _
Detail As clsOEORDD, _
DetailOpt As clsOEORDDO, _
OrdPaySch As clsOETERMO, _
OrdComments As clsOECOINO, _
OrdSerialNum As clsOESELO _
) As Boolean

'////////////////////////////////////////////////////
'//CREATE THE HEADER INFORMATION FOR THE IMPORT

On Error GoTo ACCPACErrorHandler

Dim Record As Integer

OEORD4header.Cancel
OEORD4header.Cancel
temp = OEORD4header.Exists

'//INIT HEADER
OEORD4header.Init

OrderID = Header.RSDATA!ORDNUMBER & ""
OEORD4headerFields("ORDNUMBER").Value = Header.RSDATA!ORDNUMBER & "" ' Order NumbeR

OEORD4header.Order = 1
temp = OEORD4header.Exists
OEORD4header.Order = 0

'//HEADER INFO

OEORD4headerFields("CUSTOMER").Value = Header.RSDATA!CUSTOMER & "" ' Customer Number
OEORD4headerFields("BILNAME").Value = Header.RSDATA!BILNAME & ""
OEORD4headerFields("BILADDR1").Value = Header.RSDATA!BILADDR1 & ""
OEORD4headerFields("BILADDR2").Value = " "
OEORD4headerFields("BILCITY").Value = Header.RSDATA!BILCITY & ""
OEORD4headerFields("BILSTATE").Value = Header.RSDATA!BILSTATE & ""
OEORD4headerFields("BILZIP").Value = Header.RSDATA!BILZIP & ""
OEORD4headerFields("BILCOUNTRY").Value = Header.RSDATA!BILCOUNTRY & ""
OEORD4headerFields("SHPNAME").Value = Header.RSDATA!SHPNAME & ""
OEORD4headerFields("SHPADDR1").Value = Header.RSDATA!SHPADDR1 & ""
OEORD4headerFields("SHPADDR2").Value = " "
OEORD4headerFields("SHPCITY").Value = Header.RSDATA!SHPCITY & ""
OEORD4headerFields("SHPSTATE").Value = Header.RSDATA!SHPSTATE & ""
OEORD4headerFields("SHPZIP").Value = Header.RSDATA!SHPZIP & ""
OEORD4headerFields("PRICELIST").Value = Header.RSDATA!PriceList & ""
OEORD4headerFields("PONUMBER").Value = Header.RSDATA!PONUMBER & ""
OEORD4headerFields("REFERENCE").Value = Header.RSDATA!REFERENCE & ""
OEORD4headerFields("TYPE").Value = Header.RSDATA!Type & ""
OEORD4headerFields("ORDDATE").Value = Mid(Trim((Header.RSDATA!ORDDATE & "")), 5, 2) & "/" & Mid(Trim((Header.RSDATA!ORDDATE & "")), 7, 2) & "/" & Left(Trim((Header.RSDATA!ORDDATE & "")), 4)
OEORD4headerFields("EXPDATE").Value = Mid(Trim((Header.RSDATA!EXPDATE & "")), 5, 2) & "/" & Mid(Trim((Header.RSDATA!EXPDATE & "")), 7, 2) & "/" & Left(Trim((Header.RSDATA!EXPDATE & "")), 4)
OEORD4headerFields("SHIPVIA").Value = Header.RSDATA!SHIPVIA & ""
OEORD4headerFields("LOCATION").Value = Header.RSDATA!LOCATION & ""
OEORD4headerFields("DESC").Value = Header.RSDATA!DESC & ""
OEORD4headerFields("COMMENT").Value = Header.RSDATA!COMMENT & ""
OEORD4headerFields("SHIPDATE").Value = Mid(Trim((Header.RSDATA!SHIPDATE & "")), 5, 2) & "/" & Mid(Trim((Header.RSDATA!SHIPDATE & "")), 7, 2) & "/" & Left(Trim((Header.RSDATA!SHIPDATE & "")), 4)
OEORD4headerFields("INVDATE").Value = Mid(Trim((Header.RSDATA!INVDATE & "")), 5, 2) & "/" & Mid(Trim((Header.RSDATA!INVDATE & "")), 7, 2) & "/" & Left(Trim((Header.RSDATA!INVDATE & "")), 4)
OEORD4headerFields("POSTINV").Value = Header.RSDATA!POSTINV & ""
OEORD4headerFields("ORDERSOURC").Value = Header.RSDATA!ORDERSOURC & ""


'////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////
'//PAYMENT SCHEDULES

OEORD4detail2.Browse "", 1
OEORD4detail2Fields("PAYMENT").PutWithoutVerification ("-32767") ' Payment Number
OEORD4detail2.Browse "", -1
OEORD4detail2.Fetch
OEORD4headerFields("PROCESSCMD").PutWithoutVerification ("1") ' Process Command
OEORD4header.Process


'////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////
'HEADER OPTIONAL FIELDS

For Record = 1 To HeaderOpt.RSDATA.RecordCount
If Trim(HeaderOpt.RSDATA!OPTFIELD & "") <> "" Then
OEORD4detail6Fields("OPTFIELD").PutWithoutVerification (HeaderOpt.RSDATA!OPTFIELD) ' Optional Field
OEORD4detail6.Read
OEORD4detail6Fields("TYPE").Value = HeaderOpt.RSDATA!Type & ""
OEORD4detail6Fields("VALIFTEXT").Value = HeaderOpt.RSDATA!Value & "" '"9999" ' Text Value
OEORD4detail6.Update
Else
'//NO OPTFIELD
End If
HeaderOpt.MoveNext
Next Record

'///////////////////////////////////////////////////////////////////////////////
'///////////////////////////////////////////////////////////////////////////////
'///////////////////////////////////////////////////////////////////////////////
'//DETAIL

temp = OEORD4detail1.Exists
OEORD4detail1.RecordClear
temp = OEORD4detail1.Exists
OEORD4detail1.RecordGenerate False
temp = OEORD4detail1.Exists

For Record = 1 To Detail.RSDATA.RecordCount
If Trim(Detail.RSDATA!ITEM & "") <> "" Then
'//LOOP THROUGH DETAIL
OEORD4detail1Fields("ITEM").Value = Detail.RSDATA!ITEM & "" ' Item
OEORD4detail1Fields("PROCESSCMD").PutWithoutVerification ("1") ' Process Command
OEORD4detail1.Process
temp = OEORD4detail1.Exists

OEORD4detail1Fields("QTYORDERED").Value = Detail.RSDATA!QTYORDERED & "" '"10.0000" ' Quantity Ordered
OEORD4detail1Fields("PRIUNTPRC").Value = Detail.RSDATA!PRIUNTPRC & "" '"100.000000" ' Pricing Unit Price
OEORD4detail1Fields("CATEGORY").Value = Detail.RSDATA!CATEGORY & "" '"P4142"

temp = OEORD4detail1.Exists
OEORD4detail1.Insert
temp = OEORD4detail1.Exists
temp = OEORD4detail1.Exists

If Record <> Detail.RSDATA.RecordCount Then
'//CREATE NEW DETAIL LINE
OEORD4detail1Fields("LINENUM").PutWithoutVerification ("-1")

OEORD4detail1.Read
temp = OEORD4detail1.Exists
temp = OEORD4detail1.Exists

OEORD4detail1.RecordGenerate False
temp = OEORD4detail1.Exists
End If


Else
'//NO DETAIL
End If
Detail.MoveNext
Next Record

'////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////
'CURRENCY

OEORD4detail3.Init
OEORD4detail3.Fields("COINTYPE").Value = "1"
OEORD4detail3.Fields("COIN").Value = ""

OEORD4detail3.Insert
OEORD4header.Insert

'////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////
'////////////////////////////////////////////////////////////////////////
RaiseEvent ImportSuccessful(OrderID)
Exit Function

ACCPACErrorHandler:
Dim lCount As Long
Dim lIndex As Long

If Session.Errors Is Nothing Then
MsgBox Err.DESCRIPTION
Else
lCount = Session.Errors.Count

If lCount = 0 Then
MsgBox Err.DESCRIPTION
Else
For lIndex = 0 To lCount - 1
MsgBox Session.Errors.ITEM(lIndex)
Next
Session.Errors.Clear
End If
RaiseEvent ImportCanceled(OrderID)

End If

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top