DI API Properties – Minimum Requirements?
Hi all,
How do you know what needs to be set in order for the transaction to work?
Asked another way would be:
What are the minimum properties I can set in order for the transaction to go through?
The answer to both of these questions is actually quite simple:
Go try it in the client!
Go try it in the SAP Business One Client
In order to learn what fields need to be set in the SDK, just go in the client and test it within the application.
Lets take creating a sales order for example. Open the Sales Order screen.
The first thing you need to do is pick a customer. The system will not let you do much else.
Once you pick a customer, what else do you notice?
I am not saying it’s a bug, it’s actually a perfect feature to ensure that a proper delivery date is set for that order. The delivery date is used everywhere for Warehouse planing, inventory projections, purchasing and more.
But every user forgets to set the date prior to created the order at least 10 times a day for the first couple of weeks.
So where am I going with all this?
My point is that the SDK is programmed with the same business rules as the client. So if you are having a hard time using a particular object or you want to know what are the essential information to pass to the object, just try it in the client!
Here is the minimal code for creating a Sales Order
- Dim oOrder As SAPbobsCOM.Documents = oCompany.GetBusinessObject(oOrders)
- oOrder.CardCode = “MyCust1”
- oOrder.DocDueDate = Now
- oOrder.Lines.ItemCode = “MyItem1”
- If oOrder.Add = 0 Then
- MsgBox(“Order Created!”)
- Else
- MsgBox(oCompany.GetLastErrorDescription())
- End If
- oOrder = Nothing
Notice fields being set:
Pick a customer, set the due date and push an item. That’s it!
You don’t need to worry about the Posting Date, or even setting the Qunatity or price of the item. the SDK automatically gets the selling price based on the customer you chose, the Date Sold and set the quantity to 1 by default. So if those values are fine then you are goo to go!
I hope this helps someone better understand the inner workings of the SDK.
Regards,
Originally posted on my Blog: B1Tech.tips
SAP Business One Tech Tips: DI API Properties – Minimum Requirements?
Denis Doiron
Certified ERP Consultant, Acabuco Inc. |
|