OZF_FUND_UTILIZED_PVT.create_utilization


 

 

SET serveroutput on;
DECLARE
l_user_name VARCHAR2(100) ;
l_user_id NUMBER;
l_resp_id NUMBER;
l_adj_rec OZF_FUND_UTILIZED_PVT.utilization_rec_type;
l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
l_utilization_id NUMBER;
BEGIN

BEGIN
select responsibility_id
into l_resp_id
from fnd_responsibility_vl
where responsibility_key = ‘OZF_USER’;
EXCEPTION
WHEN OTHERS THEN
l_resp_id := NULL;
END;

FND_GLOBAL.apps_initialize (user_id => 1234 — change this value
, resp_id => l_resp_id, — Oracle trade management user
resp_appl_id => 123 — Oracle Trade management
);
FND_PROFILE.put (‘FND_AS_MSG_LEVEL_THRESHOLD’, FND_MSG_PUB.G_MSG_LVL_DEBUG_HIGH);
FND_MSG_PUB.initialize;

l_adj_rec.adjustment_type_id := 402;
l_adj_rec.utilization_type := ‘ADJUSTMENT’;
l_adj_rec.adjustment_desc :=’Adjustment from Public API’;
l_adj_rec.fund_id := 10001; — fund_id
l_adj_rec.amount := 15;
l_adj_rec.plan_curr_amount := 15;
l_adj_rec.adjustment_date := ’19-DEC-2013′;
l_adj_rec.gl_date := ’19-DEC-2013′;
l_adj_rec.exchange_rate_date := ’19-DEC-2013′;
l_adj_rec.component_type := ‘OFFR’;
l_adj_rec.component_id := 29400;
l_adj_rec.plan_type := ‘OFFR’;
l_adj_rec.plan_id := 29400; — qp_list_header_id
l_adj_rec.product_level_type := ‘PRODUCT’;
l_adj_rec.product_id := 165954; — inventory_item_id
l_adj_rec.currency_code := ‘USD’;
l_adj_rec.plan_currency_code := ‘USD’;
l_adj_rec.fund_request_currency_code := ‘USD’;
l_adj_rec.cust_account_id := 1046; — max(cust_account_id) FROM ozf_funds_utilized_all_b.
l_adj_rec.billto_cust_account_id := 1046;
l_adj_rec.org_id := 81;

OZF_FUND_UTILIZED_PVT.create_utilization (
p_api_version => 1.0
,p_init_msg_list => fnd_api.g_false
,p_commit => fnd_api.g_false
,p_validation_level => fnd_api.g_valid_level_full
,x_return_status => l_return_status
,x_msg_count => l_msg_count
,x_msg_data => L_MSG_DATA
,p_create_gl_entry => fnd_api.g_false
,p_utilization_rec => l_adj_rec
,x_utilization_id => l_utilization_id
);

dbms_output.put_line( ‘ l_utilization_id ‘||l_utilization_id);

dbms_output.put_line(‘Create_Fund_Adjustment returns ‘ || l_return_status);
IF l_return_status <> ‘S’ THEN
FOR i IN 1..l_msg_count
LOOP
dbms_output.put_line(SUBSTR(fnd_msg_pub.get(p_msg_index => i, p_encoded => ‘F’), 1, 254));
END LOOP;
ROLLBACK;
ELSE
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(‘exception in creating adjustment’);
ROLLBACK;
END;

 

— Select * from OZF_FUNDS_UTILIZED_ALL_B where utilization_id = 11240; –l_utilization_id
— Navigation to view the Budget Adjustment
— Oracle Trademanagement User -> Funds -> Search for the Budget -> Checkbook -> There you can see the increment in Earned/utilized amount