Skip to Content
avatar image
Former Member

Is it possible to get BusinessPartner by name?

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 07, 2017 at 03:08 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 07, 2017 at 12:30 AM

    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

    Add comment
    10|10000 characters needed characters exceeded