on ‎2011 Jul 11 2:37 PM
Hello!
Could you please answer to my question?
Does anybody have SDK-code example (VB, C#), which creates new document in SAPb1. Something like this:
http://www.youtube.com/watch?v=tWEnK4WUQ64
Is it possible in default version of SDK? What documentation shoud I read?
Request clarification before answering.
Hi,
see this path in your system,
C:\Program Files\SAP\SAP Business One SDK\Samples
Regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've checked DI and UI examples and documentation and have found a working code example.
My last question: How can i get the SAP number of created document? Is it possible, does any property or method of document class exist?
Or I have to create user column "number" in Sap and find my docs using this column?
Working VB-code example:
Dim oOrder As New SAPbobsCOM.Documents ' Order object
Dim lRetCode As Integer ' Return Code
' New Order
Set oOrder = oCompany.GetBusinessObject(SAPbobsCOM.oOrders)
' Fill Order details
oOrder.CardCode = "C40000"
oOrder.CardName = "Earthshaker Corporation"
oOrder.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO
oOrder.DocDate = Now()
oOrder.DocDueDate = Now()
oOrder.DocCurrency = "USD"
'Fill 2 lines in the order
oOrder.Lines.ItemCode = "A00001"
oOrder.Lines.ItemDescription = "IBM Inforprint 1312"
oOrder.Lines.Quantity = 1
oOrder.Lines.Price = 380
oOrder.Lines.TaxCode = "0"
oOrder.Lines.LineTotal = 380
oOrder.Lines.Add
oOrder.Lines.ItemCode = "A00002"
oOrder.Lines.ItemDescription = "IBM Infoprint 1222"
oOrder.Lines.Quantity = 1
oOrder.Lines.Price = 380
oOrder.Lines.TaxCode = "0"
oOrder.Lines.LineTotal = 380
' Now we want to delete the second line in the Order
oOrder.Lines.Delete
' The Order will be added without the second line
lRetCode = oOrder.Add
If lRetCode <> 0 Then
oCompany.GetLastError lErrCode, sErrMsg
MsgBox "Error ¹" & lRetCode & sErrMsg
Else
MsgBox "Norm"
End If
Is that the only way to find Order Number: find max(OrderNum) + 1 before creating order:
Dim sSQL = "SELECT TOP 1 DocNum FROM dbo.ORDR ORDER BY DocNum DESC"
rs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
rs.DoQuery(sSQL)
txtNo.Text = rs.Fields.Item(0).Value + 1And after that create an order:
oOrder.DocNum = txtNo.TextThis is the way, but I think it is no t clear (in case many sessions in the same time).
Hi,
Welcome you post on the forum.
The video is not for B1. It is for R3. You can find all sample codes from SDK help folder. Have you checked?
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I didn't find and example (SDK UI).
The author of that video wrotes:
"
This macro writen in VBA. Using SAP B1 UI API you can reach any object of the system (User defined object also). This is indirect interaction. Just push a button and the datas from excel spreedshet gettin' into SAP Business One.
"
Is that true? Or I need to buy license for DI? Can I create a new order using SDK UI? I really can't understand.
| User | Count |
|---|---|
| 25 | |
| 12 | |
| 10 | |
| 9 | |
| 5 | |
| 5 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.