cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SDK - Create Sales Order and send for approval

costas_ioannou2
Active Participant
0 Likes
6,513

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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

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

Answers (7)

Answers (7)

former_member818640
Discoverer
0 Likes

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...

former_member818640
Discoverer
0 Likes

tks everyones

costas_ioannou2
Active Participant
0 Likes

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?

Former Member
0 Likes

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

costas_ioannou2
Active Participant
0 Likes

Thanks that's works. However the customer uses credit limits and commitment limits. Is there a way to add it with these enabled?

Former Member
0 Likes

Hi Costas,

I unknow a workaround to this situation. 😞

Maybe someone else in this board have some approach for this situation.

P.S: Don't forget to close the question, after you get answers.

Kind Regards,

Diego Lother

costas_ioannou2
Active Participant
0 Likes

Hi, thanks so much for all the effort you put into this. I really appreciate it.

I used the code and set the procedure to launch always. However, it does not add the order. I get an error, As seen:

Former Member
0 Likes

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

costas_ioannou2
Active Participant
0 Likes

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.

Former Member
0 Likes

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

SAP-FICO
Discoverer
0 Likes

To send sales quotations for approval in SAP Business One, follow these steps:

  1. Create a Sales Quotation: Start by creating a sales quotation in SAP Business One. Enter the relevant customer and item information.

  2. Approval Template: Set up an approval template if you haven't already. Go to the "Administration" menu, select "Approval Procedures," and then "Approval Templates." Define the conditions under which the sales quotation needs approval.

  3. Assign Approval Stages: Assign the approval stages to the relevant users. This can be done in the "Approval Stages" section under "Approval Procedures."

  4. Submit for Approval: Once the sales quotation is ready, submit it for approval. This can be done by clicking the "Add" button. The system will automatically route the quotation to the designated approvers based on the approval template.

  5. Approval Process: The approvers will receive a notification and can review the sales quotation. They can approve or reject it and add comments if necessary.

  6. Final Approval: Once all approvers have approved the sales quotation, it will be marked as approved in the system, and you can proceed with further processing.