Skip to Content
author's profile photo Former Member
Former Member

insert BP adress

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on May 29, 2007 at 08:05 AM

    Trying adding a GetByKey after the add ...

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 29, 2007 at 10:53 AM

    Try this :

    Remove "ib.update();"

    Move the "ib.add();" and the end (in place of "ib.update();")

    Delete the last "ib.getAddresses().add();"

    (you have to call "ib.getAddresses().add();" before adding address and not after, but it is not needed for the first address)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.