cancel
Showing results for 
Search instead for 
Did you mean: 

SDK coding to Remove Journal Entry, Journal Voucher

Former Member
0 Kudos

Hai,

I have created journal entry.But before creating, I want to check whether journal entry, journal voucher already created for this month. If it is, already created, I want to remove the existing one.

My coding is as follows,

oSBOJournalvouchers = DirectCast(ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalVouchers), SAPbobsCOM.JournalVouchers)

Try

oSBOJournalvouchers.JournalEntries.GetByKey(10)

Catch ex As Exception

SBO_Application.MessageBox(ex.Message)

End Try

If oSBOJournalvouchers.JournalEntries.Remove() <> 0 Then

ocompany.GetLastError(errcode, errmsg1)

SBO_Application.MessageBox(errcode & "-" & errmsg1)

End If

oSBOJournalvouchers.JournalEntries.GetByKey(10) --In this line error occurs.

Error Message is:

The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

Any help is appreciated.

Thanks in Advance.

Thanks,

Parvatha Solai.N

Accepted Solutions (0)

Answers (1)

Answers (1)

jbrotto
Active Contributor
0 Kudos

have you put the declaration on the top in the try method as com objects act oddly in VB. net

Former Member
0 Kudos

Hi all,

I've got the same problem with Parvatha Solai.

Did you solve it, Parvatha Sola?

Thanks,

Doan

Former Member
0 Kudos

Hi,

I get the same exception, I'm using 8.81 PL08 ... The creation for Journal Voucher success but when I'm trying to update the update failed ... please advice

JournalVouchers voucher = (JournalVouchers)Company.SBO_Company.GetBusinessObject(BoObjectTypes.oJournalVouchers);

voucher.JournalEntries.GetByKey(TransId);   // This line make exception The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))