Tuesday, April 14, 2015

Updating External Bank Account Details

Update External Bank Account Details: In following example we are updating bank Account Name and bank account number.

Replace local variables l_vendor_id,l_ext_bank_account_id, l_bank_id and l_branch_id with your id's


CREATE OR REPLACE PROCEDURE xx_update_bank_detail
IS
   p_api_version         NUMBER                                    := 1.0;
   p_init_msg_list       VARCHAR2 (1)                              := 'F';
   x_return_status       VARCHAR2 (2000);
   x_msg_count           NUMBER (5);
   x_msg_data            VARCHAR2 (2000);
   x_response            iby_fndcpt_common_pub.result_rec_type;
   p_ext_bank_acct_rec   iby_ext_bankacct_pub.extbankacct_rec_type; 
   p_count               NUMBER;
BEGIN
-- In this update bank account of a supplier has been modified .
   p_ext_bank_acct_rec.object_version_number := 1.0;
   p_ext_bank_acct_rec.acct_owner_party_id := l_vendor_id;
   p_ext_bank_acct_rec.bank_account_id := l_ext_bank_account_id;
   p_ext_bank_acct_rec.bank_id := l_bank_id;
   p_ext_bank_acct_rec.branch_id := l_branch_id;

-- Data to be Updated
/*
Use following constant if need to update with Null or blank.
FND_API.G_MISS_NUM for NUMBER
FND_API.G_MISS_CHAR for VARCHAR2 
FND_API.G_MISS_DATE for DATE
*/
   p_ext_bank_acct_rec.bank_account_name := 'YOUR NEW BANK ACCOUNT NAME';
-- to update bank_account_num with blank then use FND_API.G_MISS_NUM instead of NULL or '' 
   p_ext_bank_acct_rec.bank_account_num := 123456;


   iby_ext_bankacct_pub.update_ext_bank_acct
                                 (p_api_version            => p_api_version,
                                  p_init_msg_list          => p_init_msg_list,
                                  p_ext_bank_acct_rec      => p_ext_bank_acct_rec,
                                  x_return_status          => x_return_status,
                                  x_msg_count              => x_msg_count,
                                  x_msg_data               => x_msg_data,
                                  x_response               => x_response
                                 );

   IF x_return_status = 'S'
   THEN
      DBMS_OUTPUT.put_line ('Bank detail Updated.');
      COMMIT;
   ELSE
      IF x_msg_count = 1
      THEN
         DBMS_OUTPUT.put_line ('x_msg_data ' || x_msg_data);
      ELSIF x_msg_count > 1
      THEN
         LOOP
            p_count := p_count + 1;
            x_msg_data :=
                        fnd_msg_pub.get (fnd_msg_pub.g_next, fnd_api.g_false);

            IF x_msg_data IS NULL
            THEN
               EXIT;
            END IF;

            DBMS_OUTPUT.put_line ('Message' || p_count || ' ---' || x_msg_data);
         END LOOP;
      END IF;
   END IF;
END;


Following query can be used to get 

No comments: