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!

Error Message: View call failed

Status
Not open for further replies.

IcinitiBrad

Programmer
May 18, 2004
9
CA
Hi everyone,

I'm using xAPI to insert a record into the OEORPP (OE/Prepayments) table. The only mandatory field is field 0 (ORDUNIQ), which I populate. For some reason, I get the following error:

View: OE0530. View call failed at ACCPACXAPILib.IxapiView.Insert()

Any help is appreciated.
~Brad (Using J#.Net)

ACCPACXAPILib.xapiSession o_sess = new ACCPACXAPILib.xapiSessionClass();
o_sess.Open("ADMIN", "ADMIN", "SAMINC", System.DateTime.get_Now(), 0);

ACCPACXAPILib.IxapiView o_viewOEORPP = null;

o_viewOEORPP = o_sess.OpenView( "OE0530", "OE" ); // OE Prepayments

o_viewOEORPP.get_Fields().get_Field( 0 ).PutWithoutVerification( "1000 );

o_viewOEORPP.Insert();

o_sess.Close();
 
o_viewOEORPP.get_Fields().get_Field( 0 ).PutWithoutVerification( "1000" );


Pasting this line into the editor erased one of the quotes, but the line does actually work. As the error message states, the line that is generating the error is the call to Insert();

Hope you have some ideas.
~Brad
 
You can't make up your own ORDUNIQ from your program. You need to pick up an existing ORDUNIQ from OEORDH.

Jay Converse
IT Director
Systemlink, Inc.
 
Hey Jay,

I am actually taking that value from OEORDH. Such as the following:

Code:
ACCPACXAPILib.xapiSession o_sess = new ACCPACXAPILib.xapiSessionClass();
o_sess.Open("ADMIN", "ADMIN", "SAMINC", System.DateTime.get_Now(), 0);

ACCPACXAPILib.IxapiView o_viewOEORDH  = null;
ACCPACXAPILib.IxapiView o_viewOEORPP  = null;
ACCPACXAPILib.IxapiView o_viewARBATCH = null;

o_viewOEORDH = o_sess.OpenView( "OE0520", "OE" );
o_viewOEORPP = o_sess.OpenView( "OE0530", "OE" );

o_viewOEORDH.Browse( "ORDNUMBER = ORD000000000088", 1 );
o_viewOEORDH.Fetch();

String strUniqueId = o_viewOEORDH.get_Fields().get_Field( 0 ).get_Value().ToString();		// ORDUNIQ
String strCustNo   = o_viewOEORDH.get_Fields().get_Field( 2 ).get_Value().ToString();		// Customer No.

o_viewOEORPP.get_Fields().get_Field( 0 ).set_Value( strUniqueId.Trim() );
o_viewOEORPP.get_Fields().get_Field( 1 ).set_Value( strCustNo.Trim() );
o_viewOEORPP.get_Fields().get_Field( 2 ).set_Value( strShipName.Trim() );
o_viewOEORPP.get_Fields().get_Field( 3 ).set_Value( strSrcCurr.Trim() );
o_viewOEORPP.get_Fields().get_Field( 4 ).set_Value( strRate.Trim() );
o_viewOEORPP.get_Fields().get_Field( 5 ).set_Value( strRateDate.Trim() );
o_viewOEORPP.get_Fields().get_Field( 6 ).set_Value( strRateType.Trim() );
o_viewOEORPP.get_Fields().get_Field( 7 ).set_Value( strRateRep.Trim() );
o_viewOEORPP.get_Fields().get_Field( 8 ).set_Value( strInvNet.Trim() );
o_viewOEORPP.get_Fields().get_Field( 9 ).set_Value( strDiscAvail.Trim() );
o_viewOEORPP.get_Fields().get_Field( 10 ).set_Value( strAmtDue.Trim() );

o_viewARBATCH = o_sess.OpenView( "AR0041", "AR" );
o_viewARBATCH.get_Fields().get_Field( 0 ).set_Value( "CA" );
o_viewARBATCH.Init();	
String strBBatchNo   = o_viewARBATCH.get_Fields().get_Field( 1 ).get_Value().ToString();
String strBBatchDate = o_viewARBATCH.get_Fields().get_Field( 2 ).get_Value().ToString();
String strBRateExch  = o_viewARBATCH.get_Fields().get_Field( 14 ).get_Value().ToString();
String strBRateDate  = o_viewARBATCH.get_Fields().get_Field( 11 ).get_Value().ToString();
String strBRateType  = o_viewARBATCH.get_Fields().get_Field( 13 ).get_Value().ToString();
String strBIDBank    = o_viewARBATCH.get_Fields().get_Field( 8 ).get_Value().ToString();

o_viewOEORPP.get_Fields().get_Field( 11 ).set_Value( strBBatchNo.Trim() );
o_viewOEORPP.get_Fields().get_Field( 15 ).set_Value( strBBatchDate.Trim() );
o_viewOEORPP.get_Fields().get_Field( 19 ).set_Value( strBRateExch.Trim() );
o_viewOEORPP.get_Fields().get_Field( 20 ).set_Value( strBRateDate.Trim() );
o_viewOEORPP.get_Fields().get_Field( 18 ).set_Value( strBRateType.Trim() );
o_viewOEORPP.get_Fields().get_Field( 12 ).set_Value( strBIDBank.Trim() );

o_viewOEORPP.get_Fields().get_Field( 13 ).set_Value( "VISA" );		// Recptype
o_viewOEORPP.get_Fields().get_Field( 14 ).set_Value( "ET100" );		// Check Number
o_viewOEORPP.get_Fields().get_Field( 16 ).set_Value( "5.00" );		// CC Payment Amount

o_viewOEORPP.Insert(); // *** This call fails.

... More code for batch information follows, but I've not included it sice we never get there ...

Also, all of the fields from OEORDH with order number ORD000000000088 are valid, and containing data. I've verified all of this.

It's frustrating to just get an error, "View call failed".

~Brad
 
I think you need to o_viewOEORPP.Compose Array(o_viewOEORDH)



Jay Converse
IT Director
Systemlink, Inc.
 
Hello again,

As jayconverse suggested, I tried to do a:

o_viewOEORPP.Compose Array(o_viewOEORDH)

in many different places within my function, and it doesn't seem to make any difference at all.

I'm starting to think that I may just have to directly write to the table myself. :/

But please, if there are any more ideas floating around out there, feel free. I'm willing to try anything at this point.

Brad Burns
Iciniti Corp.
 
OEORPP does not compose to any other view.

However I can't see where the OEORPP view is being initalized (o_viewOEORPP.Init). This will prepare the view to receive new values that will be added to the table. In other words the view will make sure that all default values are set. Also check to make sure that there is not a required field that you are missing.

Also check to see that the values that you are retrieving from the batch are correct and what you expect.

Also make sure that you are assigning to the correct fields. I like to use the actual name instead of the index number. For example here i assume you are assigning to the 'BATCHNUM' field,
Code:
o_viewOEORPP.get_Fields().get_Field( 11 ).set_Value( strBBatchNo.Trim() );
however the 'BATCHNUM' field is index 12 not 11.


Unfortunatly 'View call failed' is the catch all error message that doesn't give you any idea of where or what the problem is. Might also be a permissions issue on the database. Double check to see that you have both read and write permissions.

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top