Skip to Content
0
Former Member
May 28, 2007 at 07:00 PM

insert BP adress

27 Views

i'm trying to insert ship to address an bill to address to a BusinessPartner using JAVA.

code:

IBusinessPartners ib = SBOCOMUtil.newBusinessPartners(company);

ib.setCardCode("994");

ib.setCardName(bp.getNome());

ib.setCardType(SBOCOMConstants.BoCardTypes_cCustomer);

ib.setEmailAddress(bp.getEMail());

ib.setPhone1(bp.getTelefone());

ib.setCellular(bp.getTelCel());

ib.setFax(bp.getFax());

ib.getUserFields().getFields().item("U_nomeMae").setValue(bp.getNomeMae());

ib.add();

System.out.println(company.getLastErrorDescription());

ib.getAddresses().setAddressName("Cobrança");

ib.getAddresses().setCurrentLine(0);

ib.getAddresses().setStreet(bp.getEndereco());

ib.getAddresses().setCity(bp.getCidade());

ib.getAddresses().setZipCode(bp.getCep());

ib.getAddresses().setAddressType(SBOCOMConstants.BoAddressType_bo_BillTo);

ib.getAddresses().setState("SP");

ib.getAddresses().setCountry("BR");

ib.getAddresses().setBlock("");

ib.getAddresses().add();

ib.getAddresses().setAddressName("Entrega");

ib.getAddresses().setCurrentLine(1);

ib.getAddresses().setStreet(bp.getEndereco());

ib.getAddresses().setCity(bp.getCidade());

ib.getAddresses().setZipCode(bp.getCep());

ib.getAddresses().setState("SP");

ib.getAddresses().setCountry("BR");

ib.getAddresses().setBlock("");

ib.getAddresses().setAddressType(SBOCOMConstants.BoAddressType_bo_ShipTo);

ib.getAddresses().add();

ib.setShipToDefault("Cobrança");

ib.update();

when I execute this code, It inserts the BP but it does not insert the adresses.

I get this message: <b>"The object's key is not set"</b>

What am i doing wrong?

Please, if anyone could help me, i'll apreciate it.

Even C# examples

tks

Elcio