Hi
I have been trying to create an AR Invoice using ACCPAC web service without too much progress.
I have recorded macros and managed to use that DCOM code to successfully to create invoices. However, when I translate that code into web services it just does not work.
My Java Code is the following:
// open the required views
String batchViewToken = service.sessionOpenView( sessionToken, "AR0031" );
String headerViewToken = service.sessionOpenView( sessionToken, "AR0032" );
String detail1ViewToken = service.sessionOpenView( sessionToken, "AR0033" );
String detail2ViewToken = service.sessionOpenView( sessionToken, "AR0034" );
String detail3ViewToken = service.sessionOpenView( sessionToken, "AR0402" );
String detail4ViewToken = service.sessionOpenView( sessionToken, "AR0401" );
// compose the BATCH view
String[] composeViewBatch = { headerViewToken };
service.viewCompose( batchViewToken, composeViewBatch );
// compose the HEADER view
String[] composeViewHeader = { batchViewToken, detail1ViewToken, detail2ViewToken, detail3ViewToken, null };
service.viewCompose( headerViewToken, composeViewHeader );
// compose the DETAIL1 view
String[] composeViewDetail1 = { headerViewToken, batchViewToken, detail4ViewToken };
service.viewCompose( detail1ViewToken, composeViewDetail1 );
// compose the DETAIL2 view
String[] composeViewDetail2 = { headerViewToken };
service.viewCompose( detail2ViewToken, composeViewDetail2 );
// compose the DETAIL3 view
String[] composeViewDetail3 = { headerViewToken };
service.viewCompose( detail3ViewToken, composeViewDetail3 );
// compose the DETAIL4 view
String[] composeViewDetail4 = { detail1ViewToken };
service.viewCompose( detail4ViewToken, composeViewDetail4 );
// BATCH details
ProcessingRequest batchPrcReqst = new ProcessingRequest();
FieldValue[] batchFieldValues = {
new FieldValue(3, "Import Batch - " + new Date()), // batch description
new FieldValue(15, "1") }; // "PROCESSCMD" process command
batchPrcReqst.setFieldsToUpdate( batchFieldValues );
service.viewInit( batchViewToken, emptyPrcReqst );
service.viewUpdate( batchViewToken, batchPrcReqst );
// INVOICE HEADER details
ProcessingRequest headerPrcReqst = new ProcessingRequest();
FieldValue[] headerFieldValues = {
new FieldValue(129, "1"), // "INVCTYPE" invoice type
new FieldValue(4, "E000013"), // "IDINVC" document number (aka invoice number)
new FieldValue(3, "100010000101"), // "IDCUST" customer number
new FieldValue(14, "Utility Billing (Dec-2008 period)"), // "INVCDESC" invoice description
new FieldValue(18, new GregorianCalendar() ), // "DATEINVC" document date
new FieldValue(114, "4") }; // "PROCESSCMD" process command
// initialise a HEADER record
service.viewInit( headerViewToken, emptyPrcReqst );
// process the HEADER record
headerPrcReqst.setFieldsToUpdate( headerFieldValues );
service.viewProcess( headerViewToken, headerPrcReqst );
// INVOICE CONTENT details
ProcessingRequest detail1PrcReqstDetail = new ProcessingRequest();
FieldValue[] detail1FieldValuesDetail = {
new FieldValue(3, "-1"), // "CNTLINE" line number
new FieldValue(5, "ELECT"), // "IDITEM" item number
new FieldValue(7, "Nov-2008 Electricity Bill"), // "TEXTDESC" description
new FieldValue(10, "2.0" ), // "QTYINVC" quantity
new FieldValue(12, "34.50" ), // "AMTPRIC" price
new FieldValue(58, "0" ), // "SWDISCABL" discountable
new FieldValue(67, "0") }; // "PROCESSCMD" process command
// initialise a DETAIL record
service.viewInit( detail1ViewToken, emptyPrcReqst );
// process/insert the DETAIL record
detail1PrcReqstDetail.setFieldsToUpdate( detail1FieldValuesDetail );
service.viewProcess( detail1ViewToken, detail1PrcReqstDetail );
service.viewInsert( detail1ViewToken, detail1PrcReqstDetail );
// insert the HEADER record
service.viewInsert( headerViewToken, null );
[/b]
The error occurs when the SECOND LAST LINE is called - when the invoice detail record is being inserted.
The the following error is returned when it fails: "Internal error. Invoice Detail. Operation not allowed."
By the way, the batch part of the above code works successfully.
I'm using ACCPAC 5.5A.
Any help would be very much appreciated.
I have been trying to create an AR Invoice using ACCPAC web service without too much progress.
I have recorded macros and managed to use that DCOM code to successfully to create invoices. However, when I translate that code into web services it just does not work.
My Java Code is the following:
// open the required views
String batchViewToken = service.sessionOpenView( sessionToken, "AR0031" );
String headerViewToken = service.sessionOpenView( sessionToken, "AR0032" );
String detail1ViewToken = service.sessionOpenView( sessionToken, "AR0033" );
String detail2ViewToken = service.sessionOpenView( sessionToken, "AR0034" );
String detail3ViewToken = service.sessionOpenView( sessionToken, "AR0402" );
String detail4ViewToken = service.sessionOpenView( sessionToken, "AR0401" );
// compose the BATCH view
String[] composeViewBatch = { headerViewToken };
service.viewCompose( batchViewToken, composeViewBatch );
// compose the HEADER view
String[] composeViewHeader = { batchViewToken, detail1ViewToken, detail2ViewToken, detail3ViewToken, null };
service.viewCompose( headerViewToken, composeViewHeader );
// compose the DETAIL1 view
String[] composeViewDetail1 = { headerViewToken, batchViewToken, detail4ViewToken };
service.viewCompose( detail1ViewToken, composeViewDetail1 );
// compose the DETAIL2 view
String[] composeViewDetail2 = { headerViewToken };
service.viewCompose( detail2ViewToken, composeViewDetail2 );
// compose the DETAIL3 view
String[] composeViewDetail3 = { headerViewToken };
service.viewCompose( detail3ViewToken, composeViewDetail3 );
// compose the DETAIL4 view
String[] composeViewDetail4 = { detail1ViewToken };
service.viewCompose( detail4ViewToken, composeViewDetail4 );
// BATCH details
ProcessingRequest batchPrcReqst = new ProcessingRequest();
FieldValue[] batchFieldValues = {
new FieldValue(3, "Import Batch - " + new Date()), // batch description
new FieldValue(15, "1") }; // "PROCESSCMD" process command
batchPrcReqst.setFieldsToUpdate( batchFieldValues );
service.viewInit( batchViewToken, emptyPrcReqst );
service.viewUpdate( batchViewToken, batchPrcReqst );
// INVOICE HEADER details
ProcessingRequest headerPrcReqst = new ProcessingRequest();
FieldValue[] headerFieldValues = {
new FieldValue(129, "1"), // "INVCTYPE" invoice type
new FieldValue(4, "E000013"), // "IDINVC" document number (aka invoice number)
new FieldValue(3, "100010000101"), // "IDCUST" customer number
new FieldValue(14, "Utility Billing (Dec-2008 period)"), // "INVCDESC" invoice description
new FieldValue(18, new GregorianCalendar() ), // "DATEINVC" document date
new FieldValue(114, "4") }; // "PROCESSCMD" process command
// initialise a HEADER record
service.viewInit( headerViewToken, emptyPrcReqst );
// process the HEADER record
headerPrcReqst.setFieldsToUpdate( headerFieldValues );
service.viewProcess( headerViewToken, headerPrcReqst );
// INVOICE CONTENT details
ProcessingRequest detail1PrcReqstDetail = new ProcessingRequest();
FieldValue[] detail1FieldValuesDetail = {
new FieldValue(3, "-1"), // "CNTLINE" line number
new FieldValue(5, "ELECT"), // "IDITEM" item number
new FieldValue(7, "Nov-2008 Electricity Bill"), // "TEXTDESC" description
new FieldValue(10, "2.0" ), // "QTYINVC" quantity
new FieldValue(12, "34.50" ), // "AMTPRIC" price
new FieldValue(58, "0" ), // "SWDISCABL" discountable
new FieldValue(67, "0") }; // "PROCESSCMD" process command
// initialise a DETAIL record
service.viewInit( detail1ViewToken, emptyPrcReqst );
// process/insert the DETAIL record
detail1PrcReqstDetail.setFieldsToUpdate( detail1FieldValuesDetail );
service.viewProcess( detail1ViewToken, detail1PrcReqstDetail );
service.viewInsert( detail1ViewToken, detail1PrcReqstDetail );
// insert the HEADER record
service.viewInsert( headerViewToken, null );
[/b]
The error occurs when the SECOND LAST LINE is called - when the invoice detail record is being inserted.
The the following error is returned when it fails: "Internal error. Invoice Detail. Operation not allowed."
By the way, the batch part of the above code works successfully.
I'm using ACCPAC 5.5A.
Any help would be very much appreciated.