Skip to Content

Error creating the Issue for Production

Hello everybody,

I'm doing a development DI-API to generate a issue for production and I have the following error:

"This entry already exists in the following tables (ODBC -2035)"


The problem happens when emissions contain resources to which they were assigned costs in the Resource Master Data.



If I put the costs at 0, no problems. I have version 9.2 PL03 and when I had the version 9.1 PL04 the development work.


The following is an example of my code:

Dim Cantidad As Double = 5
 Dim lr As Long
 Dim oDoc As SAPbobsCOM.Documents = Nothing
 Dim sKey As String = ""
 Dim oRcs As SAPbobsCOM.Recordset
 Dim ls As String = ""

 try
 oDoc = oCompany.GetBusinessObject(oInventoryGenExit)
 oDoc.DocDate = GetFechaContable()
 oDoc.DocDueDate = Now.Date
 oDoc.DocumentsOwner = “Operario”
 oDoc.Comments = "Marcaje Final Operario: Operario " & Now.ToString("dd/MM/yyyy HH:mm:ss")
 If Cantidad <> 0 Then
 ls = ""
 ls = ls & "SELECT T1.wareHouse, T1.LineNum "
 ls = ls & "FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.DocEntry=T1.DocEntry "
 ls = ls & "LEFT JOIN OITM T3 ON T1.ItemCode = T3.ItemCode "
 ls = ls & "INNER JOIN OWHS T4 ON T1.wareHouse= T4.WhsCode "
 ls = ls & "LEFT JOIN OITW T5 ON T1.ItemCode = T5.Itemcode AND T1.wareHouse=T5.WhsCode "
 ls = ls & "INNER JOIN OITM T6 ON T0.ItemCode = T6.ItemCode "
 ls = ls & "LEFT JOIN ORSC T7 ON T1.ItemCode = T7.ResCode "
 ls = ls & "WHERE T1.DocEntry=" & Me.DocEntryOF
 ls = ls & " AND T1.ItemCode = '" & NullToText(Me.txtFase.Text) & "'"

 oRcs = oCompany.GetBusinessObject(BoRecordset)
 oRcs.DoQuery(ls)

 If Not oRcs.EoF Then
 oDoc.Lines.SetCurrentLine(0)
 oDoc.Lines.BaseType = 0 ' WorkOrders (O.F)
 oDoc.Lines.BaseEntry = Me.DocEntryOF
 oDoc.Lines.BaseLine = NullToInt(oRcs.Fields.Item(1).Value)
 oDoc.Lines.WarehouseCode = NullToText(oRcs.Fields.Item(0).Value)
 oDoc.Lines.Quantity = Cantidad
 End If
 End If

 If Cantidad <> 0 Then
 lr = oDoc.Add

 If lr = 0 Then

 PrintLinea("Marcaje Final Operario: Operario ")
 Else
 Throw New Exception(RecuperarErrorSap())
 End If
 End If

 Catch ex As Exception
 Throw New Exception("Emisión " & ex.Message)
        End Try


Kind regards.

Captura1.JPG (49.9 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Aug 11, 2016 at 02:53 PM

    Hi Jose,

    Not sure what is happening but I saw something wrong in your code, your Lines.BaseType, it should be based in a Production order I guess.

    oDoc.Lines.BaseType = BoObjectTypes.oProductionOrders

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.