Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Create Invoice From Draft - Internal Error

Dear Experts,

I have created one DRAFT Document for Invoice. After Creating this Draft , i want to update some line level data in the draft . After this changes done , I have to  create AR Invoice from this Draft document. But while am UPDATING the Draft , am getting "INTERNAL ERROR (-10)".

My Code :

StrSql = "SELECT DocEntry FROM ODRF WHERE U_RefNo = '" & strReciptNo & "'"

            objRecset.DoQuery(StrSql)

            If objRecset.EoF = False Then

                Dim ODrafts As SAPbobsCOM.Documents

                ODrafts = objSBOAPI.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDrafts)

                If ODrafts.GetByKey(objRecset.Fields.Item("DocEntry").Value) = True Then

                    For i = 0 To ODrafts.Lines.Count - 1

                        ODrafts.Lines.SetCurrentLine(i)

                        Dim BatchQty, RemainQty, TotQty, NumInSales As Double

                        StrItemCode = ODrafts.Lines.ItemCode

                        TotQty = ODrafts.Lines.Quantity

                         ODrafts.Lines.WarehouseCode = StrBranchCode

                          ODrafts.Lines.CostingCode = StrBranchCode

                        ODrafts.Lines.Quantity = TotQty

                      

                        ODrafts.Lines.UnitPrice = ODrafts.Lines.UnitPrice

     Next

                    Dim RetCode As Integer

                    Retcode = ODrafts.Update()  

                    MsgBox(objSBOAPI.oCompany.GetLastErrorDescription)

                   

                    If ODrafts.SaveDraftToDocument = 0 Then ' for Adding to draft documents

     endif

  End If

            End If

How can solve this issue ?

Thanks in advance

Senthil.K

Former Member
Not what you were looking for? View more on this topic or Ask a question