01-13-2017 6:14 AM - edited 02-03-2024 6:34 PM
Hi guys,
I am creating sales orders via the DI API. In SAP when these are created they are sent for approval. How can I do this with the DI API?
Hi Costas,
Sorry for the delay, I was very busy in the last days, and I needed to search more about this topic.
My considerations is the following:
Is it possible work with approval procedure on DI API?
Yes, but have constraints.
How enable approval procedure on DI API?
Go To -> Administration>System Initialization> General Settings. On the BP Tab, there is a check box to activate approval procedures via the DI.
What is the constraints?
On DI API is not possible trigger Approval Procedures based on User Queries, because it is not possible to get User Defined Value from FMS (formatted search) in DI. Look SAP Note (https://launchpad.support.sap.com/#/notes/1681542/E)
How can I configure my Approval procedure to work with DI API?
Set up your approval procedure to launch always.
Or use pre defined terms
How to know if the document will launch approval procedure?
A sample code:
Documents oDoc = oCompany.GetBusinessObject(BoObjectTypes.oOrders);
oDoc.CardCode = "C00007";
oDoc.DocDueDate = DateTime.Now;
oDoc.Lines.ItemCode = "LM4029SB";
oDoc.Lines.Quantity = 2;
oDoc.GetApprovalTemplates();
if (oDoc.Document_ApprovalRequests.Count > 0 && oDoc.Document_ApprovalRequests.ApprovalTemplatesID > 0)
{
//Your document will fire an approval procedure
//If you want to add some remarks to your approval you can do this
oDoc.Document_ApprovalRequests.SetCurrentLine(0);
oDoc.Document_ApprovalRequests.Remarks = "Add Doc from DI";
}
if (oDoc.Add() != 0)
MessageBox.Show(oCompany.GetLastErrorDescription());
else
MessageBox.Show(oCompany.GetNewObjectKey());
Hope it helps.
Kind Regards.
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried but
Approval Template using a Terms Based on User Query not working via DI (SAP B1 8.82 PL04)
Please support for me...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks one more thing. I noticed that the approval does pass, but the notification does not fire on the other user. He only sees it when a sales order is added manual and is then fired. How can I force the notification for the approval process?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Costas,
I created the following Approval template in my test environment.
Then, I ran the sample that I posted on last answer, and I had used the manager user to log on di api when I ran the sample. All messages of the process were received correctly on my test environment.
Kind Regards,
Diego Lother
Thanks that's works. However the customer uses credit limits and commitment limits. Is there a way to add it with these enabled?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Costas,
This error occurred because your company is active the customer Credit limit restriction, and with this function, the SAP validates if the customer has credit limit enough for add the document.
To enable/disable this function go to Administration->System Initialization-> General Settings -> BP Tab
The credit limit for the BP is set up on Business Master Data Form on Payment Terms Tab.
In your case to test, you can disable the credit limit functionality or add a credit limit bigger for your customer.
Kind Regards,
Diego Lother
Hi thanks for the reply,
this is checked. Do I also need to do something in my code, because we are not getting any notifications.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Costas,
Did you check if your config "activate approval procedures via the DI" are enabled?
Administration>System Initialisation> General Settings. On the BP Tab, there is a check box to activate approval procedures via the DI.
This will the make your DI add on work with the approvals processes on standard SAP documents.
Hope it helps.
Kind Regards,
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.