on 07-06-2012 8:27 AM
What's the best 3rd Party SAP Business One Integration API ?
Hi Dickson,
Integration is a rather broad concept. Could you please be a bit more specific ? What exactly is it that you need to do ?
Regards,
Johan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have settled to use the Business One SDK. And i the DDL, SAPbobsCOM , May be you could assist me with sample codes for posting Invoices and Invoice Lines at the same time using C#.NET . I have the data in SQL Tables . See my current sample codes , SAPbobsCOM.Documents oINV = default(SAPbobsCOM.Documents); oINV = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices); oINV.CardName = ""; oINV.CardCode = ""; oINV.DocDate = ""; oINV.DocNum = 0; oINV.DocType = 1; oINV.HandWritten = ""; oINV.SalesPersonCode = 0; oINV.NumAtCard = ""; oINV.Comments = ""; oINV.DocCurrency = "";
Hi Dickson,
Take a look at the examples that come with the SDK. You can access them and the SDK help file from your All Programs menu.
I will give you one piece of advice though: when you create any document, try to populate as few properties as possible. If defaults in B1 have been set up properly, the DI API will fill in all the blanks.
In your example:
SAPbobsCOM.Documents oINV = default(SAPbobsCOM.Documents);
oINV = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);
oINV.CardName = ""; //No need, is inferred from CardCode
oINV.CardCode = ""; //This is the only mandatory property
oINV.NumAtCard = ""; //This one is optional
oINV.Comments = ""; //This one is optional
oINV.DocDate = ""; //This one gets set to current date automatically
oINV.DocNum = 0; //Don't set this one
oINV.DocType = 1; //Don't set this one
oINV.HandWritten = ""; //Don't set this one
oINV.SalesPersonCode = 0; //This one is optional
oINV.DocCurrency = ""; //No need, is inferred from CardCode
Regards,
Johan
The SDK is a bit funny with document lines.
Basically the first (empty) line exists. You fill it, and then you have to add a new line for each additional line that you want to add.
So in VB code (you'll have to translate it to C#) something like this:
For i As integer = 1 To YourLineCount Step 1
oINV.SetCurrentLine(i)
oINV.Lines.ItemCode = "blablabla"
oINV.Lines.Quantity = 12
oINV.Price = 5.6 //This one is optional, prices will be inferred from the CardCode, if a price list was determined for this business partner
If YourLineCount > i Then oINV.Lines.Add()
Next
Message was edited by: Johan Hakkesteegt: I forgot the SetCurrentLine method.
With user fields, the trick is to populate the field with the correct data type. So if the user field was set up to contain string values, you must assign a string value.
On the header level user fields are populated like this:
oINV.UserFields.Fields.Item("U_NameOfYourUserField").Value = SomeValue
On the row level:
oINV.Lines.UserFields.Fields.Item("U_NameOfYourUserField").Value = SomeValue
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.