Showing results for 
Search instead for 
Did you mean: 

How to get the Ship To TaxCode of a Business Partner

Former Member
0 Kudos


As I try to get the bp.Addresses.TaxCode, I get nothing because

in the CRD1 table there are 2 entry for this business partner

one with Null and one with the TaxCode I want.

I dont know how to get the Taxcode that is choosen in the Ship To TaxCode property

Thank you

View Entire Topic
Former Member
0 Kudos

Hi Marc,

The business partner can have multiple addresses. You can loop through the address collection with a for loop and check if it is blank. If it is blank, go to the next address with SetCurrentLine(i). Loop until you get something or when you reach the end of the addresses and exit the for loop.

Hope it helps,


Former Member
0 Kudos


I tought that this could work but it doesn't

for (int iAdress = 0; iAdress < bp.Addresses.Count; iAdress++)

if (bp.Addresses.AddressType == BoAddressType.bo_ShipTo)


It never get to the bp.Addresses.SetCurrentLine(iAdress);

as if there isn't any bo_ShipTo which is not right because there is one with a TaxCode of NY

I'm confused...

Former Member
0 Kudos

Hi Marc,

Put the setcurrentline statement before your if statement. Here's a vb example:

            Dim oBP As SAPbobsCOM.BusinessPartners
            Dim i As Integer
            oBP = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
            For i = 0 To oBP.Addresses.Count - 1
                If oBP.Addresses.AddressType = SAPbobsCOM.BoAddressType.bo_ShipTo Then
                    sTaxCode = oBP.Addresses.TaxCode
                    Exit For
                End If

Hopeit helps,


Former Member
0 Kudos


Yeah I figured out.

This would have been so much easier if they would have made the Adresses an indexer so we just have to say like

TaxCode = bp.Addresses[BoAddressType.bo_ShipTo].TaxCode

OR even better, a Method in the Adresses

TaxCode = bp.Addresses.GetTaxCode();

Ah well,

Here's my own method for those who want it

public static string SAPGetTaxCode(SAPbobsCOM.BPAddresses Addresses)


string TaxCode = "";

for (int iAdress = 0; iAdress < Addresses.Count; iAdress++)



if (Addresses.AddressType == SAPbobsCOM.BoAddressType.bo_ShipTo)

TaxCode = Addresses.TaxCode;


return TaxCode;


Thank you for your help.