1 Reply Latest reply on Dec 31, 2015 8:32 AM by Bashar.

    Unable to update job title in HZ_org_contacts

    user8653543

      I am getting the below error while updating the job title in hz_org_contact using the API

       

      "This record in table hz_org_contacts cannot be locked as it has been updated by another user."

       

      I do not find an input parameter in the API to submit the object_version_number of the hz_org_contact . My code is as below. Please help

       

      DECLARE

        p_org_contact_rec HZ_PARTY_CONTACT_V2PUB.ORG_CONTACT_REC_TYPE;

        p_cont_object_version_number   NUMBER := 1;

        p_rel_object_version_number   NUMBER := 1;

        p_party_object_version_number   NUMBER := 1;

        p_relationship_party_id NUMBER;

        x_return_status       VARCHAR2(1);

        x_msg_count           NUMBER;

        x_msg_data            VARCHAR2(4000);

      BEGIN

          p_org_contact_rec.job_title                         := NVL(NULL,FND_API.g_null_char);

         -- p_org_contact_rec.object_version_number             := 1;

          p_org_contact_rec.org_contact_id                    := 1395039;

          p_relationship_party_id                             := 2782091;

          p_org_contact_rec.party_rel_rec.subject_id          := 2782090; --Contact Person Party Id

          p_org_contact_rec.party_rel_rec.object_id           := 2776090; --Organization Party Id

       

       

          SELECT object_version_number

           INTO p_cont_object_version_number

           FROM hz_parties

          WHERE party_id = p_org_contact_rec.party_rel_rec.subject_id;

         

           SELECT object_version_number

           INTO p_party_object_version_number

           FROM hz_parties

          WHERE party_id = p_org_contact_rec.party_rel_rec.object_id;

         

          SELECT object_version_number

           INTO p_rel_object_version_number

           FROM hz_parties

          WHERE party_id = p_relationship_party_id ;

         

         

          hz_party_contact_v2pub.update_org_contact(

                                                            p_init_msg_list                       =>   'T'                ,

                                                            p_org_contact_rec                     =>   p_org_contact_rec     ,

                                                            p_cont_object_version_number          =>   p_cont_object_version_number      ,

                                                            p_rel_object_version_number           =>   p_rel_object_version_number        ,

                                                            p_party_object_version_number         =>   p_party_object_version_number            ,

                                                            x_return_status                       =>   x_return_status       ,

                                                            x_msg_count                           =>   x_msg_count           ,

                                                            x_msg_data                            =>   x_msg_data

                                                         );

          DBMS_OUTPUT.PUT_LINE('API Status: '||x_return_status);

       

       

          IF (x_return_status <> 'S')

          THEN

             DBMS_OUTPUT.PUT_LINE('ERROR :'|| x_msg_data );

          END IF;

       

          DBMS_OUTPUT.PUT_LINE('update_org_contact is completed');

       

       

          --COMMIT;

      EXCEPTION

          WHEN OTHERS

          THEN

             DBMS_OUTPUT.PUT_LINE('Error::::'||SQLERRM);

             ROLLBACK;

      END;