Professional Documents
Culture Documents
Author: Last Updated: File URL: Version: Sreedhar Maya 24-Nov-10 http://files.oraclecorp.com/ 1.4 Creation Date: 2-Sep-10
This document is not a promise to deliver and may not be included as part of any contract.
1.
Document Control
1.1
Change Record
Author Sreedhar Maya Sreedhar Maya Sreedhar Maya Vamshi Katta Vamshi Katta
Change Reference First Draft Updated the API details with new approach, separate procedures for generate periods and generate abatement, constraints and break points. Updated with Update Variable Rent part of the API. Updated Record types, table types of the API & also Apendix. Updated TDD.
1.2
Contributors
Role Property Manager Development Property Manager Development Property Manager Development
Position
1.3
Reviewers
Name
Role
Position
Document Status
Date Reviewed
Comments Incorporated
Document Control
Page ii of 34
Contents
1.Document Control.................................................................................ii
1.1 Change Record............................................................................................ii 1.2 Contributors...............................................................................................ii 1.3 Reviewers...................................................................................................ii
2.Introduction.......................................................................................... 1
2.1 Scope for this Document..............................................................................1 2.2 Document Reference...................................................................................1
2.2.1 Current Document References.............................................................................................................................................1 2.2.2 Historical Document References.........................................................................................................................................1
3.Technical Overview................................................................................ 2
3.1 Design Goals...............................................................................................2 3.2 Technology.................................................................................................2 3.3 Design Assumptions ...................................................................................2
3.3.1 Create Variable Rent............................................................................................................................................................2 3.3.2 Update Variable Rent: ........................................................................................................................................................2 3.3.3 Generate Periods: ...............................................................................................................................................................2 3.3.4 Calculation Override ...........................................................................................................................................................2
4.Architecture ......................................................................................... 4
4.1 System Flow and Interaction Diagram..........................................................4 4.2 System Interfaces.......................................................................................5 4.3 Physical Data Model....................................................................................5
Document Control
Page iii of 34
6.3.2 PN_VAREN_PVT Pseudo-Code.......................................................................................................................................13 6.3.2.1 PN_VAREN_PVT.CREATE_VAR_RENT Procedure.................................................................14 6.3.2.2 PN_VAREN_PVT.GENERATE_PERIODS Procedure..............................................................17 6.3.2.3 PN_VAREN_PVT.UNDO_BREAKPOINTS Procedure..............................................................18 6.3.2.4 PN_VAREN_PVT.UNDO_CONSTRAINTS Procedure..............................................................19 6.3.2.5 PN_VAREN_PVT.GENERATE_ABAT_BREKPOINTS Procedure...............................................19 6.3.2.6 PN_VAREN_PVT.UPDATE_VAR_RENT Procedure.................................................................19 6.3.2.7 PN_VAREN_UTIL Pseudo-Code................................................................................................................................22 6.3.2.8 PN_VRA_CLIENT_EXTN.CALCULATE_OVERRIDE Pseudo-Code......................................................................25
7 Log Output..................................................................................................27 8 Concurrent Request Output..........................................................................28 a. Table and View Usage..................................................................................28 b. Sequence Usage..........................................................................................29 c. Restart Strategy..........................................................................................29 d. Crash Recovery...........................................................................................29 e. Database Triggers.......................................................................................29 f. Table Handlers (NEW/ CHANGED)..................................................................29
............................................................................................................35
13.1.5 Constraints Table Type ......................................................................................................................................35 13.1.6 Allowances & Abatements Table Type ........................................................................................................................35
............................................................36
Document Control
Page iv of 34
2.
Introduction
This document defines the technical components required to create the Variable Rent and Breakpoint APIs for Property Manager. This Application Extension Technical Design document complements the application extension function design document for Variable Rent and Breakpoint APIs (FDD PN Variable Rent and Breakpoints APIs v1.3.doc).
2.1
2.2
Document Reference
2.2.1 Current Document References
URL N/A
Comments None
2.2.2
URL N/A
Comments None
Document Control
Page 1 of 34
3.
Technical Overview
The section list the technical overview for creating Variable rent and Breakpoint APIs.
3.1
Design Goals
Below is the list of goals defined in this document. 1. 2. Designing an API for Create Variable Rent. Designing and API for Update Variable Rent.
3.2
Technology
No New technology is used for designing and developing the APIs for Variable Rent and Breakpoints.
3.3
Design Assumptions
This design assumes that the following assumptions are true:
3.3.1
3.3.2
3.3.3
Generate Periods:
This section lists the design assumptions for Generate Periods. Periods are generated by calling an existing concurrent program for Generate Periods Calculate Variable Rent Calculate Variable Rent is initiated if the input variable generate_periods is Yes for the calling program i.e., Create program for Variable Rent. Periods can be generated from Create APIs for Variable Rent If the Calculate Variable Rent program completes in status Error or Warning, the creation/updating of Variable Rent cannot be reverted.
3.3.4
Calculation Override
This section lists the design assumptions for Variable rent Override. Profile option PN: Override Variable Rent is set to Yes, to override the calculations
Document Control
Page 2 of 34
Hook is customized to override the calculations Calculations are overridden only upon Calculate All button is pressed manually. No pl/sql code is provided for initiating Calculate All buttons logic.
3.4
Design Constraints
Not Applicable
Document Control
Page 3 of 34
4.
Architecture
This section describes the technical architecture for Variable Rent and Breakpoint APIs.
4.1
Document Control
Page 4 of 34
4.2
System Interfaces
This document doesnt capture the interaction of Oracle application user interface.
4.3
Document Control
Page 5 of 34
5.
Technical Components
There are no new Tables/Views are created as part of Create/Update Variable Rent APIs.
Document Control
Page 6 of 34
6.
6.1
Parameters (IN/OUT)
6.1.1 Procedure CREATE_VAR_RENT accepts the following parameters
Usage IN IN IN IN Type NUMBER NUMBER NUMBER VARCHAR2 Required Yes Yes Yes No Description API Standard API Standard API Standard Default value is N. If Y then, program takes care of validation of the input parameters and returns whether they are valid or not. If N then, program not only validates the input parameters but also after successful validation inserts records into base tables. Variable Rent Record Type Variable Rent Lines Table Type Breakpoint Header Table Type Breakpoint Details Table Type Constraints Table Type Allowances & Abatements Table Type Default value is N. If Y then generate the periods and able to create Breakpoints, Constraints, Allowances and Abatements. Generate Breakpoints Button. If Value is 'Y' then needs to generate Breakpoints. Default Value is 'N". Generate Constraints Button. If the Value is 'Y' then, need to generate constraints. Default value is 'N'. Return status. Valid values are: S (Success), E (Error), and U (Unexpected error). API Standard API Standard Variable rent Id Variable Rent Number
P_VAR_RENT_REC P_VARIABLE_RENT_LINES_TB L P_BREAKPOINT_HEADER_TBL P_BREAKPOINT_DETAILS_TBL P_CONSTRAINTS_TBL P_ALLOW_ABAT_TBL P_GENERATE_PERIODS P_GENERATE_BREAKPOINTS P_GENERATE_CONSTRAINTS X_RETURN_STATUS X_MSG_COUNT X_MSG_DATA X_VAR_RENT_ID X_VAR_RENT_NUM
RECORD TYPE TABLE TYPE TABLE TYPE TABLE TYPE TABLE TYPE TABLE TYPE VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 NUMBER VARCHAR2 NUMBER VARCHAR2
6.1.2
P_VAR_RENT_ID P_GENERATE_PERIODS
IN IN
NUMBER VARCHAR2
Document Control
Page 7 of 34
Required
Description Return status. Valid values are: S (Success), E (Error), and U (Unexpected error). API Standard API Standard
P_VARIABLE_RENT_LINES_TB L P_BREAKPOINT_HEADER_TBL P_BREAKPOINT_DETAILS_TBL P_CONSTRAINTS_TBL P_ALLOW_ABAT_TBL X_RETURN_STATUS X_MSG_COUNT X_MSG_DATA X_VAR_RENT_ID X_VAR_RENT_NUM
TABLE TYPE TABLE TYPE TABLE TYPE TABLE TYPE TABLE TYPE VARCHAR2 NUMBER VARCHAR2 NUMBER VARCHAR2
6.1.4
P_UPD_VAR_RENT_REC P_VARIABLE_RENT_LINES_TBL
IN IN
Yes Yes
P_BREAKPOINT_HEADER_TBL
IN
TABLE TYPE
Yes
P_BREAKPOINT_DETAILS_TBL
IN
TABLE TYPE
Yes
Document Control
Page 8 of 34
Parameter
Usage
Type
Required
Description of a new Breakpoint Detail line, if BKDT_DEFAULT_ID is null of that record type. Constraints Table Type Update of Variable Rent will handle creation of a new Constraint line, if CONSTR_DEFAULT_ID is null of that record type. Note: Need to make sure that for single VRA we can have only two constraint records i.e. of constraint type as Maximum and Minimum. Allowances & Abatements Table Type Update of Variable Rent will handle creation of a new Allowance and Abatement line, if ABATEMENT_ID is null of that record type. If Y then Undo the periods and able to update Breakpoints, Constraints, Allowances and Abatements. If N, then no need to undo periods i.e., no need to update the Variable Rent details. Default value is 'Y'. Undo Breakpoints Button. If Value is 'Y' means undo Breakpoints. If N then no need to undo Breakpoints i.e., no need to update breakpoints details. Default value is 'Y'. Undo Constraints Button. If the Value is 'Y' means Undo constraints. If the Value is N means no need to undo constraints i.e., no need to update the constraints. Default value is 'Y'. Return status. Valid values are: S (Success), E (Error), and U (Unexpected error). API Standard API Standard
P_CONSTRAINTS_TBL
IN
TABLE TYPE
Yes
P_ALLOW_ABAT_TBL
IN
TABLE TYPE
Yes
P_UNDO_PERIODS
IN
VARCHAR2
No
P_UNDO_BREAKPOINTS
IN
VARCHAR2
No
P_UNDO_CONSTRAINTS
IN
VARCHAR2
No
Parameter P_VAR_RENT_ID P_TRX_HEADER_ID P_CALCULATED_RENT P_PRORATED_RENT P_PERCENT_RENT P_YTD_PERCENT_RENT P_FIRST_YR_RENT X_RETURN_STATUS X_MSG_COUNT X_MSG_DATA
Type NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER VARCHAR2 NUMBER VARCHAR2
Description Var_rent_id for which the calculation override is used. Trx_header_id Calculated_rent Prorated_rent Percent_rent Ytd_percent_rent First_yr_rent API Standard API Standard API Standard
Document Control
Page 9 of 34
6.2
Calling Arguments
This program is called by: Any custom package which passes the above parameters (Section 6.1.1) for creating new variable rent agreement.
PN_VAREN_UTIL
Based on the validation, different arguments are passed to call this package.
6.3
6.3.1
PN_VAR_RENT_PUB Pseudo-Code
6.3.1.1 CREATE_VAR_RENT Pseudo-Code
--Get the debug profile value for PN PN_DEBUG_MODE pg_debug VARCHAR2 (1) := NVL (fnd_profile.VALUE('PN_DEBUG_MODE'),'N'); Begin -- Initialize MOAC for R12 --Check if the api version passed as a parameter is equal to the existing api version(global variable) If ( l_api_version = g_api_version) THEN
--Call private api to validate the input parameters and call inbuilt package PN_VAR_RENTS_PKG.INSERT_ROW package to create the variable rent.
PN_VAREN_PVT.create_var_rent (p_commit , p_validate_flag , p_var_rent_rec , p_variable_rent_lines_tbl , p_breakpoint_header_tbl , p_breakpoint_details_tbl , p_constraints_tbl , p_allow_abat_tbl , p_generate_periods , p_generate_breakpoints
=> p_commit => p_validate_flag => p_var_rent_rec => p_variable_rent_lines_tbl => p_breakpoint_header_tbl => p_breakpoint_details_tbl => p_constraints_tbl => p_allow_abat_tbl => p_generate_periods => p_generate_breakpoints
Document Control
Page 10 of 34
, p_generate_constraints , x_return_status , x_msg_count , x_msg_data , x_var_rent_id , x_var_rent_num ); ELSE --Log message with the api version error END IF; --Standard check for the commit. IF fnd_api.to_boolean (p_commit) THEN COMMIT WORK; END IF; EXCEPTION --Calling api standard package to check the errors WHEN fnd_api.g_exc_error THEN ROLLBACK; <Log message with the error message> WHEN fnd_api.g_exc_unexpected_error THEN ROLLBACK; <Log message with the error message> WHEN OTHERS THEN ROLLBACK; <Log message with the error message> END create_var_rent;
=> p_generate_constraints => x_return_status => x_msg_count => x_msg_data => x_var_rent_id => x_var_rent_num
6.3.1.2 6.3.1.3
GENERATE_PERIODS Pseudo-Code Input parameter for this api is variable rent id Call private package to call the concurrent program to generate the periods, for the given variable rent id. GENERATE_ABAT_BREAKPOINTS Pseudo-Code Input paramters for this api is variable rent id
Document Control
Page 11 of 34
6.3.1.4
Call private package to call the concurrent program to generate the periods, for the given variable rent id. UPDATE_VAR_RENT Pseudo-Code
--Get the debug profile value for PN PN_DEBUG_MODE pg_debug VARCHAR2 (1) := NVL (fnd_profile.VALUE('PN_DEBUG_MODE'),'N'); Begin -- Initialize MOAC for R12 --Check if the api version passed as a parameter is equal to the existing api version(global variable) If ( l_api_version = g_api_version) THEN
--Call private api to validate the input parameters and update the variable rent tables accordingly.
PN_VAREN_PVT.update_var_rent (p_commit , p_validate_flag , p_upd_var_rent_rec , p_variable_rent_lines_tbl , p_breakpoint_header_tbl , p_breakpoint_details_tbl , p_constraints_tbl , p_allow_abat_tbl , p_generate_periods , p_generate_breakpoints , p_generate_constraints , x_return_status , x_msg_count , x_msg_data ); ELSE --Log message with the api version error END IF; --Standard check for the commit. IF fnd_api.to_boolean (p_commit) THEN COMMIT WORK; END IF; EXCEPTION --Calling api standard package to check the errors WHEN fnd_api.g_exc_error THEN ROLLBACK; <Log message with the error message> WHEN fnd_api.g_exc_unexpected_error THEN
=> p_commit => p_validate_flag => p_upd_var_rent_rec => p_variable_rent_lines_tbl => p_breakpoint_header_tbl => p_breakpoint_details_tbl => p_constraints_tbl => p_allow_abat_tbl => p_generate_periods => p_generate_breakpoints => p_generate_constraints => x_return_status => x_msg_count => x_msg_data
Document Control
Page 12 of 34
ROLLBACK; <Log message with the error message> WHEN OTHERS THEN ROLLBACK; <Log message with the error message> END update_var_rent;
6.3.2
PN_VAREN_PVT Pseudo-Code
PN_VAREN_PVT Specification contains all the global variables for lookup codes, record types and table types declared as shown below: -- Declaring Lookup Type constants g_cumulative_vol CONSTANT VARCHAR2 (30) := 'PN_VAR_CALCULATION_METHOD'; g_proration_rule CONSTANT VARCHAR2 (30) := 'PN_VAR_PRORATION_RULE'; g_invoice_on CONSTANT VARCHAR2 (30) := 'PN_VAR_INVOICE_ON'; g_negative_rent CONSTANT VARCHAR2 (30) := 'PN_VAR_NEGATIVE_RENT'; g_rent_type CONSTANT VARCHAR2 (30) := 'PN_VAR_RENT_TYPE'; g_payment_purpose CONSTANT VARCHAR2 (30) := 'PN_PAYMENT_PURPOSE_TYPE'; g_payment_frequency CONSTANT VARCHAR2 (30) := 'PN_PAYMENT_FREQUENCY_TYPE'; g_sales_channel CONSTANT VARCHAR2 (30) := 'PN_SALES_CHANNEL'; g_item_category CONSTANT VARCHAR2 (30) := 'PN_ITEM_CATEGORY'; g_break_type CONSTANT VARCHAR2 (30) := 'PN_VAR_BREAK_TYPE'; g_type_code CONSTANT VARCHAR2 (30) := 'PN_MAX_MIN'; g_appl_order CONSTANT VARCHAR2 (30) := 'PN_APPLICATION_ORDER'; g_excess_abate_code CONSTANT VARCHAR2 (30) := 'PN_EXCESS_ABATEMENT'; g_abate_type_code CONSTANT VARCHAR2 (30) := 'PN_ABATEMENT_TYPE'; g_pay_terms_status CONSTANT VARCHAR2 (30) := 'PN_INDEX_PAYMENT_TERM_STATUS'; --Record type for variable rent details TYPE var_rent_rec_type IS RECORD (definition contains all the columns as shown in section 11.1.1); --Record type for Variable rent lines details TYPE variable_rent_lines_rec_type IS RECORD (definition contains all the columns as shown in section 11.1.2); --Table type for variable rent lines details TYPE variable_rent_lines_tbl_type IS TABLE OF variable_rent_lines_rec_type INDEX BY BINARY_INTEGER; --Record type for Breakpoint header details TYPE breakpoint_header_rec_type IS RECORD (definition contains all the columns as shown in section 11.1.3); --Table type for breakpoint header details TYPE breakpoint_header_tbl_type IS TABLE OF breakpoint_header_rec_type INDEX BY BINARY_INTEGER; --Record type for Breakpoint details TYPE breakpoint_details_rec_type IS RECORD (definition contains all the columns as shown in section 11.1.4);
Document Control
Page 13 of 34
--Table type for breakpoint details TYPE breakpoint_details_tbl_type IS TABLE OF breakpoint_details_rec_type INDEX BY BINARY_INTEGER; --Record type for constraints details TYPE constraints_rec_type IS RECORD (definition contains all the columns as shown in section 11.1.5); --Table type for constraints details TYPE constraints_tbl_type IS TABLE OF constraints_rec_type INDEX BY BINARY_INTEGER; --Record type for allow abatement details TYPE allow_abat_rec_rec_type IS RECORD (definition contains all the columns as shown in section 11.1.6); --Table type for allow abatement details TYPE allow_abat_rec_tbl_type IS TABLE OF allow_abat_rec_rec_type INDEX BY BINARY_INTEGER; 6.3.2.1 PN_VAREN_PVT.CREATE_VAR_RENT Procedure
BEGIN -- Validate Lease Id or Lease Num or Lease Name IF ( lease_id or lease_num or lease_name is not null) THEN Call the package pn_varen_utils_pkg.validate_lease with appropriate parameters. <Error handing based on the l_return_status from the above package> END IF; BEGIN -- Validate Variable Rent Number IF ( rent_num is not null) THEN Call the package pn_varen_utils_pkg.validate_rent_num with appropriate parameters. <Error handing based on the l_return_status from the above package> END IF; --Variable Rent : Commencement date validation Check if the below conditions for commencement date to be success 1. commencement date is not null 2. commencement date > = lease commencement date 3. commencement date < = termination date If the commencement date is NULL then commencement date := lease commencement date; Else Capture the error; END IF; Similarly check the below conditions for Termination date 1. Termination date is not null 2. Termination date > lease commencement date 3. Termination date <= lease Termination date If the Termination date is NULL then Termination date := lease Termination date; Else Capture the error;
Document Control
Page 14 of 34
END IF; END IF; -- Validating location id, based on the lease_id IF ( location_id or location_code is not null) THEN Call the package pn_varen_utils_pkg.validate_location with appropriate parameters <Error handing based on the l_return_status from the above package> END IF;
-- Validating CATEGORY i.e., PROCESS_CODE IF ( purpose_code or purpose_code_meaning IS NOT NULL) THEN Call package pn_varen_utils_pkg.validate_lookups with appropriate parameters for validating purpose_code. <Error handing based on the l_return_status from the above package> END IF; -- Validating VOLUME TYPE i.e.,Variable Rent type IF ( type_code or type_meaning IS NOT NULL) THEN Call package pn_varen_utils_pkg.validate_lookups with appropriate parameters for validating type_code. <Error handing based on the l_return_status from the above package> END IF; -- Validating ABSTRACTED BY i.e., USER IF (abstracted_by_user IS NOT NULL) THEN Call package pn_varen_utils_pkg.validate_abst_user to validate the abstracted by user. <Error handing based on the l_return_status from the above package> END IF; -- Validating CUMMULATIVE VOLUME i.e., Calculation Method IF ( cumulative_vol_code or cumulative_vol_meaning IS NOT NULL) THEN Call package pn_varen_utils_pkg.validate_lookups to validate the cummulative volume <Error handing based on the l_return_status from the above package> END IF; -- Validating PRORATION RULE i.e., Partial Year method IF ( proration_rule_code or proration_rule_meaning IS NOT NULL) THEN Call package pn_varen_utils_pkg.validate_lookups to validate proration rule. <Error handing based on the l_return_status from the above package> END IF; -- Validating invoice on
Document Control
Page 15 of 34
IF ( invoice_on_code or invoice_on_meaning IS NOT NULL) THEN Call package pn_varen_utils_pkg.validate_lookups to validate invoice_on_code. <Error handing based on the l_return_status from the above package> END IF; -- Validating NEGATIVE RENT IF ( negative_rent_code Or negative_rent_meaning IS NOT NULL) THEN Call package pn_varen_utils_pkg.validate_lookups to validate Negative Rent. <Error handing based on the l_return_status from the above package> END IF; -- Validating TERM TEMPLATE IF ( term_template_id or term_template_name IS NOT NULL) THEN Call package pn_varen_utils_pkg.validate_term_template to validate the term template. <Error handing based on the l_return_status from the above package> END IF; --Validating CURRENCY code IF ( currency_code IS NOT NULL) THEN Call pn_varen_utils_pkg.validate_currency to validate the currency code. <Error handing based on the l_return_status from the above package> END IF; --If the program is not run with validate mode, then the insert_row program is called to insert the records into pn_var_rents_all table IF l_validate_falg <> 'Y' THEN PN_VAR_RENTS_PKG.INSERT_ROW ( <Pass the parameters required by this package> ); PN_VAR_RENT_DATES_PKG.INSERT_ROW( <Pass the parameters required by this package> ); END IF; IF the variable rent record has been created without errors and p_generate_periods = 'Y' Then <Concurrent program Calculate Variable Rent is called with appropriate paramters> If the periods are generated without warning/error THEN <Call the Validation program for breakpoints headers and break point details > End IF; IF p_generate_constraints = 'Y' Then < validated the mandatory fields> <Create the constraints using below package> PN_VAR_CONSTRAINTS_PKG.INSERT_ROW( <Pass the parameters required by this package> ); < Call the package to generate Constraints> <Concurrent program Calculate Variable Rent is called with appropriate paramters> END IF; IF p_generate_breakpoints= 'Y' Then <Validate the mandatory columns for breakpoints > <Create the breakpoints header and details using below package>
Document Control
Page 16 of 34
PN_VAR_BKPTS_HEAD_PKG.INSERT_ROW( <Pass the parameters required by this package> ); PN_VAR_BKPTS_DET_PKG.INSERT_ROW( <Pass the parameters required by this package> ); < Call the package to generate the Break Point periods> <Concurrent program Calculate Variable Rent is called with appropriate paramters> END IF; IF p_recurring_abatements = 'Y' Then <Validate the mandatory columns for abatements/allowances > < Call the package to generate recurring abatements> <Concurrent program Calculate Variable Rent is called with appropriate paramters> END IF; END create_var_rent; 6.3.2.2 PN_VAREN_PVT.GENERATE_PERIODS Procedure <Check if dates are created using below query> CURSOR c_dates_created IS SELECT COUNT (*) FROM pn_var_rent_dates_all WHERE var_rent_id = p_var_rent_id; If <the dates are created> THEN Fetch the dates related columns from pn_var_rent_dates_all table as shown below. SELECT pvrd.use_gl_calendar , pvrd.year_start_date , pvra.var_rent_id , pvra.cumulative_vol , pvra.chg_cal_var_rent_id FROM pn_var_rents_all pvra , pn_var_rent_dates_all pvrd WHERE pvra.var_rent_id = pvrd.var_rent_id AND pvra.var_rent_id = p_var_rent_id; END IF; --Check if periods exists l_period_exists := pn_var_rent_pkg.find_if_period_exists (l_varentid); IF NVL (l_period_exists , 9898 ) = 9898 THEN IF NVL (l_use_gl_calendar , 'N' ) = 'Y' THEN -Call create_var_rent_periods with parameters var_rent_id and cummulative_vol pn_var_rent_pkg.create_var_rent_periods (l_varentid , l_cumulativevol ); x_return_status := fnd_api.g_ret_sts_success; ELSIF NVL (l_use_gl_calendar , 'N' ) = 'N' THEN -Call create_var_rent_periods_nocal with parameters var_rent_id, cummulative_vol and year_start_date pn_var_rent_pkg.create_var_rent_periods_nocal (l_varentid , l_cumulativevol , l_yearstartdate ); END IF; ELSE x_return_status := fnd_api.g_ret_sts_error;
Document Control
Page 17 of 34
END IF; 6.3.2.3 PN_VAREN_PVT.UNDO_BREAKPOINTS Procedure l_period_exists := PN_VAR_RENT_PKG.find_if_period_exists(l_varentId); IF l_period_exists IS NOT NULL THEN /*codev*/ IF name_in('vol_hist_blk.vol_hist_id') IS NOT NULL THEN go_block('vol_hist_blk'); clear_block(NO_VALIDATE); END IF; DELETE FROM PN_VAR_VOL_HIST_ALL WHERE period_id IN (SELECT period_id FROM PN_VAR_PERIODS_ALL WHERE var_rent_id = l_varentId); DELETE FROM pn_var_constraints_all WHERE period_id IN (SELECT period_id FROM PN_VAR_PERIODS_ALL WHERE var_rent_id = l_varentId); DELETE FROM pn_var_bkpts_det_all WHERE var_rent_id = l_varentid; DELETE pn_var_bkpts_head_all WHERE var_rent_id = l_varentid; DELETE pn_var_lines_all WHERE var_rent_id = l_varentid; DELETE FROM pn_var_abatements_all abat WHERE abat.var_rent_id=l_varentId; PN_VAR_RENT_PKG.delete_var_rent_periods(l_varentId); PN_VAR_TRX_PKG.delete_transactions( p_var_rent_id => l_varentId ,p_period_id => NULL ,p_line_item_id => NULL); PN_VAR_DEFAULTS_PKG.delete_default_lines(l_varentId); DELETE FROM pn_var_abat_defaults_all WHERE var_rent_id = l_varentId; DELETE FROM pn_var_bkdt_defaults_all WHERE var_rent_id = l_varentid; DELETE pn_var_bkhd_defaults_all WHERE var_rent_id = l_varentid; DELETE pn_var_line_defaults_all WHERE var_rent_id = l_varentid; DELETE pn_var_constr_defaults_all WHERE var_rent_id = l_varentid; Commit;
Document Control
Page 18 of 34
6.3.2.4 PN_VAREN_PVT.UNDO_CONSTRAINTS Procedure delete from pn_var_constraints_all where constr_default_id in (select constr_default_id from pn_var_constr_defaults_all where var_rent_id = l_var_rent_id); COMMIT; 6.3.2.5 PN_VAREN_PVT.GENERATE_ABAT_BREKPOINTS Procedure --Generate Constraints --Check if constraint_default_id exists from pn_var_constr_defaults_all for the given var_rent_id. IF constraint_default_id <> 0 THEN pn_var_defaults_pkg.create_default_constraints (p_var_rent_id); END IF; --Generate Breakpoints --Check if breakpoint defaults are created from the table pn_var_bkdt_defaults_all for the given var_rent_id IF breakpoints_defaults created THEN --Call the below packages to generate breakpoints pn_var_defaults_pkg.create_setup_data (p_var_rent_id); pn_var_chg_cal_pkg.populate_transactions (p_var_rent_id); END IF; 6.3.2.6 PN_VAREN_PVT.UPDATE_VAR_RENT Procedure
PN_VAREN_PVT Specification contains all the global variables for lookup codes, as shown in section 6.3.2 <Declaration section> --Cursor to fetch the records from PN_VAR_RENTS_ALL Cursor1 --Cursor to fetch the records from PN_VAR_RENT_DATES_ALL Cursor2 --Cursor to fetch the records from PN_VAR_LINE_DEFAULTS_ALL Cursor3 --Cursor to fetch the records from PN_VAR_BKHD_DEFAULTS_ALL cursor4 --Cursor to fetch the records from PN_VAR_BKDT_DEFAULTS_ALL cursor5 --Cursor to fetch the records from PN_VAR_CONSTR_DEFAULTS_ALL cursor6 --Cursor to fetch the records from PN_VAR_ABAT_DEFAULTS_ALL cursor7 BEGIN -- Update for Variable Rent -- Open cursor1 and fetch all the cursor values into variables
Document Control
Page 19 of 34
-- Compare each column from the parameter P_VAR_RENT_REC variable with the cursor1 variables -- If the input parameter from p_var_rent_rec is different from the existing value from the cursor1 then assign the new value to p_var_rent_rec column -- Below is an example for above 3 validation points IF cursor1.cumulative_vol IS NULL or cursor1.cumulative_vol = g_mis_char THEN cursor1.cumulative_vol := p_var_rent_rec.cumulative_vol; ELSIF cursor1.cumulative_vol IS NOT NULL and (cursor1.cumulative_vol = p_var_rent_rec.cumulative_vol) THEN cursor1.cumulative_vol := p_var_rent_rec.cumulative_vol; ELSIF cursor1.cumulative_vol IS NOT NULL and (cursor1.cumulative_vol <> p_var_rent_rec.cumulative_vol) THEN validate cursor1.cumulative_vol; IF cursor1.cumulative_vol - Validated THEN cursor1.cumulative_vol := cursor1.cumulative_vol; ELSE fnd_api.set_error; END IF; END IF; -- After all the validations call the UPDATE_ROW package with the appropriate parameters IF l_validate_falg <> 'Y' THEN PN_VAR_RENTS_PKG.UPDATE_ROW( <Pass the parameters required by this package> ); END IF; -- Update for Variable Rent Dates -- Open Cursor2 and fetch all the cursor values into variables -- Compare each column from the parameter P_VAR_RENT_REC variable with the cursor2 variables -- If the input parameter from p_var_rent_rec is different from the existing value from the cursor2 then assign the new value to p_var_rent_rec column -- After all the validations, call the update_row for dates IF l_validate_falg <> 'Y' THEN PN_VAR_RENT_DATES_PKG.UPDATE_ROW( <Pass the parameters required by this package> ); END IF; -- Undo Periods -- Check if periods exist -- Call the private procedure to Undo Periods -- See section 6.3.2.3 for Undo periods logic -- Update for Breakpoints lines, headers, and details -- Call UNDO generate Breakpoints procedure before updating the breakpoints --Below is the procedures for UNDO Breakpoints pn_var_defaults_pkg.delete_default_lines (l_var_rent_id, exists_hd_def_rec.bkhd_default_id, l_bkpt_header_id); pn_var_defaults_pkg.delete_transactions (l_var_rent_id, exists_hd_def_rec.bkhd_default_id, l_bkpt_header_id); -- Open Cursor3, Cursor4 and Cursor5 and fetch the cursor values into variables -- Validate Cursor3 variables with P_VARIABLE_RENT_LINES_TBL -- Validate cursor4 variables with P_BREAKPOINT_HEADER_TBL -- and Validate cursor5 variables with P_BREAKPOINT_DETAILS_TBL
Document Control
Page 20 of 34
--Upon validation of all the cursor values with corresponding IN parameters, call respective UPDATE_ROW package -- Below is the packages for updating Variable Lines, Breakpoint Headers and Breakpoint Details respectively If row exists Then PN_VAR_LINE_DEFAULTS_PKG.UPDATE_ROW( <Pass the parameters required by this package> ); Else PN_VAR_LINE_DEFAULTS_PKG.INSERT_ROW( <Pass the parameters required by this package> ); End if; If row exists Then PN_VAR_BKHD_DEFAULTS_PKG.UPDATE_ROW( <Pass the parameters required by this package> ); ELSE PN_VAR_BKHD_DEFAULTS_PKG.INSERT_ROW( <Pass the parameters required by this package> ); END IF; If row exists Then PN_VAR_BKDT_DEFAULTS_PKG.UPDATE_ROW( <Pass the parameters required by this package> ); ELSE package> ); END IF; --After successful updating, call Generate Breakpoints procedure shown in section 6.3.2.4 -- Update Constraints -- Undo constraints -- Below is the logic to undo Constraints delete from pn_var_constraints_all where constr_default_id in (select constr_default_id from pn_var_constr_defaults_all where var_rent_id = l_var_rent_id); -- Open the cursor6 and fetch all the values into variables -- Compare the values from P_CONSTRAINTS_TBL with cursor6 variables -- upon validations, call the update_row package IF ROW EXISTS (CONSTR_DEFAULT_ID IS NOT NULL) THEN PN_VAR_CONSTR_DEFAULTS_PKG.UPDATE_ROW( <Pass the parameters required by this package> ); ELSE PN_VAR_CONSTR_DEFAULTS_PKG.INSERT_ROW( <Pass the parameters required by this package> ); -- After successful updating of constraints, call Generate Constraints procedure as shown in section 6.3.2.4 -- Update Abatements -- Open the cursor7 and fetch the values into variables -- Compare each variable from cursor7 with the values from P_ALLOW_ABAT_TBL -- Upon validation call the update_row package for Allow abatements IF ROW EXISTS (ABATEMENT_ID IS NOT NULL) THEN
Document Control
Page 21 of 34
PN_VAR_ABAT_DEFAULTS_PKG.UPDATE_ROW( <Pass the parameters required by this package> ); ELSE PN_VAR_ABAT_DEFAULTS_PKG.INSERT_ROW( <Pass the parameters required by this package> ); END IF; -- Call generate periods END update_var_rent;
Document Control
Page 22 of 34
4.
Validate if the lease details given as the parameter are existing in pn_leases_all table, using below query. Lease_num, lease_name or lease_id can be passed as parameter for the below query. SELECT lease_id , status , payment_term_proration_rule FROM pn_leases_all WHERE lease_class_code = 'DIRECT' AND ( lease_id = x_lease_id OR UPPER (lease_num) = UPPER (p_lease_num) OR UPPER (NAME) = UPPER (p_lease_name)) AND org_id = p_org_id; If the lease Status is not Final, variable rent cannot be created. Thus log messages are displayed if the Status <> Final If the lease details are not found, log messages are displayed and variable rent cannot be created. Lease cannot be created from CREATE_VAR_RENT API.
Validate Location Location details are validated based on lease_id and Location_code or Location_id. Below query is used to validate the location details. SELECT pl.location_code FROM pn_tenancies_all pt , pn_locations_all pl , pn_properties_all prop , fnd_lookups loc_lkp , fnd_lookups flg_lkp WHERE pt.location_id = pl.location_id AND prop.property_id(+) = pl.property_id AND NVL (pt.occupancy_date, pt.estimated_occupancy_date) BETWEEN pl.active_start_date AND pl.active_end_date AND pt.lease_id = p_lease_id AND pl.location_id = p_location_id AND loc_lkp.lookup_code = pl.location_type_lookup_code AND loc_lkp.lookup_type = 'PN_LOCATION_TYPE' AND flg_lkp.lookup_code = pt.primary_flag AND flg_lkp.lookup_type = 'PN_YES_NO';
5.
Validate Lookups This validation procedure validates all the parameters which are based on lookup. All the global variables listed in section 6.3.2 are validated by this procedure. Below is the query used for validation lookup based values: SELECT meaning , lookup_code FROM fnd_lookups WHERE lookup_type = p_lookup_type AND ( UPPER (lookup_code) = UPPER (x_lookup_code) OR UPPER (meaning) = UPPER (x_lookup_meaning)) AND enabled_flag = 'Y' AND TRUNC (SYSDATE) BETWEEN TRUNC (NVL (start_date_active, SYSDATE)) AND TRUNC (NVL (end_date_active, SYSDATE));
6.
Validate Term Template Term templates are validated based on the below query
Document Control
Page 23 of 34
SELECT term.term_template_id , term.NAME FROM pn_term_templates_all term WHERE active = 'Y' AND ( UPPER (NAME) = UPPER (x_term_template_name) OR term_template_id = x_term_template_id) AND term.term_template_type IN ('NEUTRAL', 'PAYMENT') AND org_id = p_org_id; 7. If the term_template details are not given, then based on the org_id the term template details are fetched send it to the private package for creating variable rent. This validation procedure checks if the abstracted by user exist and valid during the creation of variable rent. SELECT user_id , user_name FROM fnd_user WHERE ( UPPER (user_name) = x_user_name OR user_id = x_user_id) AND TRUNC (SYSDATE) BETWEEN TRUNC (NVL (start_date, SYSDATE)) AND TRUNC (NVL (end_date, SYSDATE)); 8. Validate Currency This procedure checks if the currency code passed to the PUB is valid. SELECT COUNT (1) INTO l_count FROM pn_currencies pn , gl_daily_conversion_types gl WHERE pn.conversion_type = gl.conversion_type AND currency_code = p_currency_code;
9.
Validate Periods This procedure is basically used for validating Calculation frequency, Reporting frequency and Invoicing frequency. Below query is used to validate above fields: SELECT meaning , lookup_code FROM fnd_lookups WHERE lookup_type = p_lookup_type AND ( UPPER (lookup_code) = UPPER (x_lookup_code) OR UPPER (meaning) = UPPER (x_lookup_meaning)) AND enabled_flag = 'Y' AND lookup_code <> 'OT' AND TRUNC (SYSDATE) BETWEEN TRUNC (NVL (start_date_active, SYSDATE)) AND TRUNC (NVL (end_date_active, SYSDATE));
10. Validate Attribute Category Attribute category is validated against the existing descriptive flex field setups. Flex field context value has to be fetched from FND_DESCR_FLEX_COL_USAGE_VL
11. VAL_RENT_DETAILS This Procedure for Fetching Lease id, Location Id and Variable Rent Details
Document Control
Page 24 of 34
Below query is used to for Fetching Lease id, Location Id and Variable Rent Details. SELECT var_rent_id , lease_id , location_id FROM pn_var_rents_all WHERE UPPER (rent_num) = UPPER (p_rent_num);
12. PVT_DEBUG This Procedure for capture custom messages based on the package pn_debug.write.
13. VALIDATE_PERIOD_SET_TYPE Procedure for validate Period set type Below query is used to for validate Period set type. SELECT period_type , period_set_name FROM gl_periods WHERE UPPER (period_set_name) = UPPER (p_gl_period_set_name) AND UPPER (period_type) = UPPER (p_period_type) GROUP BY period_type , period_set_name; 14. BREAKPOINT_EXT Procedure for verifying whether breakpoint are generated or not Below query is used to for verifying whether breakpoints are generated or not. SELECT COUNT (1) FROM pn_var_bkpts_head_all WHERE var_rent_id = p_var_rent_id; 15. CONSTR_EXT Procedure for verifying whether Constraints are generated or not. Below query is used to for verifying whether Constraints are generated or not. SELECT COUNT (1) FROM pn_var_constr_defaults_all WHERE var_rent_id = p_var_rent_id;
Document Control
Page 25 of 34
NOCOPY NUMBER NOCOPY NUMBER NOCOPY NUMBER NOCOPY NUMBER NOCOPY NUMBER NOCOPY VARCHAR2 NOCOPY NUMBER NOCOPY VARCHAR2
<Customize the hook to override the input parameters, do not change the output parameters>. END;
Document Control
Page 26 of 34
Log Output
.........1.........2.........3.........4.........5.........6.........7.........8
Document Control
Page 27 of 34
Object Name PN_LEASES_ALL PN_VAR_RENTS_ALL PN_VAR_RENT_DATES_ALL PN_VAR_LINE_DEFAULTS_ALL PN_VAR_BKHD_DEFAULTS_ALL PN_VAR_BKDT_DEFAULTS_ALL PN_VAR_CONSTR_DEFAULTS_ALL PN_VAR_ABAT_DEFAULTS_ALL PN_VAR_TEMPLATES_ALL PN_SYSTEM_SETUP_OPTIONS PN_TENANCIES_ALL PN_LOCATIONS_ALL PN_PROPERTIES_ALL FND_LOOKUPS PN_TERM_TEMPLATES_ALL FND_USER PN_CURRENCIES GL_DAILY_CONVERSION_TYPES
Object Type
Select X X
Insert
Update
Delete
Table Table Table Table Table Table Table Table Table Table Table Table Table
X X X X X X X
X X X X X X X
X X X X X X X X X X
Document Control
Page 28 of 34
b. Sequence Usage
Used below sequence for generating variable_rent_id. If PN_SYSTEM_OPTION contains generate auto numbering for variable rent as Yes then the same variable_rent_id is used for variable rent number pn_var_rents_s
c. Restart Strategy
Not Applicable
d. Crash Recovery
Not Applicable
e. Database Triggers
Not Applicable
Document Control
Page 29 of 34
9 Seed Data
No Seeded data changes.
Document Control
Page 30 of 34
a. Installation
There are no impacts on a fresh install. This API will be installed as a part of patch release, thus no impact on installation or upgrade.
Document Control
Page 31 of 34
Invoke the Create Variable Rent API with invalid input parameters.
Generate Periods
Invoke GENERATE_PERIODS with variable rent id as input Invoke CREATE_BKPT_CONST_ALLOW_ABA T with valid input parameters
Allow Abatements
The input parameters specified include invalid data. The input parameters specified include invalid data.
Update Breakpoints
Document Control
Page 32 of 34
Component (s)
Step No.
Expected Results which are different from the existing variable rent breakpoint details. Variable Rent Constraints is updated with the input parameters which are different from the existing constraint details. Variable Rent Abatements is updated with the input parameters which are different from the existing constraint details. Undo Periods is initiated. Undo Breakpoint is initiated. Undo Constraints is initiated.
Update Constraints
The input parameters specified should include appropriate parameters and they should be valid. The input parameters specified should include appropriate parameters and they should be valid. Input parameter p_undo_periods is passed as Y Input parameter p_undo_breakpoints is passed as Y Input parameter p_undo_constraints is passed as Y
Update Abatements
6 7 8
Invoke the Update Variable Rent API with input parameters Invoke the Update Variable Rent API with input parameters Invoke the Update Variable Rent API with input parameters
Document Control
Page 33 of 34
a. Closed Issues
Number
Description
Date Raised
Priority
Owner
Resolution
Date Closed
While you should include any and all comments you have, please use the questions and guidelines for each of the applicable sections to assess the solution described in the document.
Document Section
User Comment
Variable Rent could be created even if the Base Lease is in Draft status. There are a few features in Variable Rent which cant be generated until lease is Finalized, like creating sales figures, but Variable Rent definition could be created in Draft status of the base lease. Both the scenarios of updating the present VRA Lines and creating a new VRA Line should be handled in Procedure Update_Vra_Rent. In description of parameter P_VARIABLE_RENT_LINES_TBL, its mentioned: If they are passing new variable rent lines details then API is not going to consider it. Same applies for Breakpoint Header, Break Point Details, Constraints and Allowances & Abatements Information.
Product Management Comment These scenarios are taken care while coding.
3.3.1
6.1.4
Harvinder Rakhra
Document Control
Page 34 of 34
13.1
Variable Rent
Breakpoint Header
Breakpoint Details
Constraints
Document Control
Page 35 of 34
13.2
Document Control
Page 36 of 34
14.1
Parameter
Usage
Type
Require d
Description
p_api_version p_init_msg_list p_commit p_validate_flag p_var_rent_rec p_variable_rent_lines_tbl p_breakpoint_header_tbl p_breakpoint_details_tbl p_constraints_tbl p_allow_abat_tbl p_generate_periods p_generate_breakpoints p_generate_constraints x_return_status x_msg_count x_msg_data x_var_rent_id x_var_rent_num
IN IN IN IN IN IN IN IN IN IN IN IN IN
NUMBER VARCHAR2 VARCHAR2 VARCHAR2 Record Type Table Type Table Type Table Type Table Type Table Type VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 NUMBER VARCHAR2 NUMBER VARCHAR2
API Standard API Standard API Standard Default value is 'N' Similar to section 13.1.1 Similar to section 13.1.2 Similar to section 13.1.3 Similar to section 13.1.4 Similar to section 13.1.5 Similar to section 13.1.6 Default value is 'N' Default value is 'N' Default value is 'N' Return status. Valid values are: S (Success), E (Error), and U (Unexpected error). API Standard API Standard Variable rent Id Variable Rent Number
13.1
Document Control
Page 37 of 34
Parameter
Usage
Type
Require d
Description
p_api_version p_init_msg_list p_commit p_validate_flag p_upd_var_rent_rec p_variable_rent_lines_tbl p_breakpoint_header_tbl p_breakpoint_details_tbl p_constraints_tbl p_allow_abat_tbl p_undo_periods p_ undo _breakpoints p_ undo _constraints x_return_status x_msg_count x_msg_data
IN IN IN IN IN IN IN IN IN IN IN IN IN
NUMBER VARCHAR2 VARCHAR2 VARCHAR2 Record Type Table Type Table Type Table Type Table Type Table Type VARCHAR2 VARCHAR2 VARCHAR2 VARCHAR2 NUMBER VARCHAR2
API Standard API Standard API Standard Default value is 'N' Similar to section 13.2.1 Similar to section 13.1.2 Similar to section 13.1.3 Similar to section 13.1.4 Similar to section 13.1.5 Similar to section 13.1.6 Default value is 'N' Default value is 'N' Default value is 'N' Return status. Valid values are: S (Success), E (Error), and U (Unexpected error). API Standard API Standard
Document Control
Page 38 of 34