0% found this document useful (0 votes)
268 views6 pages

Oracle Application - How To Check Budget Fund For Specific Account - Oracle Query

This procedure checks if funds are available for a specific account. It retrieves the budget, encumbrances, actual amounts and calculates the available funds. If funds are available, it returns the amount and status as 'Y', otherwise returns insufficient funds status as 'N'.

Uploaded by

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

Oracle Application - How To Check Budget Fund For Specific Account - Oracle Query

This procedure checks if funds are available for a specific account. It retrieves the budget, encumbrances, actual amounts and calculates the available funds. If funds are available, it returns the amount and status as 'Y', otherwise returns insufficient funds status as 'N'.

Uploaded by

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

3/23/24, 10:29 AM Oracle Application: How to check budget fund for specific account - Oracle Query

More Create Blog Sign In

Oracle Application

Sunday 21 July 2019

How to check budget fund for specific account - Oracle


Query
Subject: Required to check fund is available for the specific account during oracle form validation or
reporting level.

Solution: Following procedure will return the available fund amount & status (Y- Available, N-InSufficient
Fund)

PLSQL Procedure:

create or replace PROCEDURE is_fund_available (p_gl_account IN VARCHAR2,


p_amount IN NUMBER,
p_date IN DATE,
p_module IN VARCHAR2,
px_fund_available OUT NUMBER,
px_result OUT VARCHAR2)
IS
PRAGMA AUTONOMOUS_TRANSACTION;
lx_budget NUMBER;
lx_encumbrance NUMBER;
lx_actual NUMBER;
lx_funds_available NUMBER;
lx_req_encumbrance_amount NUMBER;
lx_po_encumbrance_amount NUMBER;
lx_other_encumbrance_amount NUMBER;
l_conversion_rate NUMBER;
l_encumbrance_type_id NUMBER;
l_closing_status VARCHAR2 (2);
l_set_of_books_id NUMBER;
l_period_name VARCHAR2 (30);
l_period_set_name VARCHAR2 (50);
l_period_type VARCHAR2 (30);
l_period_num VARCHAR2 (30); About Me
l_quarter_num VARCHAR2 (30);
l_period_year VARCHAR2 (30); Chetan Rajput

l_currency_code VARCHAR2 (10); As Oracle Techno-


l_budget_version_id NUMBER; Functional Consultant
l_code_combination_id NUMBER; provides solutions on
lx_funds_available_usd NUMBER; Oracle EBS - R12, Oracle
ln_fund_exclusion NUMBER; Fusion SCM, and Financial Module. Handling
the client-side project. Providing Integration,
p_end_date DATE;
Implementations, Oracle Supports and
expense_exception EXCEPTION;
Business Intelligence Solutions to Gulf
l_rei_curr_code VARCHAR2 (10); Industries, Shipping Firm, Real Estate
ln_period_year gl_periods.period_year%TYPE; Business, Government Service Sector and
lc_period_name gl_periods.period_year%TYPE; Manufacturing firm across the World.
x_msg_status VARCHAR2 (1000) := NULL; Expertise in Setup, Implementation,
x_msg_data VARCHAR2 (100); Customization, Migration, Up-gradation and

https://chetanrajputoracleapps.blogspot.com/2019/07/oracle-budget-fund-check-procedure-for.html 1/6
3/23/24, 10:29 AM Oracle Application: How to check budget fund for specific account - Oracle Query
p_ledger_id NUMBER := 2021; Production Support in Oracle EBS - R12 and
p_rei_curr_code VARCHAR2 (10) := 'QAR'; Oracle Fusion Application environment.
l_req_encumbrance_id NUMBER; View my complete profile
l_po_encumbrance_id NUMBER;
l_oblig_revresal_amount NUMBER := 0;
Total Pageviews
l_oblig_revresal_enucm_id NUMBER := NULL;
lx_funds_available_temp NUMBER := 0;

9 6 6 6 5
CURSOR get_period_year
IS
Blog Archive
SELECT period_year
FROM gl_periods ►
► 2024 (3)
WHERE p_date BETWEEN start_date AND end_date;

► 2023 (17)

► 2022 (37)
CURSOR get_last_period
IS ►
► 2021 (36)
SELECT gp.period_type, ►
► 2020 (29)
gsob.period_set_name,

