Hi all,

A question I get often from new SDK developers is:

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?

Once a customer is picked an empty row appears in the grid, waiting to receive the first item for sale.
Also notice that the Posting Date is automatically populated with the current date. As is the Document Date.
So you pick an item.
If you try to click “Add” at this point, you will see the message that has frustrated ever order entry user since the Creation of SAP Business One:

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

  1. Dim oOrder As SAPbobsCOM.Documents = oCompany.GetBusinessObject(oOrders)
  2. oOrder.CardCode = “MyCust1”
  3. oOrder.DocDueDate = Now
  4. oOrder.Lines.ItemCode = “MyItem1”
  5. If oOrder.Add = 0 Then
  6.   MsgBox(“Order Created!”)
  7. Else
  8.   MsgBox(oCompany.GetLastErrorDescription())
  9. End If
  10. 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.

p 514-830-7997 a Montreal, QC

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply