Skip to Content
avatar image
Former Member

how to create/update sales opportunities with multiple stage in sap b1 sdk through DIAPI

oFormUDF = ClsSBOAddOn.SBOApplication.Forms.GetForm("-133", 1);
                iOprqNo = Convert.ToInt32(((SAPbouiCOM.EditText)oFormUDF.Items.Item("U_OPRNO").Specific).Value.ToString());
                oSalesOpprtunities = (SAPbobsCOM.SalesOpportunities)ClsSBOAddOn.SBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesOpportunities);
                int iLine = 0;
               // int iRow = oMatrix.VisualRowCount;
                if (oSalesOpprtunities.GetByKey(iOprqNo) == true)
                {
                    if (iLine < oSalesOpprtunities.Lines.Count)
                    {
                        //oSalesOpprtunities.Lines.SetCurrentLine(iLine);
                        oSalesOpprtunities.Lines.MaxLocalTotal = 200;
                        string assa = oSalesOpprtunities.Lines.Count.ToString();
                        oSalesOpprtunities.Lines.SetCurrentLine(oSalesOpprtunities.Lines.Count-1);


                        //if (oSalesOpprtunities.Lines.LineNum == Convert.ToInt32(sOOPline))
                        //{
                        oSalesOpprtunities.Lines.DocumentNumber = Convert.ToInt32(oDBHeader.GetValue("DocEntry", 0));


                        iOprtStatus = oSalesOpprtunities.Update();
                        if (iOprtStatus != 0)
                        {
                            int ErrorCode = 0;
                            string ErrorMessage = "";
                            ClsSBOAddOn.SBOCompany.GetLastError(out ErrorCode, out ErrorMessage);
                            BubbleEvent = true;
                            return;
                        }
                        //break;
                        // }
                        iLine++;
                    }




                }
<br>

My Code

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    May 05, 2017 at 05:35 PM

    also give one Error : Cannot update closed row [OPR1.Line][line: 1]

    Add comment
    10|10000 characters needed characters exceeded

  • May 05, 2017 at 10:03 AM

    Hi mohammad asharaf,

    Here is how to update an existing Stage on the Sales Opportunity:

    SAPbobsCOM.SalesOpportunities oSalesOppr = (SAPbobsCOM.SalesOpportunities)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesOpportunities);
    oSalesOppr.GetByKey(69);
    oSalesOppr.Lines.StageKey = 1;
    oSalesOppr.Lines.StartDate = DateTime.Today.AddDays(2);
    int Up = oSalesOppr.Update();
    

    Kind regards,

    ANKIT CHAUHAN

    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded