1 PACKAGE LNS_LOAN_PUB AUTHID CURRENT_USER as
2 /* $Header: LNS_LOAN_PUBP_S.pls 120.1.12000000.3 2007/05/09 11:23:03 mbolli ship $ */
3 /*#
4 * Start of Comments
5 * Package name : LNS_LOAN_PUB
6 * Purpose Creates a new loan
7 * History :
8 */
9 -- * @rep:scope public
10 -- * @rep:product LNS
11 -- * @rep:displayname Create Loan
12 -- * @rep:lifecycle active
13 -- * @rep:compatibility S
14 -- * @rep:category BUSINESS_ENTITY LOAN
15
16 /*=======================================================================+
17 | Declare PUBLIC Data Types and Variables
18 +=======================================================================*/
19 /*
20 In the Comments below FK stands for Foreign Key. This type is passed as a
21 parameter to Create_loan API.
22 */
23 TYPE Loan_Details_Rec_Type IS RECORD (
24 product_id NUMBER(15) --lns_loan_products.product_id
25 ,loan_number VARCHAR2(60) -- Free Form Text only used if profile
26 -- LNS_GENERATE_LOAN_NUMBER is not set
27 ,loan_description VARCHAR2(250) -- Free Form Text
28 ,loan_assigned_to NUMBER(15) -- FK to jtf_rs_resource_extns.resource_id
29 ,legal_entity_id NUMBER(15) -- FK to xle_entity_profiles.legal_entity_id
30 ,primary_borrower_party_id NUMBER(15) -- FK to hz_parties.party_id
31 -- Note: Status should be 'A'.
32 ,cust_account_id NUMBER(15) -- FK to hz_cust_accounts_all.cust_account_id
33 -- Note: Status should be 'A'.
34 ,bill_to_acct_site_id NUMBER(15) -- FK to hz_cust_acct_sites_all.
35 -- cust_acct_site_id
36 ,contact_rel_party_id NUMBER(15) -- FK to hz_relationships.party_id
37 ,requested_amount NUMBER -- Number
38 ,loan_purpose_code VARCHAR2(30) -- FK to lns_lookups.lookup_code
39 -- lookup_type = 'LOAN_PURPOSE'
40 ,credit_review_flag VARCHAR2(1) -- 'Y' or 'N' or null
41 ,exchange_rate_type VARCHAR2(30) -- FK to gl_daily_conversion_types.
42 -- conversion_type
43 ,exchange_rate NUMBER -- number
44 ,exchange_date DATE -- Date
45 ,loan_application_date DATE -- Date
46 ,loan_start_date DATE -- Date
47 ,open_loan_start_date DATE -- Date
48 ,open_to_term_event VARCHAR2(30) -- FK to lns_lookups.lookup_code
49 -- lookup_type = 'OPEN_TO_TERM_EVENT'
50 ,trx_type_id NUMBER(15) -- FK to ar_lookups.lookup_code
51 -- lookup_type = 'INV/CM'
52 ,loan_term NUMBER -- Number
53 ,loan_term_period VARCHAR2(30) -- FK to lns_lookups.lookup_code
54 -- lookup_type = 'PERIOD'
55 ,open_loan_term NUMBER -- Number
56 ,open_loan_term_period VARCHAR2(30) -- FK to lns_lookups.lookup_code
57 -- lookup_type = 'PERIOD'
58 ,balloon_payment_type VARCHAR2(30) -- FK to lns_lookups.lookup_code
59 -- lookup_type = 'BALLOON_PAYMENT_TYPE'
60 ,balloon_payment_amount NUMBER -- Number
61 ,balloon_term NUMBER -- Number
62 ,loan_subtype VARCHAR2(30) -- FK to lns_lookups.lookup_code
63 -- lookup_type = 'LOAN_SUBTYPE'
64 ,collateral_percent NUMBER -- Number
65 ,index_rate_id NUMBER -- FK to lns_int_rate_headers.interest_rate_id
66 ,loan_payment_frequency VARCHAR2(30) -- FK to lns_lookups.lookup_code
67 -- lookup_type = 'FREQUENCY'
68 ,term_index_date DATE
69 ,open_index_date DATE
70 ,term_index_rate NUMBER
71 ,term_spread NUMBER
72 ,open_index_rate NUMBER
73 ,open_spread NUMBER
74 );
75
76 TYPE Loan_Lines_Rec_Type IS RECORD (
77 line_number NUMBER(15) -- Any unique serial number
78 ,payment_schedule_id NUMBER(15) -- FK to ar_payment_schedules_all.
79 -- payment_schedule_id.
80 ,requested_amount NUMBER -- Number
81 ,description VARCHAR2(250) -- Free form Text.
82 );
83
84 TYPE Loan_Lines_List_Type IS TABLE OF Loan_Lines_Rec_Type INDEX BY BINARY_INTEGER;
85 TYPE Loan_create_errors_type IS TABLE OF LNS_LOAN_CREATE_ERRORS_GT%ROWTYPE;
86
87
88 /*#
89 * Creates a loan
90 * @param p_api_version API Version Number
91 * @param p_commit Commit flag
92 * @param P_Loan_Details_Rec Loan Details required to create a loan
93 * @param P_Application_id Application Id for the source application
94 * @param P_Created_by_module User Module Identification
95 * @param X_loan_id Loan Id if the loan creates successfully
96 * @param X_return_status API return status
97 * @param X_msg_count Number of error messages
98 */
99 -- * @rep:scope internal
100 -- * @rep:displayname Create Loans
101 -- * @rep:lifecycle active
102 -- * @rep:compatibility S
103
104 /*========================================================================
105 | PUBLIC PROCEDURE CREATE_LOAN
106 |
107 | DESCRIPTION
108 | This process Creates a Loan and creates corresponding records in
109 | LNS_TERMS, LNS_RATE_SCHEDULES, LNS_PARTICIPANTS and LNS_LOAN_LINES
110 |
111 | PSEUDO CODE/LOGIC
112 |
113 | PARAMETERS
114 | P_API_VERSION - API Version
115 | P_COMMIT - Passing 'Y' will result in an explicit commit
116 | being issued in the API.
117 | P_Loan_Details_Rec - Please see documentation elsewhere for
118 | Loan_Details_Rec_Type.
119 | P_Loan_Lines_Rec - Please see documentation elsewhere for
120 | Loan_Lines_List_Type. Needs to be populated only
121 | for extended payment plan loans.
122 | P_Application_id - Application_id for the source application.
123 | P_Created_by_module- Free form text not validated.
124 | X_Loan_id - Loan_id of the created loan will be returned if
125 | successful.
126 | X_RETURN_STATUS - Returns 'S' for success and 'F' for Failure.
127 | X_MSG_COUNT - Returns number of Errors.The errors are inserted
128 | in the Global temporary table
129 | LNS_LOAN_CREATE_ERRORS_GT.
130 | KNOWN ISSUES
131 | None
132 |
133 | NOTES
134 |
135 | MODIFICATION HISTORY
136 | Date Author Description of Changes
137 | 17-Jan-2006 GBELLARY Created
138 |
139 *=======================================================================*/
140 PROCEDURE CREATE_LOAN(
141 P_API_VERSION IN NUMBER,
142 P_COMMIT IN VARCHAR2,
143 P_Loan_Details_Rec IN LNS_LOAN_PUB.Loan_Details_Rec_Type,
144 P_Loan_Lines_Rec IN LNS_LOAN_PUB.Loan_Lines_List_Type,
145 P_Application_id IN NUMBER,
146 P_Created_by_module IN VARCHAR2,
150 END LNS_LOAN_PUB;
147 X_loan_id OUT NOCOPY NUMBER,
148 X_RETURN_STATUS OUT NOCOPY VARCHAR2,
149 X_MSG_COUNT OUT NOCOPY NUMBER);