Create a Customer Account Relationship API HZ_CUST_ACCOUNT_V2PUB.CREATE_CUST_ACCT_RELATE

Create a Customer Account Relationship API HZ_CUST_ACCOUNT_V2PUB.CREATE_CUST_ACCT_RELATE


 


                                                                                                                       

API : HZ_CUST_ACCOUNT_V2PUB.CREATE_CUST_ACCT_RELATE
TEST INSTANCE: R12.1.3
DETAILS OF THE ROUTINE:
This routine is used to create a Customer Account Relationship. The API creates a record in the HZ_CUST_ACCT_RELATE table. You can relate two different customer accounts in this process. This is different from Relationship API that has been discussed earlier.

SCRIPT:

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_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       := 'ALL';
  P_CUST_ACCT_RELATE_REC.created_by_module       := 'BO_API';

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

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

Post a Comment