cancel
Showing results for 
Search instead for 
Did you mean: 

What's the best 3rd Party SAP Business One Integration API ?

Former Member
0 Kudos

What's the best 3rd Party SAP Business One Integration API ?

Accepted Solutions (0)

Answers (1)

Answers (1)

Johan_H
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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 = "";

Johan_H
Active Contributor
0 Kudos

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

Former Member
0 Kudos

You are highly appreciated,   Now what about invoice lines ? how do i add invoice line to the above code ?  I have like 10 to 15 per invoice .

Former Member
0 Kudos

How do reference the custom fields ?  I have 2 fields custom and i need to insert data into them .

Johan_H
Active Contributor
0 Kudos

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.

Johan_H
Active Contributor
0 Kudos

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