▼ 2019 (22)
gp.period_name,

► November (3)
gp.period_num,
gp.quarter_num, ►
► September (2)
gp.period_year, ►
► August (1)
gp.start_date, ▼
▼ July (2)
gp.end_date,
How to check budget fund for specific
gp.year_start_date account - Or...
FROM gl_sets_of_books gsob, gl_periods gp
How to define event-based Oracle Alert
WHERE gsob.period_set_name = gp.period_set_name on Custom T...
AND gp.period_year = ln_period_year
AND gsob.set_of_books_id = p_ledger_id ►
► May (1)
AND adjustment_period_flag != 'Y' ►
► April (2)
ORDER BY period_num;

► March (2)

► February (4)
lcu_get_last_period get_last_period%ROWTYPE;
BEGIN ►
► January (5)
BEGIN

► 2018 (30)
SELECT code_combination_id
INTO l_code_combination_id ►
► 2017 (6)
FROM gl_code_combinations_kfv x
WHERE x.concatenated_segments = TRIM (p_gl_account);
EXCEPTION
WHEN OTHERS
THEN
x_msg_status := x_msg_status || 'ERR:CCD';
END;

DBMS_OUTPUT.put_line (
'Code combination id is ' || l_code_combination_id);
DBMS_OUTPUT.put_line ('Set of books id is :' || p_ledger_id);

BEGIN
SELECT 1
INTO ln_fund_exclusion
FROM gl_budget_assignments
WHERE ledger_id = p_ledger_id --l_set_of_books_id
AND code_combination_id = l_code_combination_id--AND amount_type = 'YTD'
--AND funds_check_level_code = 'B'
;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
ln_fund_exclusion := 0;
WHEN OTHERS
THEN
ln_fund_exclusion := 0;
END;

DBMS_OUTPUT.put_line ('Fund Exclusion:' || ln_fund_exclusion);

IF NVL (ln_fund_exclusion, 0) = 1
THEN
BEGIN
SELECT period_name,
period_set_name,
period_type,
period_num,
quarter_num,

https://chetanrajputoracleapps.blogspot.com/2019/07/oracle-budget-fund-check-procedure-for.html 2/6
3/23/24, 10:29 AM Oracle Application: How to check budget fund for specific account - Oracle Query
period_year
INTO l_period_name,
l_period_set_name,
l_period_type,
l_period_num,
l_quarter_num,
l_period_year
FROM gl_periods
WHERE period_name = TO_CHAR (p_date, 'Mon-rr');
EXCEPTION
WHEN OTHERS
THEN
x_msg_status := x_msg_status || 'ERR:Period';
--RAISE expense_exception;
END;

BEGIN
SELECT currency_code
INTO l_currency_code
FROM gl_sets_of_books
WHERE set_of_books_id = NVL (p_ledger_id, 1001);
EXCEPTION
WHEN OTHERS
THEN
l_currency_code := 'QAR';
END;

BEGIN
SELECT budget_version_id
INTO l_budget_version_id
FROM gl_budgets_with_dates_v
WHERE set_of_books_id = NVL (p_ledger_id, 1001)
AND status != 'R'
AND status = 'C'
-- Status 'C' denotes the Current Active Budget
AND p_date BETWEEN start_date AND end_date;
EXCEPTION
WHEN OTHERS
THEN
l_budget_version_id := 1000; --Approved Budget
END;

OPEN get_period_year;

FETCH get_period_year INTO ln_period_year;

CLOSE get_period_year;

BEGIN
SELECT closing_status
INTO l_closing_status
FROM gl_period_statuses
WHERE period_name = l_period_name
AND application_id = 101
AND set_of_books_id = NVL (p_ledger_id, 1001);
EXCEPTION
WHEN OTHERS
THEN
x_msg_status := x_msg_status || 'ERR:Closing status';

END;

-- DBMS_OUTPUT.put_line('Last Period Name ' ||lcu_get_last_period.period_name);

DBMS_OUTPUT.put_line ('Period Closing status ' || l_closing_status);

/* l_period_type := lcu_get_last_period.period_type;
l_period_set_name := lcu_get_last_period.period_set_name;
l_period_name := lcu_get_last_period.period_name;
l_period_num := lcu_get_last_period.period_num;
l_quarter_num := lcu_get_last_period.quarter_num;
l_period_year := lcu_get_last_period.period_year;*/

