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!

Post A/R Invoice batch after import in .net

Status
Not open for further replies.

Mab-a

Programmer
Jun 19, 2019
8
GH
Hi Team,
I am trying to post A/R invoice batch after import,
i get an error on the underlined code below (Error HRESULT E_FAIL has been returned from a call to a COM component.).
any pointer to what i am doing wrong would be appreciated.

ARbatch.Fields.FieldByName("CNTBTCH").PutWithoutVerification(strBatchID) 'Batch Number
ARbatch.Read()
ARbatch.Fields.FieldByName("PROCESSCMD").PutWithoutVerification("1") ' Process Command
ARbatch.Process()

ARbatch.Fields.FieldByName("CNTITEM").PutWithoutVerification("-9999999") ' Entry Number
'ARheader.Browse("")
ARheader.Fetch()
ARdetail1.Read()
ARbatch.Fields.FieldByName("PROCESSCMD").PutWithoutVerification("2") ' Process Command
ARbatch.Process()
ARbatch.Fields.FieldByName("BTCHSTTS").Value = "7" ' // Batch Status
ARbatch.Update()

ARbatch.Fields.FieldByName("PROCESSCMD").PutWithoutVerification("0") ' // Process Command
ARheader.Fields.FieldByName("CNTITEM").PutWithoutVerification("-9999999") ' Entry Number
'ARheader.Browse("")
ARdetail1.Read()

ARIVPT.Fields.FieldByName("BATCHIDFR").PutWithoutVerification(strBatchID) ' // Post Batch From
ARIVPT.Fields.FieldByName("BATCHIDTO").PutWithoutVerification(strBatchID) ' // Post Batch To
ARIVPT.Process()
ARbatch.Read()
ARheader.Fields.FieldByName("CNTITEM").PutWithoutVerification("-9999999") ' Entry Number
'ARheader.Browse("")
ARheader.Fetch()
ARdetail1.Read()
 
You need to add error trapping code. The Sage Session object has an error stack that you can review that will tell you what Sage says is wrong with the transaction. It doesn't pass that stack up to the VB.net error trapping level.

Record a macro in Sage and you'll see how to access the Sage Session error stack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top