Thursday, March 10, 2016

‘API to update a Customer Account Relationship TCA R12 (HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCT_RELATE)’

API to update a Customer Account Relationship TCA R12 (HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCT_RELATE)





This routine is used to update a Customer AccountRelationship. The API updates accounts in the HZ_CUST_ACCT_RELATE table. There are two overloaded procedures for this API. One updates active customer  account relationship records only. The other with rowid in the signature updates customer account relationship records based on the rowid.

API:   HZ_CUST_ACCOUNT_V2PUB.UPDATE_CUST_ACCT_RELATE
BASE TABLES AFFECTED :  HZ_CUST_ACCT_RELATE
TEST INSTANCE : R12.1.3

SCRIPT:
/* Formatted on 2011/03/20 13:45 (Formatter Plus v4.8.8) */
SET SERVEROUTPUT ON;
DECLARE
  P_INIT_MSG_LIST VARCHAR2(200);
  P_CUST_ACCT_RELATE_REC APPS.HZ_CUST_ACCOUNT_V2PUB.CUST_ACCT_RELATE_REC_TYPE;
  X_RETURN_STATUS VARCHAR2(200);
  X_MSG_COUNT NUMBER;
  X_MSG_DATA VARCHAR2(200);

  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_object_version_number                        := 1;
  P_CUST_ACCT_RELATE_REC.cust_account_id         := 150734;
  P_CUST_ACCT_RELATE_REC.related_cust_account_id := 151734;
  P_CUST_ACCT_RELATE_REC.relationship_type       := 'Parent';
  P_CUST_ACCT_RELATE_REC.created_by_module       := 'BO_API';

  DBMS_OUTPUT.PUT_LINE('Calling the API HZ_CUST_ACCOUNT_V2PUB.update_cust_acct_relate');

  HZ_CUST_ACCOUNT_V2PUB.update_cust_acct_relate
                (
                 p_init_msg_list         => FND_API.G_TRUE,
                 P_CUST_ACCT_RELATE_REC  => P_CUST_ACCT_RELATE_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 Relationship is Successful ');   
  ELSE
    DBMS_OUTPUT.put_line ('Updation of Customer Relationship 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;
/


No comments:

Post a Comment

How to improve blog performance

Improving the performance of a blog can involve a variety of strategies, including optimizing the website's technical infrastructure, im...