Tuesday, March 22, 2011

API to Update a Customer Account TCA R12 (HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCOUNT)


                                                                                                                                                 
DESCRIPTION: 
This Wrapper script helps to update a Customer account information in the HZ_CUST_ACCCONTS table.
API:   HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCOUNT
BASE TABLES AFFECTED :  HZ_CUST_ACCOUNTS
TEST INSTANCE : R12.1.3

SCRIPT:

SET SERVEROUTPUT ON;
DECLARE
p_cust_account_rec      HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
p_object_version_number NUMBER;
x_return_status         VARCHAR2(2000);
x_msg_count             NUMBER;
x_msg_data              VARCHAR2(2000);

BEGIN
-- Setting the Context --
mo_global.init('AR');
fnd_global.apps_initialize ( user_id      => 1318
                            ,resp_id      => 50559
                            ,resp_appl_id => 222);
mo_global.set_policy_context('S',204);
fnd_global.set_nls_context('AMERICAN');

-- Initializing the Mandatory API parameters
p_cust_account_rec.cust_account_id := 150734;
p_cust_account_rec.customer_type   := 'R';  -- Should be available under the lookup_type "CUSTOMER_TYPE"
p_cust_account_rec.account_name    := 'TCA - Account';
p_object_version_number            := 1;

DBMS_OUTPUT.PUT_LINE('Calling the API hz_cust_account_v2pub.update_cust_account');

HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCOUNT
                  (
                    p_init_msg_list         => FND_API.G_TRUE,
                    p_cust_account_rec      => p_cust_account_rec,
                    p_object_version_number => p_object_version_number,
                    x_return_status         => x_return_status,
                    x_msg_count             => x_msg_count,
                    x_msg_data              => x_msg_data
                          );

IF  x_return_status = fnd_api.g_ret_sts_success THEN
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('Updation of Customer Account is Successful ');
    DBMS_OUTPUT.PUT_LINE('Output information ....');   
    dbms_output.put_line('Object Version Number ='||p_object_version_number);
     
ELSE
    DBMS_OUTPUT.put_line ('Updation of Customer Account got failed:'||x_msg_data);
    ROLLBACK;
    FOR i IN 1 .. x_msg_count
    LOOP
      x_msg_data := fnd_msg_pub.get( p_msg_index => i, p_encoded => 'F');
      dbms_output.put_line( i|| ') '|| x_msg_data);
    END LOOP;
END IF;
DBMS_OUTPUT.PUT_LINE('Completion of API');
END;
/

1 Responses to “API to Update a Customer Account TCA R12 (HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCOUNT)”

Shagul.H said...
April 21, 2019 at 5:34 AM

nice


Post a Comment

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.