cancel
Showing results for 
Search instead for 
Did you mean: 

How Cancel Invoices using Service Layer

jesus_perea
Explorer
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member197733
Contributor
0 Kudos

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.

Former Member
0 Kudos

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

former_member197733
Contributor
0 Kudos

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.

Former Member
0 Kudos

Thank you Ralph for your answer!

0 Kudos

Hi ralph ,

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

Answers (2)

Answers (2)

former_member185682
Active Contributor
0 Kudos

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

former_member197733
Contributor
0 Kudos

Make sure you are using the POST method.

I tested and it's fine (9.2 PL07)

jesus_perea
Explorer
0 Kudos

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.

former_member197733
Contributor
0 Kudos

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

Former Member
0 Kudos

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