on 01-29-2018 2:02 PM - last edited on 02-04-2024 3:26 AM by postmig_api_4
Good day,
I am developing a code where I have to cancel a documents using DI API SDK.
I see some documents using the method Cancel and ther others using the method
CreateCancellationDocument.
For Example:
The Sales Orders use the Method: ObjectOrder.Cancel()
The Invoices use the method: ObjectTarget = ObjectInvoice.CreateCancellationDocument()
The Question is, How do i know which documents use the method Cancel or
CreateCancellationDocument?
Thanks and Regard.
It is the same idea when you are using SAP as an user. You don`t need to create a document to cancel an Order, but in order to cancel an invoice, you need to create another document.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi david,
You will know when you should use each when you get more familiar with SAP
But as a rule of Thumb, most documents that has a journal entry posting will need to use the CreateCancellationDocument.
All of this documents will have a TransId Value in the table.
Regards
Edy
Did you find a solution for your Problem? i am facing the same Problem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this,
SAPbobsCOM.Documents oInvoice;
SAPbobsCOM.Documents oCancelI;
oInvoice = (SAPbobsCOM.Documents)_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);
oCancelI = (SAPbobsCOM.Documents)_oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);
if (oInvoice.GetByKey(PK) == true)
{
oCancelI = oInvoice.CreateCancellationDocument();
res = oCancelI.Add();
if (res != 0)
{
_oCompany.GetLastError(out error, out errorDes);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
//Create a new Documents object
Documents doc = comp.GetBusinessObject(BoObjectTypes.oDeliveryNotes);
//Get a the document by key which will be cancelled
doc.GetByKey(19);
//Create an object which represent to a new cancellation document based on doc
Documents cancelDoc = doc.CreateCancellationDocument();
//We can modify some values in the cancellation document
cancelDoc.DocDate = new DateTime(2012, 4, 8);
//Then we can add this cancellation document, and at the same time the status of the base document will be changed into ‘canceled’
cancelDoc.Add();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.