Skip to Content

How to get Account name by querying of Business Partner with contactID

Aug 31, 2017 at 12:20 PM


avatar image
Former Member


By querying with ContactID I get all address information from BussinessPartner. But Account Name can't be extracted from object model.

Is It possible to get Account Name from BusinessPartner by querying with ContactID?

Pls help me.

Thanks and Regards,


contact.png (12.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Saurabh Kabra
Aug 31, 2017 at 05:43 PM

Hi Swati,

You can refer following code:

import ABSL;
import AP.FO.BusinessPartner.Global;
var q = BusinessPartner.QueryByIdentification;
var p = q.CreateSelectionParams();
p.Add( q.InternalID, "I", "EQ", "1042044"); // Contact ID for whcih account name to be identified
var r = q.Execute(p);
if (r.GetFirst().IsSet())
var n = r.GetFirst();
	if (n.BusinessPartnerRelationship.GetFirst().IsSet())
		var t = n.BusinessPartnerRelationship.GetFirst();
		if ( t.IsSet())
			var b = t.FirstBusinessPartner;
			if ( b.IsSet())
				var name = b.CurrentCommon.Organisation.Name.FirstLineName;
				var sort = b.CurrentCommon.SortingFormattedName;



Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Saurabh,

Thank you very much for helping me with a prompt and nice code.

Furthermore, pls help me to get the values of Contact Permission, Title and Job Title by querying with ContactID.

Thanks again