Tuesday 8 September 2020

Customer Name Update API

 SET SERVEROUTPUT ON;

SET DEFINE OFF;

DECLARE

  l_organization_rec    HZ_PARTY_V2PUB.ORGANIZATION_REC_TYPE;

  l_party_rec           HZ_PARTY_V2PUB.PARTY_REC_TYPE;

  --l_party_obj_version NUMBER;

  x_profile_id          NUMBER;

  x_return_status VARCHAR2(1);

  x_msg_count  NUMBER;

  x_msg_data  VARCHAR2(4000);



CURSOR C1 IS SELECT ICNU.CUST_NUMBER, ICNU.CURR_NAME, ICNU.CORRECT_NAME, ICNU.STATUS, HCA.PARTY_ID, 

                hp.OBJECT_VERSION_NUMBER

             FROM XX_CUST_NAME_UPD_TBL ICNU, apps.hz_cust_accounts_all HCA, HZ_PARTIES HP

             WHERE ICNU.STATUS IS NULL

             AND HCA.PARTY_ID = HP.PARTY_ID

             AND ICNU.CUST_NUMBER = HCA.ACCOUNT_NUMBER;

BEGIN

    FOR I IN C1 LOOP

    l_party_rec.party_id                          := I.PARTY_ID;

    l_organization_rec.organization_name          := I.CORRECT_NAME;

    l_organization_rec.party_rec                  := l_party_rec;

    HZ_PARTY_V2PUB.update_organization(p_init_msg_list               => FND_API.G_TRUE,

                                       p_organization_rec            => l_organization_rec,

                                       p_party_object_version_number => I.OBJECT_VERSION_NUMBER,

                                       x_profile_id                  => x_profile_id,

                                       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 );

       UPDATE XX_CUST_NAME_UPD_TBL SET STATUS = 'E'

       WHERE CUST_NUMBER = I.CUST_NUMBER;

       ELSE 

       UPDATE XX_CUST_NAME_UPD_TBL SET STATUS = 'S'

       WHERE CUST_NUMBER = I.CUST_NUMBER;

    END IF;


    DBMS_OUTPUT.PUT_LINE('update_organization is completed');

END LOOP;

    --COMMIT;

EXCEPTION

    WHEN OTHERS

    THEN

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

       ROLLBACK;

END;

1 comment:

  1. Databases can store large amounts of data efficiently. Using a database, you can easily retrieve, update, and delete data. Databases can be searched and retrieved quickly. These days, data is heavily used by businesses, government, and marketing. Users, applications, and the database itself catch and analyze data with the database administration system. Additionally, the DBMS software comes with the tools required for administering the database. It also allows for a detailed history of all processes. The database is used to optimize queries. Database technologies are used by many organizations to protect, maintain, and optimize operational support. Database consultants are hired to fix outdated databases, review firm intentions, and design resolutions that can help a growing business enterprise. GENEX is the best database provider and consultancy in India. They support world-class technology for database systems. Here we can see the specialty of genex database consulting support.

    https://genexdbs.com/

    ReplyDelete