Skip to Content
0

Is it possible to get BusinessPartner by name?

Mar 06, 2017 at 03:01 PM

46

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Alex Dushkin Mar 07, 2017 at 03:08 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Edy Simon Mar 07, 2017 at 12:30 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded