Tuesday, 16 December 2014

API to Create External Bank Branch

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 branch Oracle has given an API :

IBY_EXT_BANKACCT_PUB.create_ext_bank_branch

API Signature :

create_ext_bank_branch (
   p_api_version                IN   NUMBER,
   p_init_msg_list              IN   VARCHAR2,
   p_ext_bank_branch_rec        IN   ExtBankBranch_rec_type,
   x_branch_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_branch_rec         Bank branch record type
x_branch_id                     Id of the branch created
x_return_status                Return status of API

Sample code :

                         IBY_EXT_BANKACCT_PUB.create_ext_bank_branch (
                            p_api_version           => 1.0,
                            p_init_msg_list         => FND_API.G_TRUE,
                            p_ext_bank_branch_rec   => l_bank_branch_rec,
                            x_branch_id             => l_num_branch_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);


                         writelog (
                            'l_chr_return_status in bank branch '
                            || l_chr_return_status);
                         writelog ('Branch Id: ' || l_num_branch_id || SQLERRM);

                         --Check for Sucess API
                         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);

                               writelog (
                                  'Error in Bank Branch Creation  ' || l_msg_data);
                               l_chr_val_ret_msg :=
                                  l_chr_val_ret_msg || '  ' || l_msg_data;
                               RAISE e_error;
                            END LOOP;
                         ELSE
                            writelog ('  Branch created successfully. ');
                         END IF;

Parameters to pass :

Bank Id
branch name
branch number
branch type
Swift code
alt_branch_name

Note : Branch can only be created if a bank exists make sure to use create bank before calling this API

A post for that too is available in the blog

Once the record is created information can be found in the view : iby_ext_bank_branches_v

No comments:

Post a Comment