Billi Business Partner

Hello the method : BusinessPartnerCollection.GetBusinessPartnerCollection list to me de Business Partner collection , but in the BusinessCountry,BusinessCity for example only permit the GET is read only . cant’n update or create a new one , i need, update the Business Partner data from SAP to your SYSTEM QUANTIFY Including Address. plaese can you tell me how a do this whit the methods of you API , thanks

Hello. To set the address you need to set the one on the collection.

partner.Addresses[AddressType].BusinessCity = “New City Name”;

if i wan update ? the address. only admit create ?

If you want to update the address on a customer/vendor then use one of the code blocks below.

// Fetch for update
BusinessPartner company = BusinessPartner.GetBusinessPartner(…)
// Update Address here
company = company.Save();

// Create new
BusinessPartner company = BusinessPartner.New…(…)
// Update Address here
company = company.Save();

Before saving you should also check to see if the object is valid

// See if valid
if (company.BrokenRules.Count > 0)
// Not valid

Excuse me, but it will not allow me when I try to update the address or contact information of the business partner, it tells me that it does not accept this because it is read only.

Gravedad Código Descripción Proyecto Archivo Línea Estado de supresión
Error CS0200 No se puede asignar a la propiedad o el indizador ‘BusinessPartner.Addresses’ porque es de solo lectura ConsoleApplication1 C:\Users\admin\Documents\Visual Studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 69 Activa

Here’s some sample code that creates a customer, saves it, fetches it again (by number, just one of the options), and then fills out the billing address.

        // Add customer
        BusinessPartner cust = BusinessPartner.NewBusinessPartner(PartnerTypes.Customer);
        cust.Name = "Customer Name";
        cust.PartnerNumber = "999999";

        // Fetch customer added above, by number
        cust = BusinessPartner.GetBusinessPartnerByNumber("999999");
        // Address
        cust.Addresses.GetAddressByType(AddressTypes.Billing).Street = "1201 Mason St";
        cust.Addresses.GetAddressByType(AddressTypes.Billing).City = "San Francisco";
        cust.Addresses.GetAddressByType(AddressTypes.Billing).StateName = "CA";
        cust.Addresses.GetAddressByType(AddressTypes.Billing).PostalCode = "94108";
        cust.Addresses.GetAddressByType(AddressTypes.Billing).Country = "USA";

hello ,
Could not save

Hello, and the previous post can ignore it, now I’m having trouble creating an address to business partner when it does not exist ie if it exists to update it, but if not create it. Can give me an example of this. regards

Hello. Yes, the object validation has a little bit of a learning curve. I’ve created a topic for this. I think this will allow you to see what’s wrong. Link below, please send back some sample code if this doesn’t shed light on the situation.