on 03-06-2017 3:01 PM - last edited on 02-03-2024 9:32 PM by postmig_api_4
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
6 | |
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.