Tuesday, 23 September 2014

HZ party and account active inactive API in oracle apps

        Party Account Active:-
===========================

/* 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;



         Party Account IN-Active:-
===========================

/* 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) := 'I';
   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 = 122164;

   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;


            Party In-Active :- 
=======================

/* Formatted on 9/23/2014 9:46:55 AM (QP5 v5.115.810.9015) */
DECLARE
   p_person_rec                    HZ_PARTY_V2PUB.PERSON_REC_TYPE;
   x_profile_id                    NUMBER;
   x_return_status                 VARCHAR2 (2000);
   x_msg_count                     NUMBER;
   x_msg_data                      VARCHAR2 (2000);
   p_party_object_version_number   NUMBER;
   v_status                        VARCHAR2 (30) := 'I';

   CURSOR c1
   IS
      SELECT   *
        FROM   hz_parties
       WHERE   PARTY_ID = 479840;

   b1                              apps.hz_parties%ROWTYPE;
BEGIN
   OPEN c1;

   LOOP
      FETCH c1 INTO   b1;


      p_party_object_version_number := b1.object_version_number; -- object_number provided in SQL output above
      p_person_rec.party_rec.party_id := b1.PARTY_ID; -- party_id provided in SQL output above
      p_person_rec.party_rec.status := v_status; -- set the status to INACTIVE

      HZ_PARTY_V2PUB.update_person ('T',
                                    p_person_rec,
                                    p_party_object_version_number,
                                    x_profile_id,
                                    x_return_status,
                                    x_msg_count,
                                    x_msg_data);
      EXIT WHEN c1%NOTFOUND;
   END LOOP;

   CLOSE c1;
END;


            Party Active :-
=====================

/* Formatted on 9/23/2014 9:46:55 AM (QP5 v5.115.810.9015) */
DECLARE
   p_person_rec                    HZ_PARTY_V2PUB.PERSON_REC_TYPE;
   x_profile_id                    NUMBER;
   x_return_status                 VARCHAR2 (2000);
   x_msg_count                     NUMBER;
   x_msg_data                      VARCHAR2 (2000);
   p_party_object_version_number   NUMBER;
   v_status                        VARCHAR2 (30) := 'A';

   CURSOR c1
   IS
      SELECT   *
        FROM   hz_parties
       WHERE   PARTY_ID = 479823;

   b1                              apps.hz_parties%ROWTYPE;
BEGIN
   OPEN c1;

   LOOP
      FETCH c1 INTO   b1;


      p_party_object_version_number := b1.object_version_number; -- object_number provided in SQL output above
      p_person_rec.party_rec.party_id := b1.PARTY_ID; -- party_id provided in SQL output above
      p_person_rec.party_rec.status := v_status; -- set the status to INACTIVE

      HZ_PARTY_V2PUB.update_person ('T',
                                    p_person_rec,
                                    p_party_object_version_number,
                                    x_profile_id,
                                    x_return_status,
                                    x_msg_count,
                                    x_msg_data);
      EXIT WHEN c1%NOTFOUND;
   END LOOP;

   CLOSE c1;
END;

1 comment:

  1. Regards
    Sridevi Koduru (Senior Oracle Apps Trainer Oracleappstechnical.com)
    LinkedIn profile - https://in.linkedin.com/in/sridevi-koduru-9b876a8b
    Please Contact for One to One Online Training on Oracle Apps Technical, Financials, SCM, Oracle Manufacturing, BI Publisher, OAF, ADF, SQL, PL/SQL, D2K at sridevikoduru@oracleappstechnical.com | +91 - 9581017828.

    ReplyDelete