[Home] [Help]
PACKAGE BODY: APPS.OCM_GUARANTOR_PUB
Source
1 PACKAGE BODY OCM_GUARANTOR_PUB AS
2 /* $Header: OCMPGTRB.pls 120.5 2006/02/16 17:27:31 bdhotkar noship $ */
3
4 PROCEDURE Create_Guarantor_CreditRequest
5 ( p_api_version IN NUMBER,
6 p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_TRUE,
7 p_commit IN VARCHAR2,
8 p_validation_level IN VARCHAR2,
9 x_return_status OUT NOCOPY VARCHAR2,
10 x_msg_count OUT NOCOPY NUMBER,
11 x_msg_data OUT NOCOPY VARCHAR2,
12 x_guarantor_credit_request_id OUT NOCOPY VARCHAR2,
13 x_guarantor_application_number IN OUT NOCOPY VARCHAR2,
14 p_party_id IN NUMBER,
15 p_contact_party_id IN NUMBER,
16 p_parent_credit_request_id IN NUMBER,
17 p_currency IN VARCHAR2,
18 p_guaranted_amount IN NUMBER,
19 p_funding_available_from IN DATE,
20 p_funding_available_to IN DATE,
21 p_case_folder_id IN NUMBER DEFAULT -99,
22 p_notes IN VARCHAR2,
23 p_credit_classification IN VARCHAR2 DEFAULT 'GUARANTOR',
24 p_review_type IN VARCHAR2 DEFAULT 'GUARANTOR',
25 p_requestor_id IN NUMBER,
26 p_source_org_id IN NUMBER,
27 p_source_user_id IN NUMBER,
28 p_source_resp_id IN NUMBER,
29 p_source_appln_id IN NUMBER,
30 p_source_security_group_id IN NUMBER,
31 p_source_name IN VARCHAR2,
32 p_source_column1 IN VARCHAR2,
33 p_source_column2 IN VARCHAR2,
34 p_source_column3 IN VARCHAR2,
35 p_credit_request_status IN VARCHAR2 DEFAULT 'SUBMIT',
36 p_review_cycle IN VARCHAR2 DEFAULT NULL,
37 p_case_folder_number IN VARCHAR2 DEFAULT NULL,
38 p_score_model_id IN NUMBER DEFAULT NULL,
39 p_asset_class_code IN VARCHAR2 DEFAULT NULL,
40 p_asset_type_code IN VARCHAR2 DEFAULT NULL,
41 p_description IN VARCHAR2 DEFAULT NULL,
42 p_quantity IN NUMBER DEFAULT NULL,
43 p_uom_code IN VARCHAR2 DEFAULT NULL,
44 p_reference_type IN VARCHAR2 DEFAULT NULL,
45 p_appraiser IN VARCHAR2 DEFAULT NULL,
46 p_appraiser_phone IN VARCHAR2 DEFAULT NULL,
47 p_valuation IN NUMBER DEFAULT NULL,
48 p_valuation_method_code IN VARCHAR2 DEFAULT NULL,
49 p_valuation_date IN DATE DEFAULT NULL,
50 p_acquisition_date IN DATE DEFAULT NULL,
51 p_asset_identifier IN VARCHAR2 DEFAULT NULL
52
53 ) IS
54 --Declare Local variables
55
56 BEGIN
57
58 /* We call AR_CMGT_CREDIT_REQUEST_API to create credit request for Guarantor.
59 If the return status is Success then insert the record in the table
60 AR_CMGT_GUARANTOR_DATA
61 */
62
63 SAVEPOINT GUAR_CREDIT_REQ_PVT;
64
65 IF FND_API.to_Boolean( p_init_msg_list )
66 THEN
67 FND_MSG_PUB.initialize;
68 END IF;
69
70 x_return_status := FND_API.G_RET_STS_SUCCESS;
71
72 AR_CMGT_CREDIT_REQUEST_API.create_credit_request
73 (p_api_version => p_api_version,
74 p_init_msg_list => p_init_msg_list,
75 p_commit => p_commit,
76 p_validation_level => p_validation_level,
77 x_return_status => x_return_status,
78 x_msg_count => x_msg_count,
79 x_msg_data => x_msg_data,
80 p_application_number => x_guarantor_application_number,
81 p_application_date => trunc(sysdate),
82 p_requestor_type => 'EMPLOYEE',
83 p_requestor_id => p_requestor_id,
84 p_review_type => p_review_type,
85 p_review_cycle => p_review_cycle,
86 p_credit_classification => p_credit_classification,
87 p_requested_amount => p_guaranted_amount,
88 p_requested_currency => p_currency,
89 p_trx_amount => p_guaranted_amount,
90 p_trx_currency => p_currency,
91 p_credit_type => 'TRADE',
92 p_term_length => NULL,
93 p_credit_check_rule_id => NULL,
94 p_credit_request_status => p_credit_request_status,
95 p_party_id => p_party_id,
96 p_cust_account_id => NULL,
97 p_cust_acct_site_id => NULL,
98 p_site_use_id => NULL,
99 p_contact_party_id => p_contact_party_id,
100 p_notes => p_notes,
101 p_source_org_id => p_source_org_id,
102 p_source_user_id => p_source_user_id,
103 p_source_resp_id => p_source_resp_id,
104 p_source_appln_id => p_source_appln_id,
105 p_source_security_group_id => p_source_security_group_id,
106 p_source_name => p_source_name,
107 p_source_column1 => p_source_column1,
108 p_source_column2 => p_source_column2,
109 p_source_column3 => p_source_column3,
110 p_case_folder_number => p_case_folder_number,
111 p_score_model_id => p_score_model_id,
112 p_credit_request_id => x_guarantor_credit_request_id,
113 p_parent_credit_request_id => p_parent_credit_request_id,
114 p_credit_request_type => 'GUARANTOR'
115 );
116 /* If the credit request is created successfully for the guarantor the insert a
117 record in table AR_CMGT_GUARANTOR_DATA for this request */
118
119 IF x_return_status <> FND_API.G_RET_STS_SUCCESS
120 THEN
121 ROLLBACK TO GUAR_CREDIT_REQ_PVT;
122 return;
123 END IF;
124
125 IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
126
127 INSERT INTO AR_CMGT_GUARANTOR_DATA
128 (
129 datapoint_id ,
130 credit_request_id ,
131 Guarantor_credit_request_id,
132 last_update_date ,
133 last_updated_by ,
134 creation_date ,
135 created_by ,
136 last_update_login ,
137 currency ,
138 guaranteed_amount ,
139 funding_available_from ,
140 funding_available_to ,
141 notes ,
142 case_folder_id ,
143 asset_class_code ,
144 asset_type_code ,
145 description ,
146 quantity ,
147 uom_code ,
148 reference_type ,
149 appraiser ,
150 appraiser_phone ,
151 valuation ,
152 valuation_method_code ,
153 valuation_date ,
154 acquisition_date ,
155 asset_identifier ,
156 party_id,
157 contact_party_id
158 )
159 VALUES
160 (
161 AR_CMGT_GUARANTOR_DATA_S.nextval,
162 p_parent_credit_request_id,
163 x_guarantor_credit_request_id,
164 sysdate,
165 fnd_global.user_id,
166 sysdate,
167 fnd_global.user_id,
168 fnd_global.login_id,
169 p_currency,
170 p_guaranted_amount,
171 p_funding_available_from,
172 p_funding_available_to,
173 p_notes,
174 p_case_folder_id,
175 p_asset_class_code,
176 p_asset_type_code ,
177 p_description ,
178 p_quantity,
179 p_uom_code,
180 p_reference_type,
181 p_appraiser ,
182 p_appraiser_phone,
183 p_valuation ,
184 p_valuation_method_code,
185 p_valuation_date ,
186 p_acquisition_date,
187 p_asset_identifier,
188 p_party_id,
189 p_contact_party_id
190 );
191 END IF;
192
193 EXCEPTION
194 WHEN OTHERS THEN
195 ROLLBACK TO GUAR_CREDIT_REQ_PVT;
196 x_return_status := FND_API.G_RET_STS_ERROR;
197 x_msg_data := sqlerrm;
198 END Create_Guarantor_CreditRequest;
199 END OCM_GUARANTOR_PUB;