Академический Документы
Профессиональный Документы
Культура Документы
Prepared By:
Author: Vaishali Karanth
Creation Date: 15-Oct-2015
Last Updated:
Control Number: 1
Version:
Copyright (C) 1995 Oracle Corporation
All Rights Reserved
Product Design and Architecture
Contents
1.Goal ............................................................................................................................................................ 3
2.Introduction ............................................................................................................................................... 3
3. Prerequisite ............................................................................................................................................... 3
4.6 ALLOW-ABAT_REC_TYPE..................................................................................................................... 7
4.7 Sample Code for creating a variable rent using API is ........................................................................ 7
5.1 The sample script for update variable rent agreement is ................................................................ 11
1.Goal:
This document is written to explain the usage and structures of the Variable rent Create and Update APIs in Oracle Property
Manager Module
2.Introduction
You can use this API to create and update variable rent agreements from a custom table .
The Create/Update Variable Rent API enables you to create a new variable Rent Agreement and update existing variable rent
agreements. The Create/Update Variable Rent uses the PN_VAR_RENT_PUB
Procedure.
3. Prerequisite
The Variable rent Create / update API is available only from 12.1.3 application version onwards. On 12.1.3, it is recommended
to apply patch 21614433:R12.PN.B to avoid any known bug in Variable Rent API Code.
The Create/Update Variable Rent API package is called: PN_VAR_RENT_PUB. The procedures in this package are
PN_VAR_RENT_PUB.create_var_rent and PN_VAR_RENT_PUB.update_var_rent.
The following table provides the arguments,types, value, and descriptions of the elements of the
PN_VAR_RENT_PUB procedure.
Each argument has a prefix of P, X, or PX. These prefixes mean the following:
• P - indicates an In argument
• X - indicates an Out argument
4.1 VAR_RENT_REC_TYPE
The VAR_RENT_REC_TYPE structure contains information about the Variable rent header informations, such as the lease
name, variable rent number etc. The following table shows type and value information for each argument.
Argument Required / Optional Type Value
4.2 VARIABLE_RENT_LINES_REC
VARIABLE_RENT_LINES_REC_TYPE structure contains information about the Variable rent lines like start date, end date of the
line and line types etc. The following table shows type and value information for each argument.
4.4 BREAKPOINT_Details_REC_TYPE
The BREAKPOINT_Details_REC_TYPE structure contains information about the Variable rent breakpoint, such as the breakpoint
Start and End date, breakpoint volume Details, Rate etc. The following table shows type and value information for each
argument.
4.5 CONSTRAINTS_REC_TYPE
The Constraints_Rec_type structure contains information about the Variable rent breakpoint constraints such as the
Constraint Start and End date, Constraint type etc. The following table shows type and value information for each argument
4.6 ALLOW-ABAT_REC_TYPE
The Allow_abat_rec_type structure contains information about the abatements such as the abatement type, abatement start
date, abatement end date etc. The following table shows type and value information for each argument
set serveroutput on
DECLARE
lv_mesg VARCHAR2(2000);
lv_api_version NUMBER;
lv_init_msg_list varchar2(100);
lv_rent_num VARCHAR2(50);
lv_rent_id NUMBER;
lv_validate VARCHAR2(100);
lv_msg_count NUMBER;
lv_msg_data VARCHAR2(1000);
lv_return_status VARCHAR2(10);
p_count NUMBER := 0;
lv_var_rent_rec pn_varen_pvt.var_rent_rec_type;
lv_variable_rent_lines_rec pn_varen_pvt.variable_rent_lines_rec_type;
lv_breakpoint_header_rec pn_varen_pvt. breakpoint_header_rec_type;
lv_breakpoint_details_rec pn_varen_pvt.breakpoint_details_rec_type;
lv_constraints_rec pn_varen_pvt.constraints_rec_type;
lv_variable_rent_lines_tbl pn_varen_pvt.variable_rent_lines_tbl_type;
lv_breakpoint_header_tbl pn_varen_pvt.breakpoint_header_tbl_type;
lv_breakpoint_details_tbl pn_varen_pvt.breakpoint_details_tbl_type;
lv_constraints_tbl pn_varen_pvt.constraints_tbl_type;
lv_allow_abat_tbl pn_varen_pvt.allow_abat_tbl_type;
lv_generate_periods VARCHAR2(2) := 'Y';
lv_generate_breakpoints VARCHAR2(2) := 'Y';
lv_generate_constraints VARCHAR2(2) := 'Y';
BEGIN
---Set the applications context
mo_global.init ('PN');
mo_global.set_policy_context ('S', '204');
fnd_global.apps_initialize (1318,21513,240);
---Initializing variables
--VR Header
--lv_var_rent_rec.rent_num := '111';
lv_var_rent_rec.lease_id:= 1240 ;
lv_var_rent_rec.location_id := NULL;
lv_var_rent_rec.location_code := NULL;
lv_var_rent_rec.term_template_id := 10020;
lv_var_rent_rec.abstracted_by_user_id := 1318;
lv_var_rent_rec.commencement_date := to_date('01-MAY-1999' , 'DD-MON-YYYY');
lv_var_rent_rec.termination_date := to_date('30-NOV-2004' , 'DD-MON-YYYY');
lv_var_rent_rec.currency_code := 'USD';
--lv_var_rent_rec.agreement_template_name := NULL;
lv_var_rent_rec.proration_rule_code := 'STD';
--lv_var_rent_rec.proration_days := 365;
lv_var_rent_rec.cumulative_vol_code:= 'C';
lv_var_rent_rec.invoice_on_code := 'ACTUAL';
lv_var_rent_rec.negative_rent_code := 'IGNORE';
--lv_var_rent_rec.order_of_appl_code :=
lv_var_rent_rec.purpose_code := 'RENT';
lv_var_rent_rec.type_code := 'PRCT' ;
--- lv_var_rent_rec.uom_code := ''
lv_var_rent_rec.creation_date := SYSDATE;
lv_var_rent_rec.created_by :=1318;
lv_var_rent_rec.last_update_date := SYSDATE;
lv_var_rent_rec.last_updated_by := 1318;
lv_var_rent_rec.comments := 'Test_VR';
lv_var_rent_rec.invg_freq_code := 'MON';
lv_var_rent_rec.period_type := 'YR';
lv_var_rent_rec.reptg_freq_code := 'MON';
--lv_var_rent_rec.var_rent_id :=
lv_var_rent_rec.vrg_reptg_freq_code := 'MON';
--VR Lines
--lv_variable_rent_lines_rec.line_default_id :=
lv_variable_rent_lines_rec.line_num := 1;
-- lv_variable_rent_lines_rec.var_rent_id := lv_var_rent_rec.var_rent_id; /*Included */
--lv_variable_rent_lines_rec.var_rent_num := '111' ;
lv_variable_rent_lines_rec.sales_channel_code :='DIRECT';
--lv_variable_rent_lines_rec.sales_channel_meaning :=
lv_variable_rent_lines_rec.item_category_code := 'FOOD' ;/*Included*/
--lv_variable_rent_lines_rec.item_category_meaning :=
--lv_variable_rent_lines_rec.agreement_template_id :=
lv_variable_rent_lines_rec.line_start_date := to_date('01-MAY-1999' , 'DD-MON-YYYY');
lv_variable_rent_lines_rec.line_end_date := to_date('30-NOV-2004' , 'DD-MON-YYYY');
-- lv_variable_rent_lines_rec.processed_flag :=
lv_variable_rent_lines_rec.last_update_date := SYSDATE;
lv_variable_rent_lines_rec.last_updated_by := 1318;
lv_variable_rent_lines_rec.creation_date := SYSDATE;
lv_variable_rent_lines_rec.created_by := 1318;
lv_variable_rent_lines_rec.last_update_login := 1318;
lv_variable_rent_lines_tbl(1) := lv_variable_rent_lines_rec;
--Breakpoint Header
--lv_breakpoint_header_rec.bkhd_default_id :=
lv_breakpoint_header_rec.bkhd_detail_num := 1;
--lv_breakpoint_header_rec.line_default_id := lv_variable_rent_lines_rec.line_default_id;
lv_breakpoint_header_rec.bkhd_start_date := to_date('01-MAY-1999' , 'DD-MON-YYYY');
lv_breakpoint_header_rec.bkhd_end_date := to_date('30-NOV-2004' , 'DD-MON-YYYY');
lv_breakpoint_header_rec.break_type_code := 'ARTIFICIAL'; --constant
--lv_breakpoint_header_rec.break_type_meaning
lv_breakpoint_header_rec.natural_break_rate := NULL;
lv_breakpoint_header_rec.breakpoint_type_code := 'STRATIFIED';
--lv_breakpoint_header_rec.breakpoint_type_meaning
-- lv_breakpoint_header_rec.var_rent_id :=lv_var_rent_rec.var_rent_id; /*Included */
lv_breakpoint_header_rec.last_update_date := SYSDATE;
lv_breakpoint_header_rec.last_updated_by := 1318;
lv_breakpoint_header_rec.creation_date := SYSDATE;
lv_breakpoint_header_rec.created_by := 1318;
lv_breakpoint_header_rec.last_update_login := 1318;
lv_breakpoint_header_tbl(1) := lv_breakpoint_header_rec;
---Breakpoint Line
--lv_breakpoint_details_rec.bkdt_default_id
lv_breakpoint_details_rec.bkdt_detail_num :=1;
lv_breakpoint_details_rec.bkhd_detail_num := lv_breakpoint_header_rec.bkhd_detail_num ; /*Included*/
--lv_breakpoint_details_rec.bkhd_detail_num := 1; /*Included*/
lv_breakpoint_details_rec.bkdt_start_date := to_date('01-MAY-1999' , 'DD-MON-YYYY');
lv_breakpoint_details_rec.bkdt_end_date := to_date('30-NOV-2004' , 'DD-MON-YYYY');
lv_breakpoint_details_rec.period_bkpt_vol_start := 0;
lv_breakpoint_details_rec.period_bkpt_vol_end := 240000;
lv_breakpoint_details_rec.bkpt_rate := 0.6;
lv_breakpoint_details_rec.last_update_date := SYSDATE;
lv_breakpoint_details_rec.last_updated_by := 1318;
lv_breakpoint_details_rec.creation_date := SYSDATE;
lv_breakpoint_details_rec.created_by := 1318;
lv_breakpoint_details_rec.last_update_login := 1318;
-- lv_breakpoint_details_rec.var_rent_id := lv_var_rent_rec.var_rent_id; /*Included */
lv_breakpoint_details_tbl(1) := lv_breakpoint_details_rec;
lv_breakpoint_details_rec.bkdt_detail_num :=2;
lv_breakpoint_details_rec.bkhd_detail_num := lv_breakpoint_header_rec.bkhd_detail_num ; /*Included*/
--lv_breakpoint_details_rec.bkhd_detail_num := 1; /*Included*/
lv_breakpoint_details_rec.bkdt_start_date := to_date('01-MAY-1999' , 'DD-MON-YYYY');
lv_breakpoint_details_rec.bkdt_end_date :=to_date('30-NOV-2004' , 'DD-MON-YYYY');
lv_breakpoint_details_rec.period_bkpt_vol_start := 240000;
lv_breakpoint_details_rec.period_bkpt_vol_end := 300000;
lv_breakpoint_details_rec.bkpt_rate := 0.7;
lv_breakpoint_details_rec.last_update_date := SYSDATE;
lv_breakpoint_details_rec.last_updated_by := 1318;
lv_breakpoint_details_rec.creation_date := SYSDATE;
lv_breakpoint_details_rec.created_by := 1318;
lv_breakpoint_details_rec.last_update_login := 1318;
-- lv_breakpoint_details_rec.var_rent_id := lv_var_rent_rec.var_rent_id; /*Included */
lv_breakpoint_details_tbl(2) := lv_breakpoint_details_rec;
DBMS_OUTPUT.put_line('Calling API');
PN_VAR_RENT_PUB.create_var_rent (
p_api_version => 1.0
, p_init_msg_list => FND_API.g_false
, p_commit => fnd_api.g_true
, p_validate_flag => fnd_api.g_true
, p_var_rent_rec => lv_var_rent_rec
, p_variable_rent_lines_tbl => lv_variable_rent_lines_tbl
, p_breakpoint_header_tbl => lv_breakpoint_header_tbl
, p_breakpoint_details_tbl => lv_breakpoint_details_tbl
, p_constraints_tbl => lv_constraints_tbl
, p_allow_abat_tbl => lv_allow_abat_tbl
, p_generate_periods => lv_generate_periods
, p_generate_breakpoints => lv_generate_breakpoints
, p_generate_constraints => lv_generate_constraints
, x_return_status => lv_return_status
, x_msg_count => lv_msg_count
, x_msg_data => lv_msg_data
, x_var_rent_id => lv_rent_id
, x_var_rent_num => lv_rent_num
);
DBMS_OUTPUT.put_line('RETURN_STATUS : '||lv_return_status);
DBMS_OUTPUT.put_line('RENT_ID : '||lv_rent_id);
IF lv_msg_count = 1
THEN
DBMS_OUTPUT.put_line ('lv_msg_data ' || lv_msg_data);
ELSIF lv_msg_count > 1
THEN
LOOP
p_count := p_count + 1;
lv_msg_data := fnd_msg_pub.get (fnd_msg_pub.g_next, fnd_api.g_false);
IF lv_msg_data IS NULL
THEN
EXIT;
END IF;
DBMS_OUTPUT.put_line ('Message ' || p_count || '. ' || lv_msg_data);
END LOOP;
END IF;
--COMMIT;
end;
Note:- The value passed to the below parameters needs to be changed according to the Property Manager Responsibility id and
user id from which the script is being run.
In the above script org_id (204), resp_id (21513) and user_id (1318).
Also while trying to update the existing variable rent agreement, the below three parameters need to be passed
p_undo_periods – Should be set to ‘Y’ if we want to undo the variable rent periods which are already generated.
Other wise p_undo_periods should be set to ‘N’
p_undo_breakpoints - When you want to update the breakpoints through Update_Var_Rent API, the parameter
'p_undo_breakpoints' should have a value 'Y'.
p_undo_constraints - When you want to update the constraints through Update_Var_Rent API, the parameter
'p_undo_constraints' should have a value 'Y'.
create or replace
PROCEDURE XX_UPDATE_VRENT_BREAKPOINT_API(
errbuf OUT VARCHAR2,
retcode OUT NUMBER )
IS
lv_var_rent_rec pn_varen_pvt.upd_var_rent_rec_type;
lv_var_rent_lines_tbl pn_varen_pvt.variable_rent_lines_tbl_type;
lv_breakpoint_header_tbl pn_varen_pvt.breakpoint_header_tbl_type;
lv_breakpoint_details_tbl pn_varen_pvt.breakpoint_details_tbl_type;
lv_constraint_tbl pn_varen_pvt.constraints_tbl_type;
lv_allow_tbl pn_varen_pvt.allow_abat_tbl_type;
lv_return_status VARCHAR2 (1);
lv_msg_count NUMBER;
lv_msg_data VARCHAR2 (2000);
lv_vrent_lines_rec apps.pn_varen_pvt.variable_rent_lines_rec_type;
lv_breakpoint_header_rec apps.pn_varen_pvt.breakpoint_header_rec_type;
lv_breakpoint_line_rec apps.pn_varen_pvt.breakpoint_details_rec_type;
BEGIN
--DBMS_OUTPUT.put_line ('Apps Initialize:');
apps.mo_global.set_policy_context ('S', 204);
fnd_global.apps_initialize( user_id => 1318, -- operations
resp_id => 21513, -- Property Manager, Vision Operations (USA)
resp_appl_id => 240 -- Property Manager
);
--DBMS_OUTPUT.put_line ('Start');
--Vrent Details
--lv_var_rent_rec.var_rent_id := 28024;
apps.pn_var_rent_pub.update_var_rent
( p_api_version => 1.0,
p_init_msg_list => apps.fnd_api.g_false,
p_commit => apps.fnd_api.g_false,
p_validate_flag => 'N',
p_upd_var_rent_rec => lv_var_rent_rec,
p_var_rent_lines_tbl => lv_var_rent_lines_tbl,
p_breakpoint_header_tbl => lv_breakpoint_header_tbl,
p_breakpoint_details_tbl => lv_breakpoint_details_tbl,
p_constraints_tbl => lv_constraint_tbl,
p_allow_abat_tbl => lv_allow_tbl,
p_undo_periods => 'N',
p_undo_breakpoints => 'Y',
p_undo_constraints => 'N',
x_return_status => lv_return_status,
x_msg_count => lv_msg_count,
x_msg_data => lv_msg_data
);
lv_msg_count := apps.fnd_msg_pub.count_msg;
IF lv_msg_count > 0 THEN
lv_mesg := ';' || SUBSTR (apps.fnd_msg_pub.get (apps.fnd_msg_pub.g_first, apps.fnd_api.g_false ), 1, 512 );
FOR i IN 1 .. (lv_msg_count - 1)
LOOP
lv_mesg := lv_mesg || ';' || SUBSTR (apps.fnd_msg_pub.get (apps.fnd_msg_pub.g_next, apps.fnd_api.g_false ),
1, 512 );
END LOOP;
END IF;
END IF;
apps.fnd_file.put_line (apps.fnd_file.LOG, lv_mesg);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
apps.fnd_file.put_line (apps.fnd_file.LOG, 'Main Exception ' || SQLERRM);
END;