cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to get BusinessPartner by name?

Former Member
0 Kudos

Hello everyone!

Is it possible to get BusinessPartner by name or any other information apart from CardCode using SAPBusinessOneSDK.dll?

Provide me with some code sample if its possible.

Waiting for the answer.

Respectfully, Alex.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi everyone.

Thank you, Edy, for your comment.

This is how I solved the problem.

Maybe this code sample will help someone.

Using code below I get all the customers for the company.

I get Name, CardCode and Type of the customer.

If you have the CardCode, you can get all the info about the customer using

BusinessPartners bp = (BusinessPartners)company.GetBusinessObject(BoObjectTypes.oBusinessPartners); bp.GetByKey(dataTable.Rows[0][0].ToString());

SAPbobsCOM.SBObob oObj;
SAPbobsCOM.Recordset rs;
DataTable dataTable = new DataTable("table");
dataTable.Columns.Add("Code");
dataTable.Columns.Add("Name");
dataTable.Columns.Add("Type");
oObj = (SAPbobsCOM.SBObob)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge);
rs = oObj.GetBPList(SAPbobsCOM.BoCardTypes.cCustomer);
rs.MoveFirst();
for (int i = 0; i < rs.RecordCount; i++)
{
  dataTable.Rows.Add(rs.Fields.Item(0).Value, rs.Fields.Item(1).Value, rs.Fields.Item(2).Value);
  rs.MoveNext();
}

Respectfully, Alex.

Answers (1)

Answers (1)

edy_simon
Active Contributor
0 Kudos

Hi Alex,

AFAIK, if you need to get by cardname or any other field, you need to execute the Recordset object first to get the CardCode,
And then pass the CardCode into the SAPbobsCOM.BusinessPartners object.

Regards
Edy