Hi to all
Im doing a program that will be activated inside SBO, the program will be get all data needed using select statements and then dump into a grid. Pressing a button from the grid will make this records into a invoice document, My problem , when running the program, it seems nothing happen, no error message, no invoice docs where created ,
Tracing the program, the program stops and return to SBO , when a variable/value (existing bp) assigned to invoice.cardcode
Pls code
Dim oForm As SAPbouiCOM.Form = oApp.Forms.Item("FrmGridFLU")
Dim oGridMatrix As SAPbouiCOM.Grid = oForm.Items.Item("UIDGrid").Specific
Dim RecCnt, jRecordCount As Integer
Dim value1 As String
Dim value2 As Date
Dim value3 As Decimal
oCompany.StartTransaction()
RecCnt = oGridMatrix.Rows.Count
For jRecordCount = 0 To RecCnt - 1
Dim oEdit1, oEdit2, oEdit3 As SAPbouiCOM.Item
'oEdit1 = oMatrix.Columns.Item("CardCode").Cells.Item(jRecordCount).Specific
'value1 = oEdit1.Value
'oEdit2 = oMatrix.Columns.Item("DueDate").Cells.Item(jRecordCount).Specific
'value2 = oEdit2.value
'oEdit3 = oMatrix.Columns.Item("DueAmount").Cells.Item(jRecordCount).Specific
'value3 = oEdit3.value
value1 = "1000001"
value2 = "12/03/2008"
value3 = 1000.6
jRecordCount = jRecordCount + 1
Try
oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
oInvoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Service
oInvoice.CardCode = "1000001"
'oInvoice.Comments = "Data Interface - DR NO : " & oDR.DocNum
'oInvoice.NumAtCard = "DR NO :" & oDR.DocNum
oInvoice.DocDate = value2
'----
Invoice Details -
oInvoice.Lines.ItemDescription = "Loren Flores"
'oInvoice.Lines.AccountCode = oDR.Lines.AccountCode
oInvoice.Lines.LineTotal = value3
'oInvoice.Lines.BaseLine = oDR.Lines.LineNum
oInvoice.Lines.Add()
Dim oDocNum As String
If oInvoice.Add <> 0 Then
MsgBox("Error " + oCompany.GetLastErrorDescription())
Else
oDocNum = oCompany.GetNewObjectKey()
'Insert2OCTP(vDocNum, vDocDate, oDocNum, Now.ToShortDateString, vCardCode, vCardName)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
'----
Invoice Header -
jRecordCount = jRecordCount + 1
Next
oCompany.EndTransaction(BoWfTransOpt.wf_Commit)
Thanks
Loren