Tuesday, 16 December 2014

API to Create External Bank

When performing Master Data Migration for Supplier or Customer business also needs the migration of Associated Banks and Bank Branches .

In order to perform this we need to migrate the Banks , Bank Branches and associated Bank Branches

In R12 to create an external bank Oracle has given an API :

IBY_EXT_BANKACCT_PUB.create_ext_bank

API signature :

PROCEDURE create_ext_bank (
        p_api_version              IN  NUMBER,
p_init_msg_list            IN  VARCHAR2,
p_ext_bank_rec             IN  ExtBank_rec_type,
x_bank_id                  OUT NOCOPY NUMBER,
x_return_status            OUT NOCOPY VARCHAR2,
x_msg_count                OUT NOCOPY NUMBER,
x_msg_data                 OUT NOCOPY VARCHAR2,
x_response                 OUT NOCOPY IBY_FNDCPT_COMMON_PUB.Result_rec_type
  )

p_ext_bank_rec   is the record type variable with the infromation of the bank to be created in the system

x_bank_id                  is the id of the bank to be created
x_return_status           return status

Sample Code :

IBY_EXT_BANKACCT_PUB.create_ext_bank (
                            p_api_version     => 1.0,
                            p_init_msg_list   => FND_API.G_TRUE,
                            p_ext_bank_rec    => l_bank_rec,
                            x_bank_id         => l_num_bank_id,
                            x_return_status   => l_chr_return_status,
                            x_msg_count       => l_num_count,
                            x_msg_data        => l_msg_data,
                            x_response        => x_response_rec);

                         IF (l_chr_return_status <> 'S')
                         THEN
                            FOR i IN 1 .. l_num_count
                            LOOP
                               fnd_msg_pub.get (
                                  p_msg_index       => -1,
                                  p_encoded         => 'F',
                                  p_data            => l_msg_data,
                                  p_msg_index_out   => l_msg_index_out);
                               fnd_file.put_line (
                                  fnd_file.LOG,
                                  'Error in Bank  Creation  ' || l_msg_data);
                               l_chr_val_ret_msg :=
                                  l_chr_val_ret_msg || '  ' || l_msg_data;
                               RAISE e_error;
                            END LOOP;
                         ELSE
                            fnd_file.put_line (fnd_file.LOG,
                                               'Bank Created Sucessfully  ');
                         END IF;

Mandatory Parameters :
Bank Name
Bank Country
Bank Number
Currency Code

Combination of these is an Unique combination and API gives an error if we try to create duplicate records

Once the bank is created information can be searched in the view iby_ext_banks_v

No comments:

Post a Comment