0% found this document useful (0 votes)
410 views16 pages

Oracle Supplier Bank Creation

This procedure creates or updates bank details in various tables by: 1. Checking if a bank exists with the given name and number, and if not, it will create a new bank record. 2. If a branch name is provided, it will check if a branch exists for the bank, and if not, it will create a new branch record. 3. It will then check if a bank account exists for the branch, and if not, it will create a new bank account record. 4. Finally, it will create various relationship records to link the bank, branch and account together.

Uploaded by

Pinaaki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
410 views16 pages

Oracle Supplier Bank Creation

This procedure creates or updates bank details in various tables by: 1. Checking if a bank exists with the given name and number, and if not, it will create a new bank record. 2. If a branch name is provided, it will check if a branch exists for the bank, and if not, it will create a new branch record. 3. It will then check if a bank account exists for the branch, and if not, it will create a new bank account record. 4. Finally, it will create various relationship records to link the bank, branch and account together.

Uploaded by

Pinaaki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 16

CREATE OR REPLACE PROCEDURE Create_Update_Bank_Dtls

(
p_bank_name IN hz_parties.PARTY_NAME%TYPE
,p_bank_number IN
hz_organization_profiles.BANK_OR_BRANCH_NUMBER%TYPE
,p_country_code IN hz_parties.COUNTRY%TYPE
,p_branch_name IN hz_parties.PARTY_NAME%TYPE
,p_branch_number IN
hz_organization_profiles.BANK_OR_BRANCH_NUMBER%TYPE
,p_eft_number IN hz_contact_points.EFT_SWIFT_CODE
%TYPE
,p_bank_acct_name IN
iby_ext_bank_accounts.BANK_ACCOUNT_NAME%TYPE
,p_bank_acct_number IN
iby_ext_bank_accounts.BANK_ACCOUNT_NUM%TYPE
,p_iban IN iby_ext_bank_accounts.IBAN%TYPE
,p_check_digits IN
iby_ext_bank_accounts.CHECK_DIGITS%TYPE
,p_currency_code IN
iby_ext_bank_accounts.CURRENCY_CODE%TYPE
,p_vendor_name IN ap_suppliers.vendor_name%TYPE
,p_vendor_site_code IN
ap_supplier_sites_all.vendor_site_code%TYPE
,p_org_id IN NUMBER
,x_bank_id OUT NOCOPY NUMBER
,x_branch_id OUT NOCOPY NUMBER
,x_bank_acct_id OUT NOCOPY NUMBER
,x_instr_assign_id OUT NOCOPY NUMBER
,x_error_message OUT NOCOPY VARCHAR2
)
IS
--Bank Information--
lc_bank_name hz_parties.PARTY_NAME%TYPE
:= p_bank_name;
lc_country_code hz_parties.COUNTRY%TYPE
:= p_country_code;
lc_country VARCHAR2(50);
lc_bank_number hz_organization_profiles.BANK_OR_BRANCH_NUMBER
%TYPE := p_bank_number;
--Bank Branch Information--
lc_bank_branch_name hz_parties.PARTY_NAME%TYPE
:= p_branch_name;
lc_branch_number hz_organization_profiles.BANK_OR_BRANCH_NUMBER
%TYPE := p_branch_number;
lc_branch_type hz_code_assignments.CLASS_CODE%TYPE
:= 'ABA';
lc_eft_number hz_contact_points.EFT_SWIFT_CODE%TYPE
:= p_eft_number;
--Bank Account Information--
lc_bank_account_name iby_ext_bank_accounts.BANK_ACCOUNT_NAME%TYPE
:= p_bank_acct_number;
lc_bank_account_number iby_ext_bank_accounts.BANK_ACCOUNT_NUM%TYPE
:= p_bank_acct_number;
lc_iban iby_ext_bank_accounts.IBAN%TYPE
:= p_iban;
lc_check_digits iby_ext_bank_accounts.CHECK_DIGITS%TYPE
:= p_check_digits;
lc_currency_code iby_ext_bank_accounts.CURRENCY_CODE%TYPE
:= p_currency_code;
--Mandate Information--
--Customer Information--
lc_vendor_name ap_suppliers.vendor_name%TYPE
:= p_vendor_name;
lc_vendor_site_code ap_supplier_sites_all.vendor_site_code%TYPE
:= p_vendor_site_code;
--Org Information--
ln_org_id NUMBER
:= p_org_id;
--Common API Out--
lr_response IBY_FNDCPT_COMMON_PUB.Result_rec_type;
lc_return_status VARCHAR2(10);
ln_msg_count NUMBER;
lc_msg_data VARCHAR2(2000);
lc_msg_dummy VARCHAR2(2000);
lc_output VARCHAR2(4000);
--Common API in--
ln_api_version NUMBER
:= 1.0;
lc_init_msg_list VARCHAR2(10)
:= FND_API.G_TRUE;
lc_commit VARCHAR2(10)
:= FND_API.G_TRUE;
--All IDs--
ln_bank_id NUMBER;
ln_bank_branch_id NUMBER;
ln_bank_account_id NUMBER;
ln_instr_assign_id NUMBER;
--All Out Parameters--
ld_bank_end_date DATE;
ld_branch_end_date DATE;
ld_bank_acct_start_date DATE;
ld_bank_acct_end_date DATE;
--All record Types--
lr_ext_bank_rec_type IBY_EXT_BANKACCT_PUB.ExtBank_rec_type;
lr_ext_bank_branch_rec_type IBY_EXT_BANKACCT_PUB.ExtBankBranch_rec_type;
lr_ext_bank_acct_rec_type IBY_EXT_BANKACCT_PUB.ExtBankAcct_rec_type;
lr_payee_context_rec_type
IBY_DISBURSEMENT_SETUP_PUB.PayeeContext_rec_type;--
IBY_FNDCPT_COMMON_PUB.PayerContext_rec_type;
lr_debit_auth_rec_type IBY_FNDCPT_SETUP_PUB.DebitAuth_rec_type;
lr_payment_instr_rec_type
IBY_FNDCPT_SETUP_PUB.PmtInstrAssignment_rec_type;
--All variables--
lc_creditor_vat
hr_organization_information.ORG_INFORMATION2%TYPE;
ln_creditor_legal_entity_id hr_legal_entities.ORGANIZATION_ID%TYPE;
lc_creditor_le_name hr_legal_entities.NAME%TYPE;
lc_creditor_identifier xxvfi_addl_attribute_info.ATTRIBUTE23%TYPE;
ln_supplier_site_id ap_supplier_sites_all.vendor_site_id%TYPE;
ln_bank_party_id hz_parties.PARTY_ID%TYPE;
ln_party_site_id hz_party_sites.PARTY_SITE_ID%TYPE;
ln_debit_auth_id NUMBER;
lc_active_status VARCHAR2(40);
lc_progress VARCHAR2(10);
ln_owner_exists NUMBER;
ln_joint_acct_owner_id NUMBER;
ln_bnk_with_name_exts NUMBER;
BEGIN
lc_progress := '000';
--
FND_GLOBAL.APPS_INITIALIZE(291839, 63126, 222);
--
IF lc_iban IS NOT NULL THEN
--
BEGIN
--
SELECT SUBSTR(lc_iban, 1, 2)
INTO lc_country
FROM dual;
--
SELECT territory_code
INTO lc_country_code
FROM fnd_territories
WHERE territory_code = lc_country;
--
EXCEPTION
WHEN OTHERS THEN
lc_country_code := p_country_code;
END;
--
ELSE
--
lc_country_code := p_country_code;
--
END IF;
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++--
--Bank Creation:
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++--
--Check if bank exists with Bank name and bank number--
IBY_EXT_BANKACCT_PUB.Check_Bank_Exist
(
p_api_version => ln_api_version
,p_init_msg_list => lc_init_msg_list
,p_country_code => lc_country_code
,p_bank_name => lc_bank_name
,p_bank_number => lc_bank_number
,x_return_status => lc_return_status
,x_msg_count => ln_msg_count
,x_msg_data => lc_msg_data
,x_bank_id => ln_bank_id
,x_end_date => ld_bank_end_date
,x_response => lr_response
);
--
lc_progress := '001';
--
IF lc_return_status != FND_API.G_RET_STS_SUCCESS THEN
--
IF ln_msg_count > 1 THEN
--
FOR i IN 1 .. ln_msg_count
LOOP
--
FND_MSG_PUB.Get
(
i
,FND_API.G_FALSE
,lc_msg_data
,lc_msg_dummy
);
--
lc_output := lc_output ||(TO_CHAR (i) || ': ' || SUBSTR (lc_msg_data, 1,
250));
--
END LOOP;
--
x_error_message := x_error_message||'-'||lc_output||'-'||lc_progress;
--
ELSE
--
x_error_message := x_error_message||'-'||lc_msg_data||'-'||lc_progress;
--
END IF;
--
END IF;
--
lc_progress := '002';
--
IF ln_bank_id IS NULL THEN
--
--Bank does not exists, create bank--
lr_ext_bank_rec_type.bank_name := lc_bank_name;
lr_ext_bank_rec_type.bank_number := lc_bank_number;
lr_ext_bank_rec_type.country_code := lc_country_code;
--
IBY_EXT_BANKACCT_PUB.Create_Ext_Bank
(
p_api_version => ln_api_version
,p_init_msg_list => lc_init_msg_list
,p_ext_bank_rec => lr_ext_bank_rec_type
,x_bank_id => ln_bank_id
,x_return_status => lc_return_status
,x_msg_count => ln_msg_count
,x_msg_data => lc_msg_data
,x_response => lr_response
);
--
lc_progress := '005';
--
IF lc_return_status != FND_API.G_RET_STS_SUCCESS THEN
--
IF ln_msg_count > 1 THEN
--
FOR i IN 1 .. ln_msg_count
LOOP
--
FND_MSG_PUB.Get
(
i
,FND_API.G_FALSE
,lc_msg_data
,lc_msg_dummy
);
--
lc_output := lc_output ||(TO_CHAR (i) || ': ' || SUBSTR (lc_msg_data,
1, 250));
END LOOP;
--
x_error_message := x_error_message||'-'||lc_output||'-'||lc_progress;
--
ELSE
--
x_error_message := x_error_message||'-'||lc_msg_data||'-'||lc_progress;
--
END IF;
--
ELSE
--
COMMIT;
--
END IF;
--
lc_output := NULL;
lc_msg_data := NULL;
ln_msg_count := NULL;
lc_return_status := NULL;
--
lc_progress := '006';
--
END IF;
--
x_bank_id := ln_bank_id;
--
lc_progress := '009';
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++--
--End Bank Creation
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++--
IF ln_bank_id IS NOT NULL THEN
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
--Bank Branch Creation
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
--Check if the branch already exists--
IBY_EXT_BANKACCT_PUB.Check_Ext_Bank_Branch_Exist
(
p_api_version => ln_api_version
,p_init_msg_list => lc_init_msg_list
,p_bank_id => ln_bank_id
,p_branch_name => lc_bank_branch_name
,p_branch_number => lc_branch_number
,x_return_status => lc_return_status
,x_msg_count => ln_msg_count
,x_msg_data => lc_msg_data
,x_branch_id => ln_bank_branch_id
,x_end_date => ld_branch_end_date
,x_response => lr_response
);
--
lc_progress := '010';
--
IF lc_return_status != FND_API.G_RET_STS_SUCCESS THEN
--
IF ln_msg_count > 1 THEN
--
FOR i IN 1 .. ln_msg_count
LOOP
--
FND_MSG_PUB.Get
(
i
,FND_API.G_FALSE
,lc_msg_data
,lc_msg_dummy
);
--
lc_output := lc_output ||(TO_CHAR (i) || ': ' || SUBSTR (lc_msg_data,
1, 250));
--
END LOOP;
--
x_error_message := x_error_message||'-'||lc_output||'-'||lc_progress;
--
ELSE
--
x_error_message := x_error_message||'-'||lc_msg_data||'-'||lc_progress;
--
END IF;
--
END IF;
--
lc_output := NULL;
lc_msg_data := NULL;
ln_msg_count := NULL;
lc_return_status := NULL;
--
lc_progress := '011';
--
IF ln_bank_branch_id IS NULL THEN
--
lr_ext_bank_branch_rec_type.bank_party_id := ln_bank_id;
lr_ext_bank_branch_rec_type.branch_name :=
lc_bank_branch_name;
lr_ext_bank_branch_rec_type.branch_number := lc_branch_number;
lr_ext_bank_branch_rec_type.branch_type := lc_branch_type;
lr_ext_bank_branch_rec_type.bic := lc_eft_number;
--
IBY_EXT_BANKACCT_PUB.Create_Ext_Bank_Branch
(
p_api_version => ln_api_version
,p_init_msg_list => lc_init_msg_list
,p_ext_bank_branch_rec => lr_ext_bank_branch_rec_type
,x_branch_id => ln_bank_branch_id
,x_return_status => lc_return_status
,x_msg_count => ln_msg_count
,x_msg_data => lc_msg_data
,x_response => lr_response
);
--
lc_progress := '012';
--
IF lc_return_status != FND_API.G_RET_STS_SUCCESS THEN
--
IF ln_msg_count > 1 THEN
--
FOR i IN 1 .. ln_msg_count
LOOP
--
FND_MSG_PUB.Get
(
i
,FND_API.G_FALSE
,lc_msg_data
,lc_msg_dummy
);
--
lc_output := lc_output ||(TO_CHAR (i) || ': ' || SUBSTR (lc_msg_data,
1, 250));
--
END LOOP;
--
x_error_message := x_error_message||'-'||lc_output||'-'||lc_progress;
--
ELSE
--
x_error_message := x_error_message||'-'||lc_msg_data||'-'||lc_progress;
--
END IF;
--
ELSE
--
COMMIT;
--
END IF;
--
lc_output := NULL;
lc_msg_data := NULL;
ln_msg_count := NULL;
lc_return_status := NULL;
--
END IF;
--
lc_progress := '013';
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
--End Bank Branch Creation
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
END IF;
--
x_branch_id := ln_bank_branch_id;
--
lc_progress := '014';
--
BEGIN
--
SELECT ASSA.vendor_site_id
,ASU.party_id
INTO ln_supplier_site_id
,ln_bank_party_id
FROM ap_supplier_sites_all ASSA
,ap_suppliers ASU
WHERE ASU.vendor_name = lc_vendor_name
AND ASU.vendor_id = ASSA.vendor_id
AND ASSA.vendor_site_code = lc_vendor_site_code;
--
EXCEPTION
WHEN NO_DATA_FOUND THEN
ln_supplier_site_id := NULL;
ln_bank_party_id := NULL;
END;
--
lc_progress := '015';
--
IF ln_bank_id IS NOT NULL AND ln_bank_branch_id IS NOT NULL THEN
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
--Bank Account Creation
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
--Check if bank_account Exists--
lr_ext_bank_acct_rec_type.country_code := lc_country_code;
lr_ext_bank_acct_rec_type.branch_id := ln_bank_branch_id;
lr_ext_bank_acct_rec_type.bank_id := ln_bank_id;
lr_ext_bank_acct_rec_type.acct_owner_party_id := ln_bank_party_id;
lr_ext_bank_acct_rec_type.bank_account_name :=
lc_bank_account_name;
lr_ext_bank_acct_rec_type.bank_account_num :=
lc_bank_account_number;
lr_ext_bank_acct_rec_type.currency := lc_currency_code;
lr_ext_bank_acct_rec_type.iban := lc_iban;
lr_ext_bank_acct_rec_type.check_digits := lc_check_digits;
--
IBY_EXT_BANKACCT_PUB.Check_Ext_Acct_Exist
(
p_api_version => ln_api_version
,p_init_msg_list => lc_init_msg_list
,p_bank_id => ln_bank_id
,p_branch_id => ln_bank_branch_id
,p_acct_number => lc_bank_account_number
,p_acct_name => lc_bank_account_name
,p_currency => lc_currency_code
,p_country_code => lc_country_code
,x_acct_id => ln_bank_account_id
,x_start_date => ld_bank_acct_start_date
,x_end_date => ld_bank_acct_end_date
,x_return_status => lc_return_status
,x_msg_count => ln_msg_count
,x_msg_data => lc_msg_data
,x_response => lr_response
);
--
lc_progress := '016';
--
IF lc_return_status != FND_API.G_RET_STS_SUCCESS THEN
--
IF ln_msg_count > 1 THEN
--
FOR i IN 1 .. ln_msg_count
LOOP
--
FND_MSG_PUB.Get
(
i
,FND_API.G_FALSE
,lc_msg_data
,lc_msg_dummy
);
--
lc_output := lc_output ||(TO_CHAR (i) || ': ' || SUBSTR (lc_msg_data,
1, 250));
--
END LOOP;
--
x_error_message := x_error_message||'-'||lc_output||'-'||lc_progress;
--
ELSE
--
x_error_message := x_error_message||'-'||lc_msg_data||'-'||lc_progress;
--
END IF;
--
END IF;
--
lc_output := NULL;
lc_msg_data := NULL;
ln_msg_count := NULL;
lc_return_status := NULL;
--
lc_progress := '017';
--
IF ln_bank_account_id IS NULL THEN
--
lr_ext_bank_acct_rec_type.start_date := TRUNC(SYSDATE);
--
IBY_EXT_BANKACCT_PUB.Create_Ext_Bank_Acct
(
p_api_version => ln_api_version
,p_init_msg_list => lc_init_msg_list
,p_ext_bank_acct_rec => lr_ext_bank_acct_rec_type
,x_acct_id => ln_bank_account_id
,x_return_status => lc_return_status
,x_msg_count => ln_msg_count
,x_msg_data => lc_msg_data
,x_response => lr_response
);
--
lc_progress := '018';
--
IF lc_return_status != FND_API.G_RET_STS_SUCCESS THEN
--
IF ln_msg_count > 1 THEN
--
FOR i IN 1 .. ln_msg_count
LOOP
--
FND_MSG_PUB.Get
(
i
,FND_API.G_FALSE
,lc_msg_data
,lc_msg_dummy
);
--
lc_output := lc_output ||(TO_CHAR (i) || ': ' || SUBSTR (lc_msg_data,
1, 250));
--
END LOOP;
--
x_error_message := x_error_message||'-'||lc_output||'-'||lc_progress;
--
ELSE
--
x_error_message := x_error_message||'-'||lc_msg_data||'-'||lc_progress;
--
END IF;
--
ELSE
--
COMMIT;
--
END IF;
--
lc_output := NULL;
lc_msg_data := NULL;
ln_msg_count := NULL;
lc_return_status := NULL;
--
lc_progress := '019';
--
ELSE
--Update Bank Account--
SELECT object_version_number
INTO lr_ext_bank_acct_rec_type.object_version_number
FROM iby_ext_bank_accounts
WHERE ext_bank_account_id = ln_bank_account_id;
--
lr_ext_bank_acct_rec_type.bank_account_id :=
ln_bank_account_id;
lr_ext_bank_acct_rec_type.country_code := lc_country_code;
lr_ext_bank_acct_rec_type.branch_id := ln_bank_branch_id;
lr_ext_bank_acct_rec_type.bank_id := ln_bank_id;
lr_ext_bank_acct_rec_type.bank_account_name :=
lc_bank_account_name;
lr_ext_bank_acct_rec_type.bank_account_num :=
lc_bank_account_number;
lr_ext_bank_acct_rec_type.currency := lc_currency_code;
lr_ext_bank_acct_rec_type.iban := lc_iban;
lr_ext_bank_acct_rec_type.check_digits := lc_check_digits;
lr_ext_bank_acct_rec_type.start_date := TRUNC(SYSDATE);
--
IBY_EXT_BANKACCT_PUB.Update_Ext_Bank_Acct
(
p_api_version => ln_api_version
,p_init_msg_list => lc_init_msg_list
,p_ext_bank_acct_rec => lr_ext_bank_acct_rec_type
,x_return_status => lc_return_status
,x_msg_count => ln_msg_count
,x_msg_data => lc_msg_data
,x_response => lr_response
);
--
lc_progress := '020';
--
IF lc_return_status != FND_API.G_RET_STS_SUCCESS THEN
--
IF ln_msg_count > 1 THEN
--
FOR i IN 1 .. ln_msg_count
LOOP
--
FND_MSG_PUB.Get
(
i
,FND_API.G_FALSE
,lc_msg_data
,lc_msg_dummy
);
--
lc_output := lc_output ||(TO_CHAR (i) || ': ' || SUBSTR (lc_msg_data,
1, 250));
--
END LOOP;
--
x_error_message := x_error_message||'-'||lc_output||'-'||lc_progress;
--
ELSE
--
x_error_message := x_error_message||'-'||lc_msg_data||'-'||lc_progress;
--
END IF;
--
ELSE
--
COMMIT;
--
END IF;
--
lc_output := NULL;
lc_msg_data := NULL;
ln_msg_count := NULL;
lc_return_status := NULL;
--
lc_progress := '021';
--
END IF;
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
--End Bank Account Creation
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
END IF;
--
lc_progress := '021.1';
--
x_bank_acct_id := ln_bank_account_id;
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++--
--Check current Party is Owner of the account
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++--
SELECT COUNT(*)
INTO ln_owner_exists
FROM iby_account_owners
WHERE ext_bank_account_id = ln_bank_account_id
AND account_owner_party_id= ln_bank_party_id;
--
lc_progress := '021.2';
--
IF ln_owner_exists = 0 AND ln_bank_account_id IS NOT NULL THEN
--
lc_progress := '021.3';
--
IBY_EXT_BANKACCT_PUB.add_joint_account_owner
(
p_api_version => ln_api_version
,p_init_msg_list => lc_init_msg_list
,p_bank_account_id => ln_bank_account_id
,p_acct_owner_party_id => ln_bank_party_id
,x_joint_acct_owner_id => ln_joint_acct_owner_id
,x_return_status => lc_return_status
,x_msg_count => ln_msg_count
,x_msg_data => lc_msg_data
,x_response => lr_response
);
--
lc_progress := '021.4';
--
IF lc_return_status != FND_API.G_RET_STS_SUCCESS THEN
--
lc_progress := '021.5';
--
IF ln_msg_count > 1 THEN
--
FOR i IN 1 .. ln_msg_count
LOOP
--
FND_MSG_PUB.Get
(
i
,FND_API.G_FALSE
,lc_msg_data
,lc_msg_dummy
);
--
lc_output := lc_output ||(TO_CHAR (i) || ': ' || SUBSTR (lc_msg_data,
1, 250));
--
END LOOP;
--
x_error_message := x_error_message||'-'||lc_output||'-'||lc_progress;
--
ELSE
--
lc_progress := '021.6';
--
x_error_message := x_error_message||'-'||lc_msg_data||'-'||lc_progress;
--
END IF;
--
ELSE
--
lc_progress := '021.7';
--
COMMIT;
--
END IF;
--
lc_output := NULL;
lc_msg_data := NULL;
ln_msg_count := NULL;
lc_return_status := NULL;
--
END IF;
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++--
--End Check current Party is Owner of the account
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++--
lc_progress := '022';
--
--Get Creditor details--
BEGIN
--
SELECT o2.org_information2
,le.organization_id
,le.name
INTO lc_creditor_vat
,ln_creditor_legal_entity_id
,lc_creditor_le_name
FROM hr_operating_units ORG
,hr_legal_entities LE
,hr_all_organization_units LE_UNITS
,hr_locations LOC
,hr_organization_information O2
WHERE ORG.organization_id = ln_org_id
AND LE.organization_id = ORG.default_legal_context_id
AND LE.organization_id = O2.organization_id
AND upper(O2.org_information_context) = 'LEGAL ENTITY ACCOUNTING'
AND LE_UNITS.organization_id = ORG.organization_id
AND LE_UNITS.location_id = LOC.location_id(+);
--
SELECT attribute23
INTO lc_creditor_identifier
FROM xxvfi_addl_attribute_info
WHERE TO_NUMBER(pk_value_1) = ln_org_id;
--
EXCEPTION
WHEN NO_DATA_FOUND THEN
lc_creditor_vat := NULL;
ln_creditor_legal_entity_id := NULL;
lc_creditor_le_name := NULL;
lc_creditor_identifier := NULL;
END;
--
lc_progress := '023';
--
IF ln_bank_account_id IS NOT NULL AND ln_supplier_site_id IS NOT NULL THEN
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
--Bank Instrument Assignment
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
lr_payee_context_rec_type.payment_function :=
'PAYABLES_DISB';
lr_payee_context_rec_type.party_id :=
ln_bank_party_id;
lr_payee_context_rec_type.org_type :=
'OPERATING_UNIT';
lr_payee_context_rec_type.org_id :=
ln_org_id;
lr_payee_context_rec_type.party_site_id :=
ln_party_site_id;
lr_payee_context_rec_type.supplier_site_id :=
ln_supplier_site_id;
--
lr_payment_instr_rec_type.instrument.instrument_type :=
'BANKACCOUNT';
lr_payment_instr_rec_type.instrument.instrument_id :=
ln_bank_account_id;
lr_payment_instr_rec_type.priority := 1;
lr_payment_instr_rec_type.start_date :=
TRUNC(SYSDATE);
--
IBY_DISBURSEMENT_SETUP_PUB.Set_Payee_Instr_Assignment (
p_api_version => ln_api_version
,p_init_msg_list => lc_init_msg_list
,p_commit => lc_commit
,x_return_status => lc_return_status
,x_msg_count => ln_msg_count
,x_msg_data => lc_msg_data
,p_payee => lr_payee_context_rec_type
,p_assignment_attribs => lr_payment_instr_rec_type
,x_assign_id => ln_instr_assign_id
,x_response => lr_response
);
--
lc_progress := '024';
--
IF lc_return_status != FND_API.G_RET_STS_SUCCESS THEN
--
IF ln_msg_count > 1 THEN
--
FOR i IN 1 .. ln_msg_count
LOOP
--
FND_MSG_PUB.Get
(
i
,FND_API.G_FALSE
,lc_msg_data
,lc_msg_dummy
);
--
lc_output := lc_output ||(TO_CHAR (i) || ': ' || SUBSTR (lc_msg_data,
1, 250));
--
END LOOP;
--
x_error_message := x_error_message||'-'||lc_output||'-'||lc_progress;
--
ELSE
--
x_error_message := x_error_message||'-'||lc_msg_data||'-'||lc_progress;
--
END IF;
--
ELSE
--
COMMIT;
--
END IF;
--
lc_output := NULL;
lc_msg_data := NULL;
ln_msg_count := NULL;
lc_return_status := NULL;
--
lc_progress := '025';
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
--End Bank Instrument Assignment
--
--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++--
END IF;
--
x_instr_assign_id := ln_instr_assign_id;
--
lc_progress := '026';
--
x_error_message := RTRIM(LTRIM(x_error_message, '-'), '-');
--
lc_progress := '031';
--
EXCEPTION
WHEN OTHERS THEN
lc_output := SQLERRM;
x_error_message := lc_progress||'-'||lc_output;
END Create_Update_Bank_Dtls;

