Tuesday, 23 September 2014

Inactivate the Customer (OR) Party Account API (HZ_CUST_ACCOUNT_V2PUB)


DECLARE
   p_cust_account_rec        HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
   p_object_version_number   NUMBER := 1;
   v_status                  VARCHAR2 (30) := 'A';
   x_return_status           VARCHAR2 (2000);
   x_msg_count               NUMBER;
   x_msg_data                VARCHAR2 (2000);
   x_new_acc_num             VARCHAR2 (2000);

   CURSOR c1
   IS
      SELECT   *
        FROM   apps.hz_cust_accounts
       WHERE   cust_account_id = 122168;

   b1                        apps.hz_cust_accounts%ROWTYPE;
BEGIN
   OPEN c1;

   LOOP
      FETCH c1 INTO   b1;

      p_cust_account_rec.cust_account_id := b1.cust_account_id;
      p_cust_account_rec.account_name := FND_API.G_MISS_CHAR;
      p_cust_account_rec.status := v_status;


      hz_cust_account_v2pub.update_cust_account ('T',
                                                 p_cust_account_rec,
                                                 p_object_version_number,
                                                 x_return_status,
                                                 x_msg_count,
                                                 x_msg_data);

      EXIT WHEN c1%NOTFOUND;
   END LOOP;

   CLOSE c1;
END;


                        ==============   ***************  ==============

/* Formatted on 9/23/2014 9:14:46 AM (QP5 v5.115.810.9015) */
DECLARE
   p_cust_account_rec        HZ_CUST_ACCOUNT_V2PUB.CUST_ACCOUNT_REC_TYPE;
   p_object_version_number   NUMBER;
   v_status                  VARCHAR2 (30) := 'A';
   x_return_status           VARCHAR2 (2000);
   x_msg_count               NUMBER;
   x_msg_data                VARCHAR2 (2000);
   x_new_acc_num             VARCHAR2 (2000);

   CURSOR c1
   IS
      SELECT   *
        FROM   apps.hz_cust_accounts
       WHERE   cust_account_id = 122168;

   b1                        apps.hz_cust_accounts%ROWTYPE;
BEGIN
   OPEN c1;

   LOOP
      FETCH c1 INTO   b1;

      p_cust_account_rec.cust_account_id := b1.cust_account_id;
      p_object_version_number := b1.object_version_number;
      p_cust_account_rec.account_name := FND_API.G_MISS_CHAR;
      p_cust_account_rec.status := v_status;


      hz_cust_account_v2pub.update_cust_account ('T',
                                                 p_cust_account_rec,
                                                 p_object_version_number,
                                                 x_return_status,
                                                 x_msg_count,
                                                 x_msg_data);

      EXIT WHEN c1%NOTFOUND;
   END LOOP;

   CLOSE c1;
END;

No comments:

Post a Comment