Skip to Content
0

How Cancel Invoices using Service Layer

Aug 04, 2017 at 09:28 PM

365

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Ralph Oliveira
Aug 24, 2017 at 10:15 AM
0

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.

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hello Ralph!

We upgraded our environment till PL09 but still, we got the same response. As the result we are no able to cancel invoices, credit memos etc

Could you please help us with the matter!

Regards,

Roman Rudnytskyy

0

Hi Roman, you are right.

The fix was postponed and delivered in the PL10 (released last 04.12.2017).

You can see the details in the PL10 Release Note and find in the session "References" the note #2497424 which address this issue.

0
Former Member

Thank you Ralph for your answer!

0

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

0
Ralph Oliveira
Aug 08, 2017 at 09:56 AM
0

Make sure you are using the POST method.

I tested and it's fine (9.2 PL07)

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Ralph,

Thanks for your answer. I see you did the test for a sales order, I did it and it works. But the problem happens when I try to cancel an invoice, I have already verified that the "DocEntry" of the Invoice is valid and that I use the POST method.

I don't know what happens.

0

You are right. There seems to be an issue. I will investigate it more and let you know.

0
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

0
DIEGO LOTHER Aug 10, 2017 at 01:32 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded