Skip to Content

Problem with BP update

Hi!

I'm creating and updating business partner from external system and gets the famous error:

DI Error: (-2035) This entry already exists in the following tables (ODBC -2035)

The table name is not shown but it must be either CRD1 (BPAddresses) or OCPR (ContactEmployees) as it's the only nodes that I send in besides OCRD.

It seems that I handle the key value wrong as it only happens when updating an existing customer. Creating a new customer works ok.

This is how I do:

<BPAddresses>

     <row>

          <AddressName>Name of address</AddressName>

          <BPCode>existing cardcode</BPCode>

          <AddressType>bo_ShipTo</AddressType>

          ...

<ContactEmployees>

     <row>

          <InternalCode>existing CntctCode</InternalCode>

          <Name>existing name</Name>

          ...

The action is performed in a B1 Call atom. Here is the payload:

<Envelope xmlns="urn:com.sap.b1i.xcellerator:spltdoc">

     <Header>

          <Action throwException="true" autoCommit="false">add</Action>

          <WritePolicy insert_on_exists="fallback2U" update_policy="regular" update_on_miss="fallback2I"/>

     </Header>

     <Body>

          <BOM>

               <BO>

                    <AdmInfo>

                         <Object>2</Object>

                         <Version>2</Version>

                    </AdmInfo>

                    <QueryParams>

                         <CardCode>99848</CardCode>

                    </QueryParams>

                    <BusinessPartners>

                         <row>

                              <CardCode>99848</CardCode>

                              <CardName>Test Uppdatering 5</CardName>

                              <CardType>cCustomer</CardType>

                              <GroupCode>104</GroupCode>

                              <Notes>Lite allmän info</Notes>

                              <PayTermsGrpCode>1</PayTermsGrpCode>

                              <ShipToDefault>Leverans</ShipToDefault>

                              <CompanyPrivate>cPrivate</CompanyPrivate>

                         </row>

                    </BusinessPartners>

                    <BPAddresses>

                         <row>

                              <AddressName>Leverans</AddressName>

                              <Street>Kungsgatan 1</Street>

                              <ZipCode>15678</ZipCode>

                              <City>Stockholm</City>

                              <AddressType>bo_ShipTo</AddressType>

                              <BPCode>99848</BPCode>

                         </row>

                    </BPAddresses>

                    <ContactEmployees>

                         <row>

                              <InternalCode>33827</InternalCode>

                              <Name>Olof Gustafsson</Name>

                              <FirstName>Olof</FirstName>

                              <LastName>Gustafsson</LastName>

                         </row>

                    </ContactEmployees>

               </BO>

          </BOM>

     </Body>

</Envelope>

What is wrong with this payload?

I have checked tables OCRD, CRD1 and OCPR and all these entries exists. But are not updated.

B1 version is 9.1 PL07 SQL version.

Regards

Lars

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 04, 2015 at 01:39 PM

    Hi Lars,

    your issue seems to be caused by the address or the contact employees segment.

    In the update case, if either addresses or contacts are existing you need to update every address/contact line-by-line.

    Best regards

    Bastian

    P.S.: You're only updating the ship-to address, what is with the bill-to address? From my point of view you need to update two addresses minimum.

    Add comment
    10|10000 characters needed characters exceeded