DECLARE
--
ln_instr_assign_id NUMBER;
ln_bank_id NUMBER;
ln_branch_id NUMBER;
ln_bank_acct_id NUMBER;
lc_error_message VARCHAR2(2000);
--
BEGIN
--
Create_Update_Bank_Dtls
(
p_bank_name => 'HDFC Bank'
,p_bank_number => '8905835'
,p_country_code => 'IN'
,p_branch_name => 'MG ROAD'
,p_branch_number => '8905835'
,p_eft_number => NULL
,p_bank_acct_name => 'HDFC-MGR-5954'
,p_bank_acct_number => '00096110045954'
,p_iban => NULL
,p_check_digits => NULL
,p_currency_code => 'INR'
,p_vendor_name => 'BALASUBRAMANIAN, SIVASANKAR'
,p_vendor_site_code => 'HOME'
,p_org_id => 1266
,x_bank_id => ln_bank_id
,x_branch_id => ln_branch_id
,x_bank_acct_id => ln_bank_acct_id
,x_instr_assign_id => ln_instr_assign_id
,x_error_message => lc_error_message
);
--
DBMS_OUTPUT.PUT_LINE('Error Message: '||lc_error_message||' -> bank id: '||
ln_bank_id||' -> bank branch id: '||ln_branch_id||' -> Bank Account ID: '||
ln_bank_acct_id||' -> instrument assignment id: '||ln_instr_assign_id);
--
END;

You might also like