Skip to Content

Reverse Journal Entry through code

Hi all

Can we reverse a journal entry through journal entry object.

ie in SBO there's Cancel method can we achieve the same using code

i am using SAB B1 8.8

Regards

Arun

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 29, 2010 at 07:21 AM

    Hello

    Yes you can if it is a question?

    sample code is:

    Sub reserveJE(ByVal AbsEntry As Integer)
            Dim oJE As SAPbobsCOM.JournalEntries = oCompany.GetBusinessObject(BoObjectTypes.oJournalEntries)
            If oJE.GetByKey(AbsEntry) Then
                If oJE.Cancel = 0 Then
                    sbo_application.MessageBox("JE cancelled")
                Else
                    sbo_application.MessageBox(oCompany.GetLastErrorDescription)
                End If
            End If
        End Sub

    Regards

    János

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 29, 2010 at 07:21 AM

    Hi Arun,

    check the following code sample with DI API..

    SAPbobsCOM.Documents oDoc = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries);
    oDoc.GetByKey(docEntry);
    int result = oDoc.Cancel();

    Regards

    Sebastian

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 16, 2020 at 12:12 PM

    Hi,

    an AR credit memo need to cancel and I found this code...does anyone encounter with this error message.

    "You cannot cancel this transaction."

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Neo Ci,

      You will cancel an A/R Credit Memo following way:

      SAPbobsCOM.Documents oCreditNotes = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oCreditNotes);
      oCreditNotes.GetByKey(11);          
      SAPbobsCOM.Documents oCancellationDocument = oCreditNotes.CreateCancellationDocument();
      oCancellationDocument.DocDate = DateTime.Today;
      oCancellationDocument.Add();

      Do you get the error message with this code as well?

      Kind regards,

      ANKIT CHAUHAN

      SAP Business One Support

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.