/* Budget Validation ends here */


gl_funds_available_pkg.calc_funds (
x_amount_type => 'YTDE',

https://chetanrajputoracleapps.blogspot.com/2019/07/oracle-budget-fund-check-procedure-for.html 3/6
3/23/24, 10:29 AM Oracle Application: How to check budget fund for specific account - Oracle Query
x_code_combination_id => l_code_combination_id,
x_account_type => 'A',
x_template_id => NULL,
x_ledger_id => p_ledger_id,
x_currency_code => l_currency_code,
x_po_install_flag => 'Y',
x_accounted_period_type => l_period_type,
x_period_set_name => l_period_set_name,
x_period_name => l_period_name,
x_period_num => l_period_num,
x_quarter_num => l_quarter_num,
x_period_year => l_period_year,
x_closing_status => l_closing_status,
x_budget_version_id => l_budget_version_id,
x_encumbrance_type_id => NVL (-1, --l_encumbrance_type_id,
-1), ---1,
x_req_encumbrance_id => NULL, --1000,--l_req_encumbrance_id ,
x_po_encumbrance_id => NULL, --1001,--l_po_encumbrance_id,
x_budget => lx_budget,
x_encumbrance => lx_encumbrance,
x_actual => lx_actual,
x_funds_available => lx_funds_available_temp,
x_req_encumbrance_amount => lx_req_encumbrance_amount,
x_po_encumbrance_amount => lx_po_encumbrance_amount,
x_other_encumbrance_amount => lx_other_encumbrance_amount);

DBMS_OUTPUT.put_line (
'Amount Available (lx_funds_available_temp):'
|| lx_funds_available_temp);

------------------------

DBMS_OUTPUT.put_line ('Budget amount is ' || lx_budget);

DBMS_OUTPUT.put_line ('Encumbrance amount is ' || lx_encumbrance);

DBMS_OUTPUT.put_line ('Actual amount is ' || lx_actual);

DBMS_OUTPUT.put_line ('From Currency is ' || l_currency_code);

DBMS_OUTPUT.put_line ('To Currency is ' || l_rei_curr_code);

IF (NVL (lx_funds_available_temp, 0) < NVL (p_amount, 0))


THEN
x_msg_data := 'Insufficient Funds';
x_msg_status := 'N';
ELSE
x_msg_data := 'sufficient Funds';
x_msg_status := 'Y';

END IF;

END IF;

px_result := x_msg_status;
px_fund_available := NVL (lx_funds_available_temp, 0);
EXCEPTION
WHEN OTHERS
THEN
x_msg_data := 'Insufficient Funds';
DBMS_OUTPUT.put_line ('Error:' || SQLERRM);
x_msg_status := 'insufficient fund3';
px_result := x_msg_status;

END is_fund_available;

----Testing PLSQL Script----

DECLARE
px_fund_available NUMBER:=0;
px_result VARCHAR2(1000):=NULL;
begin

https://chetanrajputoracleapps.blogspot.com/2019/07/oracle-budget-fund-check-procedure-for.html 4/6
3/23/24, 10:29 AM Oracle Application: How to check budget fund for specific account - Oracle Query

is_fund_available('100.21000.120402.0000000.000.0002.000',0,'01-JUL-
19',NULL,px_fund_available,px_result);
insert into temp_tbl values(1,px_fund_available);
insert into temp_tbl values(2,px_result);
commit;
end;

---Output---

You can able check fund for the specific account from oracle application screen.

Navigation: General Ledger Super User > Inquiry > Fund

You can query that specific account code for a specific period and check the funds available.

Posted by Chetan Rajput at 03:20

No comments:

Post a Comment

https://chetanrajputoracleapps.blogspot.com/2019/07/oracle-budget-fund-check-procedure-for.html 5/6
3/23/24, 10:29 AM Oracle Application: How to check budget fund for specific account - Oracle Query
To leave a comment, click the button below to sign in with Google.

SIGN IN WITH GOOGLE

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

Pages

Home
Terms and Conditions
Privacy Policy

Simple theme. Theme images by molotovcoketail. Powered by Blogger.

https://chetanrajputoracleapps.blogspot.com/2019/07/oracle-budget-fund-check-procedure-for.html 6/6

You might also like