想学习 SAP Business One 开发和使用 SDK
Would like to learn SAP Business One development and to use the SDK
我想知道如何为 SAP B1 编码,但我从哪里开始,我想要一个简单的解释。理想情况下 VB.net.
如果您安装了 SAP 和 SDK,可以在此处找到示例:
C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\COM DI\VB.NET
一段简单的 DI-API 更新销售机会的代码可能如下所示:
Private Function updateOpportunity(docEntry, type, value) As Boolean
'updates either interest or status on linked opportunity
'returns true if successful
Dim oCompany As SAPbobsCOM.Company = Application.SBO_Application.Company.GetDICompany
Dim oppToUpdate As SAPbobsCOM.SalesOpportunities = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesOpportunities)
oppToUpdate.GetByKey(docEntry)
If type = "Interest" Then
oppToUpdate.InterestLevel = value
ElseIf type = "Status" Then
oppToUpdate.Status = value
End If
If oppToUpdate.Update() <> 0 Then
Return False
Else
Return True
End If
End Function
这是一个向销售订单添加行的简单示例:
Try
Dim objCompany As SAPbobsCOM.Company = CType(Application.SBO_Application.Company.GetDICompany, SAPbobsCOM.Company)
objOrder = CType(objCompany.GetBusinessObject(docType), SAPbobsCOM.Documents)
objOrder.GetByKey(123456)
'Add Rows
With objOrder.Lines
'adds a blank row to order
.Add()
'insert all the data
.ItemCode = "myItemCode"
.Quantity = 20
.UnitPrice = 2.50
'save changes / test success
dim intResult = CByte(objOrder.Update())
If intResult = 0 Then
Application.SBO_Application.SetStatusBarMessage("Rows Added Successfully", SAPbouiCOM.BoMessageTime.bmt_Short, False)
End If
Catch ex As Exception
Application.SBO_Application.MessageBox("Add lines Failed " & objCompany.GetLastErrorDescription)
End Try
End Sub
我想知道如何为 SAP B1 编码,但我从哪里开始,我想要一个简单的解释。理想情况下 VB.net.
如果您安装了 SAP 和 SDK,可以在此处找到示例:
C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\COM DI\VB.NET
一段简单的 DI-API 更新销售机会的代码可能如下所示:
Private Function updateOpportunity(docEntry, type, value) As Boolean
'updates either interest or status on linked opportunity
'returns true if successful
Dim oCompany As SAPbobsCOM.Company = Application.SBO_Application.Company.GetDICompany
Dim oppToUpdate As SAPbobsCOM.SalesOpportunities = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oSalesOpportunities)
oppToUpdate.GetByKey(docEntry)
If type = "Interest" Then
oppToUpdate.InterestLevel = value
ElseIf type = "Status" Then
oppToUpdate.Status = value
End If
If oppToUpdate.Update() <> 0 Then
Return False
Else
Return True
End If
End Function
这是一个向销售订单添加行的简单示例:
Try
Dim objCompany As SAPbobsCOM.Company = CType(Application.SBO_Application.Company.GetDICompany, SAPbobsCOM.Company)
objOrder = CType(objCompany.GetBusinessObject(docType), SAPbobsCOM.Documents)
objOrder.GetByKey(123456)
'Add Rows
With objOrder.Lines
'adds a blank row to order
.Add()
'insert all the data
.ItemCode = "myItemCode"
.Quantity = 20
.UnitPrice = 2.50
'save changes / test success
dim intResult = CByte(objOrder.Update())
If intResult = 0 Then
Application.SBO_Application.SetStatusBarMessage("Rows Added Successfully", SAPbouiCOM.BoMessageTime.bmt_Short, False)
End If
Catch ex As Exception
Application.SBO_Application.MessageBox("Add lines Failed " & objCompany.GetLastErrorDescription)
End Try
End Sub