Skip to Content

How Cancel Invoices using Service Layer

Hello, I am trying to cancel an invoice using the "Service Layer", I am guided by the example found in the "API Reference".

Https://hanab1:50000/b1s/v1/Invoices(410)/Cancel

The message that shows me is: The requested action is not supported for this object.

I am using the Postman application to perform the process, a cancellation to a sales order works for me, but the invoice does not.

regards

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Aug 24, 2017 at 10:15 AM

    Hello, Jesus.

    As promissed here is the current status on this matter.

    This is an issue with Service Layer, scheduled to be fixed on the next patch level (9.2 PL09). Be advised that the timeframe is subject to change without notice.

    Thank you for bringing that up.

    UPDATE 06/12/2017 - The fix was delivered in the 9.2 PL10

    and find in the session "References" the note #2497424 which address this issue.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Ralph Oliveira ,

      Thank you for updating on the service layer fix. Currently we tried cancel for Invoice and Credit Memo and via Service Layer and it is working well. Unfortunately when we tried cancelling Delivery in 9.2 PL 10 it will have an error "The requested action is not supported for this object".

      Sample Call : https://IP:50000/b1s/v1/DeliveryNotes(137)/Cancel

      Result :

      {
      "error" : {
      "code" : -5006,
      "message" : {
      "lang" : "en-us",
      "value" : "The requested action is not supported for this object."
      }
      }
      }

      Regards,

      Marc

  • Aug 08, 2017 at 09:56 AM

    Make sure you are using the POST method.

    I tested and it's fine (9.2 PL07)

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ralph,

      Is there a way to apply the fix without having to upgrade, we are currently on SAP HANA 9.2 PL4.

      Kind Regards,

      Brenden Draper

  • Aug 10, 2017 at 01:32 PM

    Hi Jesus,

    Is not possible to perform the cancel of an Invoice in SAP Business One, the concept is create a cancellation document. On DI API to perform this action you do something like this:

    Documents oDoc = oCompany.GetBusinessObject(BoObjectTypes.oPurchaseInvoices);
    if (oDoc.GetByKey(docEntry))
    {
        //create cancellation document
        Documents oDoc2 = oDoc.CreateCancellationDocument();
        if (oDoc2.Add() != 0)
        {
            throw new Exception("Something Wrong");
        }
    }

    Maybe you can try to looking for a similar method on Service Layer.

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded