[Home] [Help]
PACKAGE BODY: APPS.ASO_CFG_INT
Source
1 PACKAGE BODY aso_cfg_int as
2 /* $Header: asoicfgb.pls 120.7 2005/11/04 11:54:48 skulkarn ship $ */
3 -- Start of Comments
4 -- Package name : aso_cfg_int
5 -- Purpose :
6 -- History :
7 -- NOTE : 8/21/04 skulkarn: added the MACD changes into the get_config_details API
8 -- 9/16/04 bmishra: Made changes in pricing_callback and query_qte_line_rows. Fix for bug#3850782
9 -- 9/17/04 skulkarn: fixed bug 3883545
10 -- 11/23/04 skulkarn: fixed bug 3998564
11 -- 12/06/04 skulkarn: fixed bug3938943
12 -- End of Comments
13 --private variable declaration
14
15 G_PKG_NAME CONSTANT VARCHAR2(30):= 'ASO_CFG_INT';
16 G_FILE_NAME CONSTANT VARCHAR2(12) := 'asoicfgb.pls';
17
18 Procedure Populate_output_table(
19 p_oe_line_tbl IN OE_ORDER_PUB.line_tbl_type ,
20 x_qte_line_tbl OUT NOCOPY /* file.sql.39 change */ ASO_QUOTE_PUB.qte_line_tbl_type,
21 x_qte_line_dtl_tbl OUT NOCOPY /* file.sql.39 change */ ASO_QUOTE_PUB.qte_line_dtl_tbl_type,
22 x_shipment_tbl OUT NOCOPY /* file.sql.39 change */ ASO_QUOTE_PUB.shipment_tbl_type) AS
23 Begin
24 If p_oe_line_tbl.count <= 0 Then
25 Return;
26 End If;
27
28 For i In p_oe_line_tbl.FIRST .. p_oe_line_tbl.LAST Loop
29
30 x_qte_line_tbl(i).inventory_item_id :=
31 p_oe_line_tbl(i).inventory_item_id ;
32
33 x_qte_line_dtl_tbl(i).component_code :=
34 p_oe_line_tbl(i).component_code ;
35 x_qte_line_dtl_tbl(i).config_header_id :=
36 p_oe_line_tbl(i).config_header_id ;
37 x_qte_line_dtl_tbl(i).config_revision_num :=
38 p_oe_line_tbl(i).config_rev_nbr ;
39 x_shipment_tbl(i).shipment_id :=
40 p_oe_line_tbl(i).source_document_line_id ;
41
42 End Loop ;
43 End Populate_output_table;
44
45 PROCEDURE Get_configuration_lines(
46 P_Api_Version_Number IN NUMBER,
47 P_Init_Msg_List IN VARCHAR2 := FND_API.G_FALSE,
48 p_top_model_line_id IN NUMBER,
49 x_qte_line_tbl OUT NOCOPY /* file.sql.39 change */ ASO_QUOTE_PUB.qte_line_tbl_type,
50 x_qte_line_dtl_tbl OUT NOCOPY /* file.sql.39 change */ ASO_QUOTE_PUB.qte_line_dtl_tbl_type,
51 x_shipment_tbl OUT NOCOPY /* file.sql.39 change */ ASO_QUOTE_PUB.shipment_tbl_type ,
52 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
53 x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
54 x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
55 AS
56 l_oe_line_tbl OE_ORDER_PUB.Line_Tbl_Type ;
57 l_api_name VARCHAR2(30) := 'Get_Configuration_Lines' ;
58 l_api_version_number Number := 1.0 ;
59 BEGIN
60 -- Standard Start of API savepoint
61 SAVEPOINT GET_CONFIGURATION_LINES_PUB;
62
63 OE_ORDER_GRP.Get_Option_Lines(
64 p_api_version_number => l_api_version_number ,
65 p_init_msg_list => FND_API.G_FALSE ,
66 p_top_model_line_id => p_top_model_line_id ,
67 x_line_tbl => l_oe_line_tbl ,
68 x_return_status => x_return_status ,
69 x_msg_count => x_msg_count ,
70 x_msg_data => x_msg_data ) ;
71
72 If x_return_status <> FND_API.G_RET_STS_SUCCESS Then
73 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
74 End if;
75
76 Populate_output_table(p_oe_line_tbl => l_oe_line_tbl ,
77 x_qte_line_tbl => x_qte_line_tbl,
78 x_qte_line_dtl_tbl => x_qte_line_dtl_tbl ,
79 x_shipment_tbl => x_shipment_tbl );
80
81 EXCEPTION
82 WHEN FND_API.G_EXC_ERROR THEN
83 ASO_UTILITY_PVT.HANDLE_EXCEPTIONS(
84 P_API_NAME => L_API_NAME
85 ,P_PKG_NAME => G_PKG_NAME
86 ,P_EXCEPTION_LEVEL => FND_MSG_PUB.G_MSG_LVL_ERROR
87 ,P_PACKAGE_TYPE => ASO_UTILITY_PVT.G_PUB
88 ,X_MSG_COUNT => X_MSG_COUNT
89 ,X_MSG_DATA => X_MSG_DATA
90 ,X_RETURN_STATUS => X_RETURN_STATUS);
91
92 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
93 ASO_UTILITY_PVT.HANDLE_EXCEPTIONS(
94 P_API_NAME => L_API_NAME
95 ,P_PKG_NAME => G_PKG_NAME
96 ,P_EXCEPTION_LEVEL => FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR
97 ,P_PACKAGE_TYPE => ASO_UTILITY_PVT.G_PUB
98 ,X_MSG_COUNT => X_MSG_COUNT
99 ,X_MSG_DATA => X_MSG_DATA
100 ,X_RETURN_STATUS => X_RETURN_STATUS);
101
102 WHEN OTHERS THEN
103 ASO_UTILITY_PVT.HANDLE_EXCEPTIONS(
104 P_API_NAME => L_API_NAME
105 ,P_PKG_NAME => G_PKG_NAME
106 ,P_EXCEPTION_LEVEL => ASO_UTILITY_PVT.G_EXC_OTHERS
107 ,P_PACKAGE_TYPE => ASO_UTILITY_PVT.G_PUB
108 ,X_MSG_COUNT => X_MSG_COUNT
109 ,X_MSG_DATA => X_MSG_DATA
110 ,X_RETURN_STATUS => X_RETURN_STATUS);
111
112
113 END Get_Configuration_Lines;
114
115 PROCEDURE Delete_configuration(
116 P_Api_version_NUmber IN NUMBER,
117 P_Init_msg_List IN VARCHAR2 := FND_API.G_FALSE,
118 P_config_hdr_id IN NUMBER,
119 p_config_rev_nbr IN NUMBER,
120 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
121 x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
122 x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2)
123 IS
124 l_usage_exists NUMBER;
125 l_Error_message VARCHAR2(2000);
126 l_Return_value NUMBER;
127 BEGIN
128
129 x_return_status := FND_API.G_RET_STS_SUCCESS;
130
131 cz_cf_api.delete_configuration(P_config_hdr_id,
132 p_config_rev_nbr,
133 l_usage_exists ,
134 l_Error_message ,
135 l_Return_value );
136
137 IF l_Return_value = 0 Then
138 x_return_status := FND_API.G_RET_STS_ERROR;
139 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
140 FND_MESSAGE.Set_Name('ASO', 'ASO_CZ_DELETE_ERR');
141 FND_MESSAGE.Set_token('MSG_TXT' , l_error_message,FALSE);
142 FND_MSG_PUB.ADD;
143 END IF;
144 END IF;
145
146 END Delete_configuration;
147
148
149 PROCEDURE Delete_configuration_auto(
150 P_Api_version_NUmber IN NUMBER,
151 P_Init_msg_List IN VARCHAR2 := FND_API.G_FALSE,
152 P_config_hdr_id IN NUMBER,
153 p_config_rev_nbr IN NUMBER,
154 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
155 x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
156 x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2)
157 IS
158
159 PRAGMA AUTONOMOUS_TRANSACTION;
160
161 BEGIN
162 x_return_status := FND_API.G_RET_STS_SUCCESS;
163
164 DELETE_CONFIGURATION(
165 P_API_VERSION_NUMBER => 1.0,
166 P_INIT_MSG_LIST => FND_API.G_FALSE,
167 P_CONFIG_HDR_ID => P_config_hdr_id,
168 P_CONFIG_REV_NBR => p_config_rev_nbr,
169 X_RETURN_STATUS => x_return_status,
170 X_MSG_COUNT => x_msg_count,
171 X_MSG_DATA => x_msg_data);
172
173 IF x_return_status = FND_API.G_RET_STS_SUCCESS Then
174 commit;
175 ELSE
176 rollback;
177 END IF;
178
179 END Delete_configuration_auto;
180
181 Procedure Copy_Configuration( p_api_version_number IN NUMBER,
182 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
183 p_commit IN VARCHAR2 := FND_API.G_FALSE,
184 p_config_header_id IN NUMBER,
185 p_config_revision_num IN NUMBER,
186 p_copy_mode IN VARCHAR2,
187 p_handle_deleted_flag IN VARCHAR2 := NULL,
188 p_new_name IN VARCHAR2 := NULL,
189 p_autonomous_flag IN VARCHAR2 := FND_API.G_FALSE,
190 x_config_header_id OUT NOCOPY /* file.sql.39 change */ NUMBER,
191 x_config_revision_num OUT NOCOPY /* file.sql.39 change */ NUMBER,
192 x_orig_item_id_tbl OUT NOCOPY CZ_API_PUB.number_tbl_type,
193 x_new_item_id_tbl OUT NOCOPY CZ_API_PUB.number_tbl_type,
194 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
195 x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
196 x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
197 )
198 IS
199
200 l_api_name CONSTANT VARCHAR2(30) := 'COPY_CONFIGURATION';
201 l_api_version_number CONSTANT NUMBER := 1.0;
202 l_config_rev_nbr NUMBER;
203
204
205
206 cursor c_config_rev_nbr is
207 select config_rev_nbr
208 from cz_config_details_v
209 where config_hdr_id = p_config_header_id
210 and config_rev_nbr = p_config_revision_num;
211
212
213 cursor c_config_max_rev_nbr is select max(config_rev_nbr)
214 from cz_config_details_v
215 where config_hdr_id = p_config_header_id;
216
217
218 BEGIN
219 SAVEPOINT COPY_CONFIGURATION_INT;
220
221 IF aso_debug_pub.g_debug_flag = 'Y' THEN
222 aso_debug_pub.add('ASO_CFG_INT: Begin Copy_Configuration');
223 END IF;
224
225 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
226 p_api_version_number,
227 l_api_name,
228 G_PKG_NAME) THEN
229
230 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
231
232
233 END IF;
234
235 IF aso_debug_pub.g_debug_flag = 'Y' THEN
236 aso_debug_pub.add('copy_configuration: p_init_msg_list: '|| p_init_msg_list);
237 END IF;
238
239 IF FND_API.to_Boolean( p_init_msg_list ) THEN
240 FND_MSG_PUB.initialize;
241 END IF;
242
243 x_return_status := FND_API.G_RET_STS_SUCCESS;
244
245 IF aso_debug_pub.g_debug_flag = 'Y' THEN
246
247 aso_debug_pub.add('copy_configuration: p_config_header_id: '|| p_config_header_id);
248 aso_debug_pub.add('copy_configuration: p_config_revision_num: '|| p_config_revision_num);
249 aso_debug_pub.add('copy_configuration: p_copy_mode: '|| p_copy_mode);
250 aso_debug_pub.add('copy_configuration: p_autonomous_flag: '|| p_autonomous_flag);
251
252 END IF;
253
254
255 open c_config_rev_nbr;
256 fetch c_config_rev_nbr into l_config_rev_nbr;
257
258 IF aso_debug_pub.g_debug_flag = 'Y' THEN
259 aso_debug_pub.add('After cursor c_config_rev_nbr l_config_rev_nbr: '||l_config_rev_nbr);
260 END IF;
261
262 IF c_config_rev_nbr%NOTFOUND THEN
263
264 open c_config_max_rev_nbr;
265 fetch c_config_max_rev_nbr into l_config_rev_nbr;
266
267 IF aso_debug_pub.g_debug_flag = 'Y' THEN
268 aso_debug_pub.add('After cursor c_config_max_rev_nbr l_config_rev_nbr: '||l_config_rev_nbr);
269 END IF;
270
271 close c_config_max_rev_nbr;
272
273 END IF;
274 close c_config_rev_nbr;
275
276 IF aso_debug_pub.g_debug_flag = 'Y' THEN
277 aso_debug_pub.add('Before call to cz_config_api_pub.copy_configuration');
278 END IF;
279
280 IF p_autonomous_flag = fnd_api.g_true THEN
281
282 cz_config_api_pub.copy_configuration_auto( p_api_version => 1.0,
283 p_config_hdr_id => p_config_header_id,
284 p_config_rev_nbr => l_config_rev_nbr,
285 p_copy_mode => p_copy_mode,
286 p_handle_deleted_flag => p_handle_deleted_flag,
287 p_new_name => p_new_name,
288 x_config_hdr_id => x_config_header_id,
289 x_config_rev_nbr => x_config_revision_num,
290 x_orig_item_id_tbl => x_orig_item_id_tbl,
291 x_new_item_id_tbl => x_new_item_id_tbl,
292 x_return_status => x_return_status,
293 x_msg_count => x_msg_count,
294 x_msg_data => x_msg_data
295 );
296
297 IF aso_debug_pub.g_debug_flag = 'Y' THEN
298 aso_debug_pub.add('After call to cz_config_api_pub.copy_configuration_auto');
299 aso_debug_pub.add('copy_configuration: x_return_status: '|| x_return_status);
300 END IF;
301
302 ELSE
303
304 cz_config_api_pub.copy_configuration( p_api_version => 1.0,
305 p_config_hdr_id => p_config_header_id,
306 p_config_rev_nbr => l_config_rev_nbr,
307 p_copy_mode => p_copy_mode,
308 p_handle_deleted_flag => p_handle_deleted_flag,
309 p_new_name => p_new_name,
310 x_config_hdr_id => x_config_header_id,
311 x_config_rev_nbr => x_config_revision_num,
312 x_orig_item_id_tbl => x_orig_item_id_tbl,
313 x_new_item_id_tbl => x_new_item_id_tbl,
314 x_return_status => x_return_status,
315 x_msg_count => x_msg_count,
316 x_msg_data => x_msg_data
317 );
318
319 IF aso_debug_pub.g_debug_flag = 'Y' THEN
320 aso_debug_pub.add('After call to cz_config_api_pub.copy_configuration');
321 aso_debug_pub.add('copy_configuration: x_return_status: '|| x_return_status);
322 END IF;
323
324 END IF;
325
326 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
327
328
329 RAISE FND_API.G_EXC_ERROR;
330
331 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
332
333 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
334
335 END IF;
336
337 IF FND_API.to_Boolean( p_commit ) THEN
338 COMMIT WORK;
339 END IF;
340
341
342 FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
343 p_data => x_msg_data );
344
345
346 EXCEPTION
347
348 WHEN FND_API.G_EXC_ERROR THEN
349
350 ASO_UTILITY_PVT.HANDLE_EXCEPTIONS( P_API_NAME => L_API_NAME,
351 P_PKG_NAME => G_PKG_NAME,
355 X_MSG_DATA => X_MSG_DATA,
352 P_EXCEPTION_LEVEL => FND_MSG_PUB.G_MSG_LVL_ERROR,
353 P_PACKAGE_TYPE => ASO_UTILITY_PVT.G_INT,
354 X_MSG_COUNT => X_MSG_COUNT,
356 X_RETURN_STATUS => X_RETURN_STATUS);
357
358 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
359
360 ASO_UTILITY_PVT.HANDLE_EXCEPTIONS( P_API_NAME => L_API_NAME,
361 P_PKG_NAME => G_PKG_NAME,
362 P_EXCEPTION_LEVEL => FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR,
363 P_PACKAGE_TYPE => ASO_UTILITY_PVT.G_INT,
364 X_MSG_COUNT => X_MSG_COUNT,
365 X_MSG_DATA => X_MSG_DATA,
366 X_RETURN_STATUS => X_RETURN_STATUS);
367
368
369 WHEN OTHERS THEN
370
371 IF aso_debug_pub.g_debug_flag = 'Y' THEN
372 aso_debug_pub.add('ASO_CFG_INT: copy_configuration: Inside when others exception');
373 END IF;
374
375 ASO_UTILITY_PVT.HANDLE_EXCEPTIONS( P_API_NAME => L_API_NAME,
376 P_PKG_NAME => G_PKG_NAME,
377 P_SQLERRM => SQLERRM,
378 P_SQLCODE => SQLCODE,
379 P_EXCEPTION_LEVEL => ASO_UTILITY_PVT.G_EXC_OTHERS,
380 P_PACKAGE_TYPE => ASO_UTILITY_PVT.G_INT,
381 X_MSG_COUNT => X_MSG_COUNT,
382 X_MSG_DATA => X_MSG_DATA,
383 X_RETURN_STATUS => X_RETURN_STATUS);
384
385
386 END Copy_Configuration;
387
388
389
390 PROCEDURE Update_revision_num(
391 p_quote_header_id IN NUMBER ,
392 p_config_hdr_id IN NUMBER ,
393 p_config_rev_nbr IN NUMBER ,
394 p_to_config_hdr_id IN NUMBER ,
395 p_to_config_rev_nbr IN NUMBER ,
396 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
397 x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER ,
398 x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2 ) IS
399 Cursor c_update_revision IS
400 SELECT quote_line_id,
401 quote_line_Detail_id
402 From aso_quote_line_details
403 Where config_header_id = p_config_hdr_id
404 AND config_revision_num = p_config_rev_nbr ;
405
406 l_Api_Version_Number NUMBER := 1.0 ;
407 l_Qte_Line_Rec ASO_QUOTE_PUB.Qte_Line_Rec_Type ;
408 l_miss_line_rec ASO_QUOTE_PUB.Qte_Line_Rec_Type ;
409 l_Qte_Line_Dtl_Tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type ;
410 l_miss_Line_Dtl_Tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type ;
411 X_Qte_Line_Rec ASO_QUOTE_PUB.Qte_Line_Rec_Type ;
412 X_Qte_Line_Dtl_Tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type ;
413 X_payment_tbl ASO_QUOTE_PUB.Payment_tbl_type ;
414 X_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type ;
415 X_tax_detail_tbl ASO_QUOTE_PUB.Tax_Detail_Tbl_Type;
416 X_freight_charge_tbl ASO_QUOTE_PUB.Freight_Charge_Tbl_Type;
417 X_price_attributes_tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
418 X_price_adj_attr_tbl ASO_QUOTE_PUB.Price_Adj_Attr_Tbl_Type;
419 X_line_attribs_ext_tbl ASO_QUOTE_PUB.Line_Attribs_Ext_Tbl_type;
420 X_price_adj_tbl ASO_QUOTE_PUB.Price_adj_tbl_type ;
421 X_Sales_Credit_Tbl ASO_QUOTE_PUB.Sales_Credit_Tbl_Type ;
422 X_Quote_Party_Tbl ASO_QUOTE_PUB.Quote_Party_Tbl_Type ;
423 Begin
424
425 For i_update_revision IN c_update_revision Loop
426 l_qte_line_rec := l_miss_line_rec ;
427 l_qte_line_dtl_tbl := l_miss_line_dtl_tbl ;
428
429 l_qte_line_rec.quote_line_id := i_update_revision.quote_line_id ;
430 l_qte_line_rec.quote_header_id := p_quote_header_id ;
431 l_qte_line_dtl_tbl(1).operation_code := 'UPDATE';
432 l_qte_line_dtl_tbl(1).quote_line_id := i_update_revision.quote_line_id;
433 l_qte_line_dtl_tbl(1).quote_line_detail_id :=
434 i_update_revision.quote_line_detail_id;
435 l_qte_line_dtl_tbl(1).config_revision_num := p_to_config_rev_nbr ;
436
437 ASO_QUOTE_LINES_PVT.Update_Quote_Line(
438 P_Api_Version_Number => l_api_version_number ,
439 P_Init_Msg_List => FND_API.G_FALSE,
440 P_Commit => FND_API.G_FALSE,
441 P_Validation_Level => FND_API.G_VALID_LEVEL_NONE ,
442 P_Qte_Line_Rec => l_qte_line_REC,
443 P_Qte_Line_Dtl_Tbl => l_qte_line_dtl_TBL,
444 P_Update_Header_Flag => FND_API.G_FALSE ,
445 X_Qte_Line_Rec => x_Qte_Line_Rec,
446 X_payment_tbl => x_payment_tbl,
447 X_price_adj_tbl => x_price_adj_tbl ,
448 X_Qte_Line_Dtl_Tbl => x_Qte_Line_Dtl_Tbl ,
449 X_shipment_tbl => x_shipment_tbl ,
450 X_tax_detail_tbl => x_tax_detail_tbl ,
454 X_line_attribs_ext_tbl => x_line_attribs_ext_tbl ,
451 X_freight_charge_tbl => x_freight_charge_tbl ,
452 X_price_attributes_tbl => x_price_attributes_tbl ,
453 X_price_adj_attr_tbl => x_price_adj_attr_tbl ,
455 X_Sales_Credit_Tbl => x_sales_credit_tbl ,
456 X_Quote_Party_Tbl => x_quote_party_tbl ,
457 X_Return_Status => x_return_status ,
458 X_Msg_Count => x_msg_count,
459 X_Msg_Data => x_msg_data );
460
461 --check for success
462 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
463 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
464 END IF;
465 End Loop;
466
467 End Update_Revision_Num ;
468
469 PROCEDURE Create_Relationship(parent_quote_line_id IN NUMBER ,
470 p_config_item_id IN NUMBER ,
471 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
472 x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
473 x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2 ) IS
474
475 l_LINE_RLTSHIP_Rec ASO_quote_PUB.LINE_RLTSHIP_Rec_Type :=
476 ASO_QUOTE_PUB.G_MISS_LINE_RLTSHIP_REC ;
477 l_api_name Constant Varchar2(30) := 'Create_Relationship' ;
478 l_api_version_number NUMBER := 1.0 ;
479 l_line_relationship_id NUMBER ;
480 l_dummy_line_id NUMBER;
481 l_return_status varchar2(1);
482
483 CURSOR c_rel_exist( p_quote_line_id NUMBER ) is
484 select related_quote_line_id
485 from aso_line_relationships
486 where related_quote_line_id = p_quote_line_id;
487
488
489 BEGIN
490 l_return_status := FND_API.G_RET_STS_SUCCESS;
491 If G_rtln_tbl.First IS NULL Then
492 return;
493 end if;
494
495 FOR i IN G_rtln_tbl.FIRST .. G_rtln_tbl.LAST LOOP
496 If G_rtln_tbl(i).parent_config_item_id = p_config_item_id
497 AND G_rtln_tbl(i).included_flag = 'N'
498 AND G_rtln_tbl(i).parent_config_item_id IS NOT NULL Then
499
500 l_line_rltship_rec := aso_quote_pub.G_MISS_Line_rltship_rec ;
501
502 --populate line relationship record
503 l_line_rltship_rec.OPERATION_CODE := 'CREATE' ;
504 l_line_rltship_rec.QUOTE_LINE_ID := parent_quote_line_id ;
505 l_line_rltship_rec.RELATED_QUOTE_LINE_ID := G_rtln_tbl(i).quote_line_id ;
506 l_line_rltship_rec.RELATIONSHIP_TYPE_CODE := 'CONFIG' ;
507
508
509 If G_rtln_tbl(i).created_flag = 'N' Then
510 ASO_LINE_RLTSHIP_PVT.Create_line_rltship(
511 P_Api_Version_Number => l_api_version_number ,
512 P_Init_Msg_List => FND_API.G_FALSE,
513 P_Commit => FND_API.G_FALSE,
514 p_validation_level => FND_API.G_VALID_LEVEL_FULL,
515 P_LINE_RLTSHIP_Rec => l_line_rltship_rec ,
516 X_LINE_RELATIONSHIP_ID => l_line_relationship_id ,
517 X_Return_Status => x_return_status ,
518 X_Msg_Count => x_msg_count,
519 X_Msg_Data => x_msg_data );
520
521 l_return_status := x_return_status;
522
523 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
524 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
525 END IF;
526 End If;
527
528 G_rtln_tbl(i).included_flag := 'Y';
529
530 Create_relationship(parent_quote_line_id => G_rtln_tbl(i).quote_line_id ,
531 p_config_item_id => G_rtln_tbl(i).config_item_id,
532 x_return_status => x_return_status ,
533 x_msg_count => x_msg_count ,
534 x_msg_data => x_msg_data ) ;
535 End If;
536 END LOOP;
537
538 x_return_status := l_return_status;
539 END create_relationship ;
540
541
542 Procedure Populate_Rtln_Tbl(p_quote_header_id IN NUMBER ,
543 p_quote_line_id IN NUMBER ,
544 p_config_hdr_id IN NUMBER ,
545 p_config_rev_nbr IN NUMBER ) IS
546
547 CURSOR c_options ( l_config_hdr_id NUMBER ,
548 l_config_rev_nbr NUMBER ) IS
549 SELECT qte_dtl.quote_line_id ,
550 cfg_dtl.parent_config_item_id ,
551 cfg_dtl.config_item_id ,
552 cfg_dtl.inventory_item_id ,
553 cfg_dtl.organization_id ,
554 cfg_dtl.component_code ,
555 cfg_dtl.quantity
556 FROM cz_config_details_v cfg_dtl ,
557 aso_quote_line_details qte_dtl
558 WHERE cfg_dtl.config_hdr_id = l_config_hdr_id
559 AND cfg_dtl.config_rev_nbr = l_config_rev_nbr
560 AND cfg_dtl.config_hdr_id = qte_dtl.config_header_id
561 AND cfg_dtl.config_rev_nbr = qte_dtl.config_revision_num
562 AND qte_dtl.config_item_id = cfg_dtl.config_item_id ;
563
564
565 CURSOR c_model ( l_model_line_id NUMBER ,
566 l_config_hdr_id NUMBER ,
567 l_config_rev_nbr NUMBER ) IS
568 SELECT qte_dtl.quote_line_id ,
569 cfg_dtl.parent_config_item_id ,
570 cfg_dtl.config_item_id ,
571 cfg_dtl.inventory_item_id ,
572 cfg_dtl.organization_id ,
573 cfg_dtl.component_code ,
574 cfg_dtl.quantity
578 AND cfg_dtl.config_hdr_id = l_config_hdr_id
575 FROM cz_config_details_v cfg_dtl ,
576 aso_quote_line_details qte_dtl
577 WHERE qte_dtl.quote_line_id = l_model_line_id
579 AND cfg_dtl.config_rev_nbr = l_config_rev_nbr
580 AND cfg_dtl.config_hdr_id = qte_dtl.config_header_id
581 AND cfg_dtl.config_rev_nbr = qte_dtl.config_revision_num
582 AND qte_dtl.config_item_id = cfg_dtl.config_item_id;
583
584 l_rec_options c_options%ROWTYPE;
585 l_rec_model c_model%ROWTYPE;
586 l_index BINARY_INTEGER;
587 l_dummy_line_id NUMBER;
588
589 BEGIN
590 IF G_rtln_tbl.EXISTS(1) Then
591
592 -- This is the first time Model is configured, hence all the options
593 -- are in G_RTLN_TBL. No need to populate.
594 RETURN ;
595 END IF;
596
597 FOR l_rec_model IN c_model (p_quote_line_id,p_config_hdr_id,p_config_rev_nbr)
598 LOOP
599 -- Assumption is configured items will have only one detail per quote line
600 G_rtln_tbl(1).quote_line_id := l_rec_model.quote_line_id;
601 G_rtln_tbl(1).parent_config_item_id := NULL;
602 G_rtln_tbl(1).config_item_id := l_rec_model.config_item_id;
603 G_rtln_tbl(1).inventory_item_id := l_rec_model.inventory_item_id;
604 G_rtln_tbl(1).organization_id := l_rec_model.organization_id;
605 G_rtln_tbl(1).component_code := l_rec_model.component_code;
606 G_rtln_tbl(1).quantity := l_rec_model.quantity;
607 G_rtln_tbl(1).included_flag := 'N';
608 G_rtln_tbl(1).created_flag := 'Y';
609
610 END LOOP ;
611
612 l_index := G_rtln_tbl.LAST + 1 ;
613
614 FOR l_rec_options IN c_options (p_config_hdr_id,p_config_rev_nbr)
615 LOOP
616
617 G_rtln_tbl(l_index).quote_line_id := l_rec_options.quote_line_id;
618 G_rtln_tbl(l_index).parent_config_item_id := l_rec_options.parent_config_item_id;
619 G_rtln_tbl(l_index).config_item_id := l_rec_options.config_item_id;
620 G_rtln_tbl(l_index).inventory_item_id := l_rec_options.inventory_item_id;
621 G_rtln_tbl(l_index).organization_id := l_rec_options.organization_id;
622 G_rtln_tbl(l_index).component_code := l_rec_options.component_code;
623 G_rtln_tbl(l_index).quantity := l_rec_options.quantity;
624 G_rtln_tbl(l_index).included_flag := 'N';
625 G_rtln_tbl(l_index).created_flag := 'N';
626
627 l_index := l_index + 1;
628
629 END LOOP ;
630
631 END Populate_Rtln_Tbl ;
632
633
634
635 PROCEDURE Get_config_details(
636 p_api_version_number IN NUMBER,
637 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
638 p_commit IN VARCHAR2 := FND_API.G_FALSE,
639 p_control_rec IN aso_quote_pub.control_rec_type
640 := aso_quote_pub.G_MISS_control_rec,
641 p_qte_header_rec IN aso_quote_pub.qte_header_rec_type,
642 p_model_line_rec IN aso_quote_pub.qte_line_rec_type,
643 p_config_rec IN aso_quote_pub.qte_line_dtl_rec_type,
644 p_config_hdr_id IN NUMBER,
645 p_config_rev_nbr IN NUMBER,
646 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
647 x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
648 x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
649 )
650 IS
651 CURSOR C_config_details_ins (l_config_hdr_id NUMBER,
652 l_config_rev_nbr NUMBER ) IS
653 SELECT config_hdr_id,
654 config_rev_nbr ,
655 config_item_id ,
656 parent_config_item_id ,
657 inventory_item_id ,
658 organization_id ,
659 component_code ,
660 quantity ,
661 uom_code,
662 bom_sort_order,
663 config_delta,
664 name,
665 line_type,
666 component_sequence_id,
667 ato_config_item_id,
668 model_config_item_id
669 FROM cz_config_details_v cfg_dtl
670 WHERE config_hdr_id = l_config_hdr_id
671 AND config_rev_nbr = l_config_rev_nbr
672 AND NOT EXISTS (SELECT NULL
673 FROM ASO_QUOTE_LINE_DETAILS qte_dtl
674 WHERE qte_dtl.config_header_id = cfg_dtl.config_hdr_id
675 AND qte_dtl.config_revision_num = cfg_dtl.config_rev_nbr
676 AND qte_dtl.config_item_id = cfg_dtl.config_item_id )
677 ORDER BY cfg_dtl.bom_sort_order;
678
679 --assumption is currently we are updating only the qty/uom/the flags and bom_sort_order
680 CURSOR C_config_details_upd ( l_config_hdr_id NUMBER ,
681 l_config_rev_nbr NUMBER ,
682 l_complete_configuration_flag VARCHAR2,
683 l_valid_configuration_flag VARCHAR2 ) IS
684 SELECT dtl.quote_line_id,
685 dtl.quote_line_detail_id,
686 cfg.inventory_item_id ,
687 cfg.organization_id ,
691 cfg.bom_sort_order,
688 cfg.component_code ,
689 cfg.quantity ,
690 cfg.uom_code,
692 cfg.config_delta,
693 cfg.line_type,
694 cfg.name,
695 qte.line_type_source_flag
696 FROM ASO_QUOTE_LINE_DETAILS dtl,
697 CZ_CONFIG_DETAILS_V cfg ,
698 ASO_QUOTE_LINES_ALL qte
699 WHERE dtl.config_header_id = l_config_hdr_id
700 AND cfg.config_rev_nbr = l_config_rev_nbr
701 AND dtl.config_header_id = cfg.config_hdr_id
702 AND dtl.config_revision_num = cfg.config_rev_nbr
703 AND dtl.config_item_id = cfg.config_item_id
704 AND dtl.quote_line_id = qte.quote_line_id
705 AND ((qte.quantity <> cfg.quantity)
706 OR (qte.uom_code <> cfg.uom_code)
707 OR (dtl.complete_configuration_flag <> l_complete_configuration_flag)
708 OR (dtl.valid_configuration_flag <> l_valid_configuration_flag)
709 OR (dtl.bom_sort_order <> cfg.bom_sort_order)
710 OR (dtl.config_instance_name <> cfg.name)
711 OR (nvl(dtl.config_delta,-1) <> nvl(cfg.config_delta, -1))
712 OR (nvl(qte.order_line_type_id,-1) <> nvl(cfg.line_type, -1)));
713
714 CURSOR C_config_details_del( l_config_hdr_id NUMBER ,
715 l_config_rev_nbr NUMBER ) IS
716 SELECT dtl.quote_line_id
717 FROM ASO_QUOTE_LINE_DETAILS dtl
718 WHERE dtl.config_header_id = l_config_hdr_id
719 AND dtl.config_revision_num = l_config_rev_nbr
720 AND NOT EXISTS ( SELECT NULL
721 FROM CZ_CONFIG_DETAILS_V cfg
722 WHERE cfg.config_item_id = dtl.config_item_id
723 AND cfg.config_hdr_id = l_config_hdr_id
724 AND cfg.config_rev_nbr = l_config_rev_nbr );
725
726 CURSOR C_config_all(p_parent_config_item_id number) IS
727 SELECT quote_line_id
728 FROM aso_quote_line_details
729 WHERE config_header_id = p_config_hdr_id
730 AND config_revision_num = p_config_rev_nbr
731 AND config_item_id = p_parent_config_item_id;
732
733 CURSOR C_Config_Exists( l_config_hdr_id NUMBER ,
734 l_config_rev_nbr NUMBER ) IS
735 SELECT quote_line_id
736 FROM aso_quote_line_details
737 WHERE ref_type_code = 'CONFIG'
738 AND ref_line_id IS NULL
739 AND config_header_id = l_config_hdr_id
740 AND config_revision_num = l_config_rev_nbr;
741
742 CURSOR c_quote(c_qte_header_id NUMBER) IS
743 SELECT last_update_date, quote_type
744 FROM ASO_QUOTE_HEADERS_ALL
745 WHERE quote_header_id = c_qte_header_id;
746
747 CURSOR Order_Type_C IS
748 SELECT order_line_type_id, line_category_code, price_list_id, line_number,ship_model_complete_flag,
749 config_model_type
750 FROM aso_quote_lines_all
751 WHERE quote_line_id = p_config_rec.quote_line_id;
752
753 CURSOR c_messages is
754 SELECT constraint_type, message
755 FROM cz_config_messages
756 WHERE config_hdr_id = p_config_hdr_id
757 AND config_rev_nbr = p_config_rev_nbr;
758
759 CURSOR C_diff_Config_Exists IS
760 SELECT config_header_id
761 FROM aso_quote_line_details
762 WHERE ref_type_code = 'CONFIG'
763 AND ref_line_id IS NULL
764 AND quote_line_id = p_config_rec.quote_line_id;
765
766 CURSOR c_config_exist_in_cz (p_config_hdr_id number, p_config_rev_nbr number) IS
767 select config_hdr_id
768 from cz_config_details_v
769 where config_hdr_id = p_config_hdr_id
770 and config_rev_nbr = p_config_rev_nbr;
771
772 l_api_name CONSTANT VARCHAR2(30) := 'Get_Config_Details' ;
773 l_api_version_number CONSTANT NUMBER := 1.0;
774 l_index BINARY_INTEGER ;
775 l_complete_configuration_flag VARCHAR2(1);
776 l_valid_configuration_flag VARCHAR2(1);
777 l_quote_line_id NUMBER;
778 l_last_update_date date;
779 p NUMBER;
780 l_order_line_type_id NUMBER;
781 l_line_category_code VARCHAR2(30);
782 l_price_list_id NUMBER;
783 l_quote_type VARCHAR2(1);
784 l_line_number NUMBER;
785 i NUMBER;
786 l_len_msg NUMBER;
787 l_old_config_hdr_id NUMBER;
788 l_ship_model_complete_flag VARCHAR2(1);
789
790 l_control_rec ASO_PRICING_INT.PRICING_CONTROL_REC_TYPE
791 := ASO_UTILITY_PVT.Get_Pricing_Control_Rec;
792 l_qte_header_rec ASO_QUOTE_PUB.Qte_Header_Rec_Type;
793 l_qte_line_tbl ASO_QUOTE_PUB.Qte_Line_Tbl_Type := ASO_QUOTE_PUB.G_MISS_Qte_Line_Tbl;
794 l_qte_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type := ASO_QUOTE_PUB.G_MISS_Qte_Line_Dtl_Tbl;
795 l_qte_line_dtl_search ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type := ASO_QUOTE_PUB.G_MISS_Qte_Line_Dtl_Tbl;
796 l_hd_Price_Attr_Tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
797 l_hd_payment_tbl ASO_QUOTE_PUB.Payment_Tbl_Type;
798 l_hd_shipment_rec ASO_QUOTE_PUB.Shipment_rec_Type;
799 l_hd_freight_charge_tbl ASO_QUOTE_PUB.Freight_Charge_Tbl_Type;
800 l_hd_tax_detail_tbl ASO_QUOTE_PUB.Tax_Detail_Tbl_Type;
804 l_Price_Adj_Attr_Tbl ASO_QUOTE_PUB.Price_Adj_Attr_Tbl_Type;
801 l_Line_Attr_Ext_Tbl ASO_QUOTE_PUB.Line_Attribs_Ext_Tbl_Type;
802 l_line_rltship_tbl ASO_QUOTE_PUB.Line_Rltship_Tbl_Type;
803 l_Price_Adjustment_Tbl ASO_QUOTE_PUB.Price_Adj_Tbl_Type;
805 l_price_adj_rltship_tbl ASO_QUOTE_PUB.Price_Adj_Rltship_Tbl_Type;
806 l_ln_Price_Attr_Tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
807 l_ln_payment_tbl ASO_QUOTE_PUB.Payment_Tbl_Type;
808 l_ln_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
809 l_ln_freight_charge_tbl ASO_QUOTE_PUB.Freight_Charge_Tbl_Type;
810 l_ln_tax_detail_tbl ASO_QUOTE_PUB.Tax_Detail_Tbl_Type;
811 l_shipment_tbl ASO_QUOTE_PUB.Shipment_tbl_Type;
812
813 lx_qte_header_rec ASO_QUOTE_PUB.Qte_Header_Rec_Type;
814 lx_qte_line_tbl ASO_QUOTE_PUB.Qte_Line_Tbl_Type;
815 lx_qte_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type;
816 lx_hd_Price_Attr_Tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
817 lx_hd_payment_tbl ASO_QUOTE_PUB.Payment_Tbl_Type;
818 lx_hd_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
819 lx_hd_freight_charge_tbl ASO_QUOTE_PUB.Freight_Charge_Tbl_Type;
820 lx_hd_tax_detail_tbl ASO_QUOTE_PUB.Tax_Detail_Tbl_Type;
821 lx_Line_Attr_Ext_Tbl ASO_QUOTE_PUB.Line_Attribs_Ext_Tbl_Type;
822 lx_line_rltship_tbl ASO_QUOTE_PUB.Line_Rltship_Tbl_Type;
823 lx_Price_Adjustment_Tbl ASO_QUOTE_PUB.Price_Adj_Tbl_Type;
824 lx_Price_Adj_Attr_Tbl ASO_QUOTE_PUB.Price_Adj_Attr_Tbl_Type;
825 lx_price_adj_rltship_tbl ASO_QUOTE_PUB.Price_Adj_Rltship_Tbl_Type;
826 lx_ln_Price_Attr_Tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
827 lx_ln_payment_tbl ASO_QUOTE_PUB.Payment_Tbl_Type;
828 lx_ln_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
829 lx_ln_freight_charge_tbl ASO_QUOTE_PUB.Freight_Charge_Tbl_Type;
830 lx_ln_tax_detail_tbl ASO_QUOTE_PUB.Tax_Detail_Tbl_Type;
831
832 l_file varchar2(200);
833 lx_return_status varchar2(10);
834 l_config_model_type varchar2(30);
835
836 BEGIN
837 -- Standard Start of API savepoint
838 SAVEPOINT GET_CONFIG_DETAILS_INT;
839
840 /*
841 aso_debug_pub.g_debug_flag := 'Y';
842 aso_debug_pub.SetDebugLevel(10);
843 aso_debug_pub.Initialize;
844 l_file := ASO_DEBUG_PUB.Set_Debug_Mode('FILE');
845 aso_debug_pub.debug_on;
846 */
847
848 IF aso_debug_pub.g_debug_flag = 'Y' THEN
849
850 aso_debug_pub.add('ASO_CFG_INT: GET_CONFIG_DETAILS: Start %%%%%%%%%%%%%%%%%%%', 1, 'Y');
851
852 aso_debug_pub.add('GET_CONFIG_DETAILS: p_qte_header_rec.quote_header_id: '|| p_qte_header_rec.quote_header_id);
853 aso_debug_pub.add('GET_CONFIG_DETAILS: p_config_hdr_id: '|| p_config_hdr_id);
854 aso_debug_pub.add('GET_CONFIG_DETAILS: p_config_rev_nbr: '|| p_config_rev_nbr);
855 aso_debug_pub.add('p_config_rec.valid_configuration_flag: '|| p_config_rec.valid_configuration_flag);
856 aso_debug_pub.add('p_config_rec.complete_configuration_flag: '|| p_config_rec.complete_configuration_flag);
857 END IF;
858
859 -- Standard call to check for call compatibility.
860 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
861 p_api_version_number,
862 l_api_name,
863 G_PKG_NAME) THEN
864 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
865 END IF;
866
867 -- Initialize message list if p_init_msg_list is set to TRUE.
868 IF FND_API.to_Boolean( p_init_msg_list ) THEN
869 FND_MSG_PUB.initialize;
870 END IF;
871
872 -- Set return status to success
873 x_return_status := FND_API.G_RET_STS_SUCCESS;
874
875
876 --Procedure added by Anoop Rajan on 30/09/2005 to print login details
877 IF aso_debug_pub.g_debug_flag = 'Y' THEN
878 aso_debug_pub.add('Before call to printing login info details', 1, 'Y');
879 ASO_UTILITY_PVT.print_login_info;
880 aso_debug_pub.add('After call to printing login info details', 1, 'Y');
881 END IF;
882
883 -- Change Done By Girish
884 -- Procedure added to validate the operating unit
885 ASO_VALIDATE_PVT.VALIDATE_OU(p_qte_header_rec);
886
887
888 -- check whether a different config_header_id is already
889 -- associated with this model item. If yes raise an error.
890
891 IF aso_debug_pub.g_debug_flag = 'Y' THEN
892 aso_debug_pub.add( 'ASO_CFG_INT: Get_config_details: Before C_diff_Config_Exists cursor open');
893 END IF;
894
895 OPEN C_diff_Config_Exists;
896 FETCH C_diff_Config_Exists INTO l_old_config_hdr_id ;
897 CLOSE C_diff_Config_Exists;
898
899 IF aso_debug_pub.g_debug_flag = 'Y' THEN
900 aso_debug_pub.add( 'ASO_CFG_INT: Get_config_details: l_old_config_hdr_id: '||l_old_config_hdr_id, 1, 'Y');
901 END IF;
902
903 IF l_old_config_hdr_id IS NOT NULL AND l_old_config_hdr_id <> p_config_hdr_id THEN
904
905 IF aso_debug_pub.g_debug_flag = 'Y' THEN
906 aso_debug_pub.add( 'ASO_CFG_INT: Get_config_details: Inside If l_old_config_hdr_id <> p_config_hdr_id cond', 1, 'Y');
907 END IF;
908
909 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
910 FND_MESSAGE.Set_Name('ASO', 'ASO_DIFFERENT_CONFIG_EXISTS');
911 FND_MSG_PUB.ADD;
912 END IF;
916
913 RAISE FND_API.G_EXC_ERROR;
914
915 END IF;
917 -- check whether the config_header_id+config_revision_num is already
918 -- associated with other model item. If yes raise an error.
919
920 IF aso_debug_pub.g_debug_flag = 'Y' THEN
921 aso_debug_pub.add( 'ASO_CFG_INT: Get_config_details: Before C_config_exists cursor open');
922 END IF;
923
924 OPEN C_config_exists(l_config_hdr_id => p_config_hdr_id ,
925 l_config_rev_nbr => p_config_rev_nbr);
926 FETCH C_config_exists INTO l_quote_line_id ;
927 CLOSE C_config_exists;
928
929 IF l_quote_line_id IS NOT NULL AND l_quote_line_id <> p_config_rec.quote_line_id THEN
930
931 IF aso_debug_pub.g_debug_flag = 'Y' THEN
932 aso_debug_pub.add( 'ASO_CFG_INT: Get_config_details: Inside C_config_exists cursor l_quote_line_id: '||l_quote_line_id);
933 END IF;
934
935 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
936 FND_MESSAGE.Set_Name('ASO', 'ASO_API_CONFIG_EXISTS');
937 FND_MSG_PUB.ADD;
938 END IF;
939 RAISE FND_API.G_EXC_ERROR;
940
941 END IF;
942
943 --check if the quote has been modified by someone else
944
945 OPEN c_quote(p_qte_header_rec.quote_header_id);
946 FETCH c_quote INTO l_last_update_date, l_quote_type;
947 CLOSE c_quote;
948
949 IF aso_debug_pub.g_debug_flag = 'Y' THEN
950 aso_debug_pub.add('Get_config_details: p_qte_header_rec.last_update_date: ' || to_char(p_qte_header_rec.last_update_date, 'DD-MON-YYYY HH24:MI:SS'));
951 aso_debug_pub.add('Get_config_details: l_last_update_date: ' || to_char(l_last_update_date, 'DD-MON-YYYY HH24:MI:SS'));
952 aso_debug_pub.add('ASO_CFG_INT: Get_config_details: l_quote_type: ' || l_quote_type);
953 END IF;
954
955 if (p_qte_header_rec.last_update_date is not null) and (p_qte_header_rec.last_update_date <> fnd_api.g_miss_date) then
956
957 If (l_last_update_date <> p_qte_header_rec.last_update_date) Then
958
959 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
960 FND_MESSAGE.Set_Name('ASO', 'ASO_API_RECORD_CHANGED');
961 FND_MESSAGE.Set_Token('INFO', 'quote', FALSE);
962 FND_MSG_PUB.ADD;
963 END IF;
964 raise FND_API.G_EXC_ERROR;
965
966 End if;
967
968 end if;
969
970 IF aso_debug_pub.g_debug_flag = 'Y' THEN
971 aso_debug_pub.add( 'ASO_CFG_INT: Get_config_details: After C_config_exists cursor');
972 END IF;
973
974 --check if revision number has changed for this configuration.
975 --if yes update all the previous selected options to the current
976 --revision number.This is necessary as the current revision number
977 --will not be the same as in aso_quote_line_details.
978
979 IF ((p_config_rec.config_header_id <> FND_API.G_Miss_num AND
980 p_config_rec.config_revision_num <> FND_API.G_Miss_Num) AND
981 (p_config_rec.config_header_id IS NOT NULL AND
982 p_config_rec.config_revision_num IS NOT NULL)) AND
983 (p_config_rec.config_header_id <> p_config_hdr_id OR
984 p_config_rec.config_revision_num <> p_config_rev_nbr) THEN
985 BEGIN
986 IF aso_debug_pub.g_debug_flag = 'Y' THEN
987 aso_debug_pub.add( 'ASO_CFG_INT: Get_config_details: Revision number has changed so updating');
988 END IF;
989
990 UPDATE aso_quote_line_details
991 SET config_revision_num = p_config_rev_nbr,
992 last_update_date = sysdate,
993 last_updated_by = FND_GLOBAL.USER_ID,
994 last_update_login = FND_GLOBAL.CONC_LOGIN_ID
995 WHERE config_header_id = p_config_rec.config_header_id
996 AND config_revision_num = p_config_rec.config_revision_num ;
997
998 EXCEPTION
999
1000 WHEN OTHERS THEN
1001
1002 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1003 aso_debug_pub.add('Get_config_details: Inside WHEN OTHERS Exception of Update config_revision_num');
1004 END IF;
1005 END;
1006
1007 END IF;
1008
1009
1010 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1011 aso_debug_pub.add( 'ASO_CFG_INT: Get_config_details: After Update config_revision_num');
1012 END IF;
1013
1014 OPEN Order_Type_C;
1015 FETCH Order_Type_C INTO l_order_line_type_id, l_line_category_code, l_price_list_id, l_line_number,l_ship_model_complete_flag,l_config_model_type;
1016
1017 IF Order_Type_C%NOTFOUND THEN
1018
1019 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1020 aso_debug_pub.add( 'ASO_CFG_INT: Get_config_details: Cursor Order_Type_C NOTFOUND');
1021 END IF;
1022
1023 END IF;
1024 CLOSE Order_Type_C;
1025
1026 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1027
1028 aso_debug_pub.add('Get_config_details: Model: p_config_rec.quote_line_id: '|| p_config_rec.quote_line_id);
1029 aso_debug_pub.add('Get_config_details: Model: l_order_line_type_id: ' || l_order_line_type_id);
1030 aso_debug_pub.add('Get_config_details: Model: l_line_category_code: ' || l_line_category_code);
1031 aso_debug_pub.add('Get_config_details: Model: l_price_list_id: ' || l_price_list_id);
1035 END IF;
1032 aso_debug_pub.add('Get_config_details: Model: l_line_number: ' || l_line_number);
1033 aso_debug_pub.add('Get_config_details: Model: l_ship_model_complete_flag: ' || l_ship_model_complete_flag);
1034 aso_debug_pub.add('Get_config_details: Model: l_config_model_type: ' || l_config_model_type);
1036
1037 l_index := 0;
1038
1039 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1040 aso_debug_pub.add('ASO_CFG_INT: Get_Config_details: Before C_config_details_ins cursor LOOP');
1041 END IF;
1042
1043 FOR row IN C_config_details_ins(p_config_hdr_id, p_config_rev_nbr)
1044 LOOP
1045
1046 l_index := l_index + 1;
1047
1048 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1049
1050 aso_debug_pub.add('ASO_CFG_INT: Get_Config_details: Inside C_config_details_ins cursor LOOP');
1051 aso_debug_pub.add('Get_Config_Details: l_index: '|| l_index);
1052 aso_debug_pub.add('Get_Config_Details: config_header_id: '|| row.config_hdr_id);
1053 aso_debug_pub.add('Get_Config_Details: config_revision_num: '|| row.config_rev_nbr);
1054 aso_debug_pub.add('Get_Config_Details: config_item_id: '|| row.config_item_id);
1055 aso_debug_pub.add('Get_Config_Details: parent_config_item_id: '|| row.parent_config_item_id);
1056 aso_debug_pub.add('Get_Config_Details: inventory_item_id: '|| row.inventory_item_id);
1057 aso_debug_pub.add('Get_Config_Details: organization_id: '|| row.organization_id);
1058 aso_debug_pub.add('Get_Config_Details: component_code: '|| row.component_code);
1059 aso_debug_pub.add('Get_Config_Details: quantity: '|| row.quantity);
1060 aso_debug_pub.add('Get_Config_Details: uom_code: '|| row.uom_code);
1061 aso_debug_pub.add('Get_Config_Details: bom_sort_order: '|| row.bom_sort_order);
1062 aso_debug_pub.add('Get_Config_Details: config_delta: '|| row.config_delta);
1063 aso_debug_pub.add('Get_Config_Details: name: '|| row.name);
1064 aso_debug_pub.add('Get_Config_Details: line_type: '|| row.line_type);
1065 aso_debug_pub.add('Get_Config_Details: component_sequence_id: '|| row.component_sequence_id);
1066 aso_debug_pub.add('Get_Config_Details: ato_config_item_id: '|| row.ato_config_item_id);
1067 aso_debug_pub.add('Get_Config_Details: model_config_item_id: '|| row.model_config_item_id);
1068 END IF;
1069
1070 IF to_char( row.inventory_item_id ) = row.component_code THEN
1071
1072 l_Qte_Line_Tbl(l_index).item_type_code := 'MDL';
1073 l_Qte_Line_Tbl(l_index).OPERATION_CODE := 'UPDATE';
1074 l_Qte_Line_Tbl(l_index).quote_header_id := p_qte_header_rec.quote_header_id;
1075 l_Qte_Line_Tbl(l_index).quote_line_id := p_config_rec.quote_line_id ;
1076 -- bug 3883545
1077 l_Qte_Line_Tbl(l_index).quantity := row.quantity ;
1078
1079
1080 l_qte_line_dtl_tbl(l_index).operation_code := 'CREATE';
1081 l_qte_line_dtl_tbl(l_index).qte_line_index := l_index;
1082 l_qte_line_dtl_tbl(l_index).config_header_id := p_config_hdr_id;
1083 l_qte_line_dtl_tbl(l_index).config_revision_num := p_config_rev_nbr;
1084 l_qte_line_dtl_tbl(l_index).complete_configuration_flag := p_config_rec.complete_configuration_flag;
1085 l_qte_line_dtl_tbl(l_index).valid_configuration_flag := p_config_rec.valid_configuration_flag;
1086 l_qte_line_dtl_tbl(l_index).component_code := row.component_code;
1087 l_Qte_Line_dtl_Tbl(l_index).quote_line_id := p_config_rec.quote_line_id;
1088 l_Qte_Line_dtl_Tbl(l_index).config_item_id := row.config_item_id;
1089 l_Qte_Line_dtl_Tbl(l_index).parent_config_item_id := NULL;
1090 l_qte_line_dtl_tbl(l_index).ref_type_code := 'CONFIG';
1091 l_qte_line_dtl_tbl(l_index).bom_sort_order := row.bom_sort_order;
1092 l_qte_line_dtl_tbl(l_index).config_delta := row.config_delta;
1093 l_qte_line_dtl_tbl(l_index).config_instance_name := row.name;
1094 l_qte_line_dtl_search(row.config_item_id).quote_line_id := p_config_rec.quote_line_id;
1095 l_qte_line_dtl_tbl(l_index).component_sequence_id := row.component_sequence_id;
1096 IF row.ato_config_item_id IS NOT NULL THEN
1097 l_qte_line_dtl_tbl(l_index).ato_line_id := p_config_rec.quote_line_id;
1098 END IF;
1099
1100 l_qte_line_dtl_tbl(l_index).top_model_line_id := p_config_rec.quote_line_id;
1101
1102
1103
1104
1105 ELSE
1106
1107 l_Qte_Line_Tbl(l_index).OPERATION_CODE := 'CREATE';
1108 l_Qte_Line_Tbl(l_index).quote_header_id := p_qte_header_rec.quote_header_id;
1109 l_Qte_Line_Tbl(l_index).item_type_code := 'CFG';
1110 l_Qte_Line_Tbl(l_index).organization_id := row.organization_id;
1111 l_Qte_Line_Tbl(l_index).inventory_item_id := row.inventory_item_id;
1112 l_Qte_Line_Tbl(l_index).quantity := row.quantity;
1113 l_Qte_Line_Tbl(l_index).uom_code := row.uom_code;
1114 --l_Qte_Line_Tbl(l_index).order_line_type_id := l_order_line_type_id; -- has been commented
1115 l_Qte_Line_Tbl(l_index).line_category_code := l_line_category_code;
1119 l_Qte_Line_Tbl(l_index).config_model_type := l_config_model_type;
1116 l_Qte_Line_Tbl(l_index).price_list_id := l_price_list_id;
1117 l_Qte_Line_Tbl(l_index).line_number := l_line_number;
1118 l_Qte_Line_Tbl(l_index).ship_model_complete_flag := l_ship_model_complete_flag;
1120
1121 l_qte_line_dtl_tbl(l_index).operation_code := 'CREATE';
1122 l_qte_line_dtl_tbl(l_index).qte_line_index := l_index;
1123 l_qte_line_dtl_tbl(l_index).config_header_id := p_config_hdr_id;
1124 l_qte_line_dtl_tbl(l_index).config_revision_num := p_config_rev_nbr;
1125 l_qte_line_dtl_tbl(l_index).complete_configuration_flag := p_config_rec.complete_configuration_flag;
1126 l_qte_line_dtl_tbl(l_index).valid_configuration_flag := p_config_rec.valid_configuration_flag;
1127 l_qte_line_dtl_tbl(l_index).component_code := row.component_code;
1128 l_qte_line_dtl_tbl(l_index).config_item_id := row.config_item_id;
1129 l_qte_line_dtl_tbl(l_index).parent_config_item_id := row.parent_config_item_id;
1130 l_qte_line_dtl_tbl(l_index).ref_type_code := 'CONFIG';
1131 l_qte_line_dtl_tbl(l_index).bom_sort_order := row.bom_sort_order;
1132 l_qte_line_dtl_tbl(l_index).config_delta := row.config_delta;
1133 l_qte_line_dtl_tbl(l_index).config_instance_name := row.name;
1134 l_qte_line_dtl_search(row.config_item_id).qte_line_index := l_index;
1135 l_qte_line_dtl_tbl(l_index).component_sequence_id := row.component_sequence_id;
1136 l_qte_line_dtl_tbl(l_index).top_model_line_id := p_config_rec.quote_line_id;
1137
1138
1139 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1140
1141 aso_debug_pub.add('Get_Config_Details: l_qte_line_dtl_search('||row.config_item_id||').qte_line_index: '||l_qte_line_dtl_search(row.config_item_id).qte_line_index);
1142
1143 END IF;
1144
1145 --Creating the parent-child relationship
1146
1147 IF l_qte_line_dtl_search.EXISTS(row.parent_config_item_id) THEN
1148
1149 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1150
1151 aso_debug_pub.add('Index of parent: l_qte_line_dtl_search('||row.parent_config_item_id||').qte_line_index: '||l_qte_line_dtl_search(row.parent_config_item_id).qte_line_index);
1152
1153 aso_debug_pub.add('Quote_line_id of parent: l_qte_line_dtl_search('||row.parent_config_item_id||').quote_line_id: '||l_qte_line_dtl_search(row.parent_config_item_id).quote_line_id);
1154
1155 END IF;
1156
1157 l_qte_line_dtl_tbl(l_index).ref_line_index := l_qte_line_dtl_search(row.parent_config_item_id).qte_line_index;
1158 l_qte_line_dtl_tbl(l_index).ref_line_id := l_qte_line_dtl_search(row.parent_config_item_id).quote_line_id;
1159
1160 ELSE
1161
1162 OPEN C_config_all(l_qte_line_dtl_tbl(l_index).parent_config_item_id);
1163 FETCH C_config_all INTO l_qte_line_dtl_tbl(l_index).ref_line_id;
1164 CLOSE C_config_all;
1165
1166 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1167
1168 aso_debug_pub.add('l_qte_line_dtl_tbl('||l_index||').ref_line_id: '||l_qte_line_dtl_tbl(l_index).ref_line_id);
1169
1170 END IF;
1171 END IF;
1172
1173 -- Populating the ato_line_id
1174
1175 IF l_qte_line_dtl_search.EXISTS(row.ato_config_item_id) THEN
1176
1177 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1178
1179 aso_debug_pub.add('Index of ato : l_qte_line_dtl_search('||row.ato_config_item_id||').qte_line_index: '||l_qte_line_dtl_search(row.ato_config_item_id).qte_line_index);
1180
1181 aso_debug_pub.add('Quote_line_id of ato: l_qte_line_dtl_search('||row.ato_config_item_id||').quote_line_id: '||l_qte_line_dtl_search(row.ato_config_item_id).quote_line_id);
1182
1183 END IF;
1184
1185 l_qte_line_dtl_tbl(l_index).ato_line_index := l_qte_line_dtl_search(row.ato_config_item_id).qte_line_index;
1186 l_qte_line_dtl_tbl(l_index).ato_line_id := l_qte_line_dtl_search(row.ato_config_item_id).quote_line_id;
1187
1188 ELSE
1189
1190 OPEN C_config_all(row.ato_config_item_id);
1191 FETCH C_config_all INTO l_qte_line_dtl_tbl(l_index).ato_line_id;
1192 CLOSE C_config_all;
1193
1194 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1195
1196 aso_debug_pub.add('l_qte_line_dtl_tbl('||l_index||').ato_line_id: '||l_qte_line_dtl_tbl(l_index).ato_line_id);
1197
1198 END IF;
1199 END IF;
1200
1201 -- End of logic for populating the ato_line_id
1202
1203
1204 --Populating order_line_type_id value based on CZ line_type value
1205
1206 IF row.line_type IS NOT NULL THEN
1207
1208 l_Qte_Line_Tbl(l_index).order_line_type_id := row.line_type;
1209 l_Qte_Line_Tbl(l_index).Line_type_source_flag := 'C';
1210
1211 ELSE
1212
1213 l_Qte_Line_Tbl(l_index).order_line_type_id := l_order_line_type_id;
1214
1215 END IF;
1216
1217 END IF;
1218 END LOOP;
1219
1223
1220 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1221
1222 aso_debug_pub.add( 'ASO_CFG_INT: Get_Config_details: After C_config_details_ins cursor LOOP l_index: '|| l_index);
1224 aso_debug_pub.add( 'ASO_CFG_INT: Get_Config_details: Before C_config_details_upd cursor LOOP');
1225
1226 END IF;
1227
1228 FOR row IN C_config_details_upd( p_config_hdr_id,
1229 p_config_rev_nbr,
1230 p_config_rec.complete_configuration_flag,
1231 p_config_rec.valid_configuration_flag)
1232 LOOP
1233
1234 l_index := l_index + 1;
1235
1236 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1237
1238 aso_debug_pub.add('ASO_CFG_INT: Get_Config_details: Inside C_config_details_upd cursor LOOP');
1239 aso_debug_pub.add('Get_Config_Details: l_index: '|| l_index);
1240 aso_debug_pub.add('Get_Config_Details: quote_line_id: '|| row.quote_line_id);
1241 aso_debug_pub.add('Get_Config_Details: quote_line_detail_id: '|| row.quote_line_detail_id);
1242 aso_debug_pub.add('Get_Config_Details: inventory_item_id: '|| row.inventory_item_id);
1243 aso_debug_pub.add('Get_Config_Details: organization_id: '|| row.organization_id);
1244 aso_debug_pub.add('Get_Config_Details: component_code: '|| row.component_code);
1245 aso_debug_pub.add('Get_Config_Details: quantity: '|| row.quantity);
1246 aso_debug_pub.add('Get_Config_Details: uom_code: '|| row.uom_code);
1247 aso_debug_pub.add('Get_Config_Details: bom_sort_order: '|| row.bom_sort_order);
1248 aso_debug_pub.add('Get_Config_Details: config_delta: '|| row.config_delta);
1249 aso_debug_pub.add('Get_Config_Details: name: '|| row.name);
1250 aso_debug_pub.add('Get_Config_Details: line_type: '|| row.line_type);
1251 END IF;
1252
1253 l_Qte_Line_Tbl(l_index).quote_header_id := p_qte_header_rec.quote_header_id;
1254 l_Qte_Line_Tbl(l_index).quote_line_id := row.quote_line_id;
1255 l_Qte_Line_Tbl(l_index).OPERATION_CODE := 'UPDATE';
1256 l_Qte_Line_Tbl(l_index).quantity := row.quantity;
1257 l_Qte_Line_Tbl(l_index).uom_code := row.uom_code;
1258
1259 l_Qte_Line_dtl_Tbl(l_index).OPERATION_CODE := 'UPDATE';
1260 l_Qte_Line_dtl_Tbl(l_index).quote_line_detail_id := row.quote_line_detail_id;
1261 l_Qte_Line_dtl_Tbl(l_index).quote_line_id := row.quote_line_id;
1262 l_Qte_Line_dtl_Tbl(l_index).complete_configuration_flag := p_config_rec.complete_configuration_flag;
1263 l_Qte_Line_dtl_Tbl(l_index).valid_configuration_flag := p_config_rec.valid_configuration_flag;
1264 l_qte_line_dtl_tbl(l_index).bom_sort_order := row.bom_sort_order;
1265 l_qte_line_dtl_tbl(l_index).config_delta := row.config_delta;
1266 l_qte_line_dtl_tbl(l_index).config_instance_name := row.name;
1267
1268 --Updating order_line_type_id value based on CZ line_type value
1269
1270 IF row.line_type IS NOT NULL THEN
1271
1272 l_Qte_Line_Tbl(l_index).order_line_type_id := row.line_type;
1273 l_Qte_Line_Tbl(l_index).line_type_source_flag := 'C';
1274
1275 ELSIF row.line_type_source_flag = 'C' THEN
1276
1277 l_Qte_Line_Tbl(l_index).order_line_type_id := NULL;
1278
1279 END IF;
1280
1281
1282
1283 END LOOP;
1284
1285 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1286
1287 aso_debug_pub.add( 'Get_Config_details: After C_config_details_upd cursor LOOP l_index: '|| l_index);
1288 aso_debug_pub.add( 'ASO_CFG_INT: Get_Config_details: Before C_config_details_del cursor LOOP');
1289
1290 END IF;
1291
1292 FOR row IN C_config_details_del( p_config_hdr_id, p_config_rev_nbr )
1293 LOOP
1294
1295 l_index := l_index + 1;
1296
1297 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1298 aso_debug_pub.add('Get_Config_details: Inside C_config_details_del cursor LOOP');
1299 aso_debug_pub.add('Get_Config_Details: l_index: '|| l_index);
1300 aso_debug_pub.add('Get_Config_Details: quote_line_id: '|| row.quote_line_id);
1301 END IF;
1302
1303 l_Qte_Line_Tbl(l_index).OPERATION_CODE := 'DELETE';
1304 l_Qte_Line_Tbl(l_index).quote_line_id := row.quote_line_id;
1305
1306 END LOOP;
1307
1308 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1309
1310 aso_debug_pub.add('ASO_CFG_INT: Get_Config_details: After C_config_details_del cursor LOOP l_index: '|| l_index);
1311
1312 aso_debug_pub.add('ASO_CFG_INT: Get_Config_details: l_quote_type: '|| l_quote_type);
1313 aso_debug_pub.add('Get_Config_details: p_control_rec.CALCULATE_TAX_FLAG: '|| p_control_rec.CALCULATE_TAX_FLAG);
1314 aso_debug_pub.add('Get_Config_details: p_control_rec.CALCULATE_FREIGHT_CHARGE_FLAG: '|| p_control_rec.CALCULATE_FREIGHT_CHARGE_FLAG);
1315 aso_debug_pub.add('Get_Config_details: p_control_rec.pricing_request_type: '|| p_control_rec.pricing_request_type);
1316 aso_debug_pub.add('Get_Config_details: p_control_rec.header_pricing_event: '|| p_control_rec.header_pricing_event);
1317
1318 END IF;
1319
1320
1321 --Populate quote header record
1322
1323 l_qte_header_rec := p_qte_header_rec;
1327 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1324 l_qte_header_rec.last_update_date := l_last_update_date;
1325 l_qte_header_rec.CALL_BATCH_VALIDATION_FLAG := FND_API.G_FALSE;
1326
1328
1329 aso_debug_pub.add( 'Get_Config_details: Before call to Update Quote table count');
1330 aso_debug_pub.add( 'Get_Config_details: l_Qte_Line_Tbl.count: '||l_Qte_Line_Tbl.count);
1331 aso_debug_pub.add( 'Get_Config_details: l_Qte_Line_Dtl_Tbl.count: '||l_Qte_Line_Dtl_Tbl.count);
1332
1333 END IF;
1334
1335 ASO_QUOTE_PUB.Update_Quote(
1336 p_api_version_number => 1.0,
1337 p_init_msg_list => FND_API.G_FALSE,
1338 p_commit => FND_API.G_FALSE,
1339 p_control_rec => p_control_rec,
1340 p_qte_header_rec => l_qte_header_rec,
1341 p_hd_tax_detail_tbl => l_hd_tax_detail_tbl,
1342 --P_hd_Shipment_Tbl => l_Shipment_tbl,
1343 P_Qte_Line_Tbl => l_Qte_Line_Tbl,
1344 P_Qte_Line_Dtl_Tbl => l_Qte_Line_Dtl_Tbl,
1345 P_ln_Payment_Tbl => l_ln_Payment_Tbl,
1346 --P_ln_Tax_Detail_Tbl => l_ln_tax_detail_tbl,
1347 x_Qte_Header_Rec => lx_qte_header_rec,
1348 X_Qte_Line_Tbl => lx_Qte_Line_Tbl,
1349 X_Qte_Line_Dtl_Tbl => lx_Qte_Line_Dtl_Tbl,
1350 X_hd_Price_Attributes_Tbl => lx_hd_Price_Attr_Tbl,
1351 X_hd_Payment_Tbl => lx_hd_Payment_Tbl,
1352 X_hd_Shipment_Tbl => lx_hd_Shipment_Tbl,
1353 X_hd_Freight_Charge_Tbl => lx_hd_Freight_Charge_Tbl,
1354 X_hd_Tax_Detail_Tbl => lx_hd_Tax_Detail_Tbl,
1355 x_Line_Attr_Ext_Tbl => lx_Line_Attr_Ext_Tbl,
1356 X_line_rltship_tbl => lx_line_rltship_tbl,
1357 X_Price_Adjustment_Tbl => lx_Price_Adjustment_Tbl,
1358 X_Price_Adj_Attr_Tbl => lx_Price_Adj_Attr_Tbl,
1359 X_Price_Adj_Rltship_Tbl => lx_Price_Adj_Rltship_Tbl,
1360 X_ln_Price_Attributes_Tbl => lx_ln_Price_Attr_Tbl,
1361 X_ln_Payment_Tbl => lx_ln_Payment_Tbl,
1362 X_ln_Shipment_Tbl => lx_ln_Shipment_Tbl,
1363 X_ln_Freight_Charge_Tbl => lx_ln_Freight_Charge_Tbl,
1364 X_ln_Tax_Detail_Tbl => lx_ln_Tax_Detail_Tbl,
1365 X_Return_Status => x_Return_Status,
1366 X_Msg_Count => x_Msg_Count,
1367 X_Msg_Data => x_Msg_Data);
1368
1369 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1370 aso_debug_pub.add('Get_config_details: After call to Update_quote x_Return_Status: ' || x_Return_Status);
1371 END IF;
1372
1373 IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
1374
1375 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1376 aso_debug_pub.add('Get_config_details: Before deleting the previous version from CZ schema.');
1377 END IF;
1378
1379 IF ((p_config_rec.config_header_id <> FND_API.G_Miss_num AND
1380 p_config_rec.config_revision_num <> FND_API.G_Miss_Num) AND
1381 (p_config_rec.config_header_id IS NOT NULL AND
1382 p_config_rec.config_revision_num IS NOT NULL)) AND
1383 (p_config_rec.config_header_id <> p_config_hdr_id OR
1384 p_config_rec.config_revision_num <> p_config_rev_nbr) THEN
1385
1386 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1387 aso_debug_pub.add('Get_config_details: A previous version exist for this configuration so deleting it from CZ');
1388 END IF;
1389
1390 ASO_CFG_INT.DELETE_CONFIGURATION( P_API_VERSION_NUMBER => 1.0,
1391 P_INIT_MSG_LIST => FND_API.G_FALSE,
1392 P_CONFIG_HDR_ID => p_config_rec.config_header_id,
1393 P_CONFIG_REV_NBR => p_config_rec.config_revision_num,
1394 X_RETURN_STATUS => lx_return_status,
1395 X_MSG_COUNT => x_msg_count,
1396 X_MSG_DATA => x_msg_data);
1397
1398 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1399 aso_debug_pub.add('After call to ASO_CFG_INT.DELETE_CONFIGURATION: x_Return_Status: ' || lx_Return_Status);
1400 END IF;
1401
1402 IF lx_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1403
1404 x_return_status := lx_return_status;
1405 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1406 FND_MESSAGE.Set_Name('ASO', 'ASO_DELETE');
1407 FND_MESSAGE.Set_Token('OBJECT', 'CONFIGURATION', FALSE);
1408 FND_MSG_PUB.ADD;
1409 END IF;
1410
1411 RAISE FND_API.G_EXC_ERROR;
1412
1413 END IF;
1414
1415 END IF;
1416
1417 ELSIF x_return_status = FND_API.G_RET_STS_ERROR THEN
1418 RAISE FND_API.G_EXC_ERROR;
1419
1420 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1421 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1422
1423 END IF;
1424
1425 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1426 aso_debug_pub.add('Get_config_details: Before deleting records from aso_line_relationships table');
1430 WHERE line_relationship_id IN (SELECT line_relationship_id
1427 END IF;
1428
1429 DELETE aso_line_relationships
1431 FROM aso_line_relationships a
1432 WHERE a.relationship_type_code = 'CONFIG'
1433 START WITH a.quote_line_id = p_config_rec.quote_line_id
1434 CONNECT BY PRIOR a.related_quote_line_id = a.quote_line_id);
1435
1436 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1437 aso_debug_pub.add('Get_config_details: After deleting records from aso_line_relationships table');
1438 END IF;
1439
1440 G_rtln_tbl := G_MISS_rtln_tbl;
1441
1442 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1443 aso_debug_pub.add('ASO_CFG_INT: Get_config_details: Before call to populate_rtln_Tbl');
1444 END IF;
1445
1446 populate_rtln_Tbl( p_quote_header_id => p_qte_header_rec.quote_header_id,
1447 p_quote_line_id => p_config_rec.quote_line_id,
1448 p_config_hdr_id => p_config_hdr_id,
1449 p_config_rev_nbr => p_config_rev_nbr );
1450
1451
1452 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1453
1454 aso_debug_pub.add('ASO_CFG_INT: Get_config_details: After call to populate_rtln_Tbl');
1455
1456 FOR p IN G_rtln_tbl.first..G_rtln_tbl.last LOOP
1457
1458 aso_debug_pub.add( 'Get_config_details: G_rtln_tbl('||p||').quote_line_id: '|| G_rtln_tbl(p).quote_line_id);
1459 aso_debug_pub.add( 'Get_config_details: G_rtln_tbl('||p||').parent_config_item_id: '|| G_rtln_tbl(p).parent_config_item_id);
1460 aso_debug_pub.add( 'Get_config_details: G_rtln_tbl('||p||').config_item_id: '|| G_rtln_tbl(p).config_item_id);
1461 aso_debug_pub.add( 'Get_config_details: G_rtln_tbl('||p||').inventory_item_id: '|| G_rtln_tbl(p).inventory_item_id);
1462 aso_debug_pub.add( 'Get_config_details: G_rtln_tbl('||p||').organization_id: '|| G_rtln_tbl(p).organization_id);
1463 aso_debug_pub.add( 'Get_config_details: G_rtln_tbl('||p||').component_code: '|| G_rtln_tbl(p).component_code);
1464 aso_debug_pub.add( 'Get_config_details: G_rtln_tbl('||p||').quantity: '|| G_rtln_tbl(p).quantity);
1465 aso_debug_pub.add( 'Get_config_details: G_rtln_tbl('||p||').included_flag: '|| G_rtln_tbl(p).included_flag);
1466 aso_debug_pub.add( 'Get_config_details: G_rtln_tbl('||p||').created_flag: '|| G_rtln_tbl(p).created_flag);
1467
1468 END LOOP;
1469
1470 aso_debug_pub.add('ASO_CFG_INT: Get_config_details: Before call to Create_Relationship procedure');
1471
1472 END IF;
1473
1474 Create_Relationship( parent_quote_line_id => G_rtln_tbl(1).quote_line_id,
1475 p_config_item_id => G_rtln_tbl(1).config_item_id,
1476 x_return_status => x_return_status,
1477 x_msg_count => x_msg_count,
1478 x_msg_data => x_msg_data );
1479
1480 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1481
1482 aso_debug_pub.add('Get_config_details: After call to Create_Relationship: x_return_status: '|| x_return_status);
1483
1484 END IF;
1485
1486 -- Check return status from the above procedure call
1487
1488 IF x_return_status = FND_API.G_RET_STS_ERROR then
1489 raise FND_API.G_EXC_ERROR;
1490 elsif x_return_status = FND_API.G_RET_STS_UNEXP_ERROR then
1491 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1492 END IF;
1493
1494 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1495 aso_debug_pub.add('Get_config_details: Before deleting the previous version from CZ schema.');
1496 END IF;
1497
1498 IF ((p_config_rec.config_header_id <> FND_API.G_Miss_num AND
1499 p_config_rec.config_revision_num <> FND_API.G_Miss_Num) AND
1500 (p_config_rec.config_header_id IS NOT NULL AND
1501 p_config_rec.config_revision_num IS NOT NULL)) AND
1502 (p_config_rec.config_header_id <> p_config_hdr_id OR
1503 p_config_rec.config_revision_num <> p_config_rev_nbr) THEN
1504
1505 open c_config_exist_in_cz(p_config_rec.config_header_id, p_config_rec.config_revision_num);
1506 fetch c_config_exist_in_cz into l_old_config_hdr_id;
1507 if c_config_exist_in_cz%found then
1508
1509 close c_config_exist_in_cz;
1510
1511 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1512 aso_debug_pub.add('Get_config_details: A previous version exist for this configuration so deleting it from CZ');
1513 END IF;
1514
1515 ASO_CFG_INT.DELETE_CONFIGURATION( P_API_VERSION_NUMBER => 1.0,
1516 P_INIT_MSG_LIST => FND_API.G_FALSE,
1517 P_CONFIG_HDR_ID => p_config_rec.config_header_id,
1518 P_CONFIG_REV_NBR => p_config_rec.config_revision_num,
1519 X_RETURN_STATUS => lx_return_status,
1520 X_MSG_COUNT => x_msg_count,
1521 X_MSG_DATA => x_msg_data);
1522
1523 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1524 aso_debug_pub.add('After call to ASO_CFG_INT.DELETE_CONFIGURATION: x_Return_Status: ' || lx_Return_Status);
1525 END IF;
1526
1527 IF lx_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1528
1529 x_return_status := lx_return_status;
1533 FND_MSG_PUB.ADD;
1530 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1531 FND_MESSAGE.Set_Name('ASO', 'ASO_DELETE');
1532 FND_MESSAGE.Set_Token('OBJECT', 'CONFIGURATION', FALSE);
1534 END IF;
1535
1536 RAISE FND_API.G_EXC_ERROR;
1537
1538 END IF;
1539
1540 else
1541 close c_config_exist_in_cz;
1542 end if;
1543
1544 END IF;
1545
1546 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1547 aso_debug_pub.add( 'ASO_CFG_INT: GET_CONFIG_DETAILS: Finish %%%%%%%%%%%%%%%%%%%', 1, 'Y' );
1548 END IF;
1549
1550 EXCEPTION
1551
1552 WHEN FND_API.G_EXC_ERROR THEN
1553
1554 open c_config_exist_in_cz(p_config_hdr_id, p_config_rev_nbr);
1555 fetch c_config_exist_in_cz into l_old_config_hdr_id;
1556
1557 if c_config_exist_in_cz%found then
1558
1559 close c_config_exist_in_cz;
1560
1561 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1562 aso_debug_pub.add('Get_config_details: A previous version exist for this configuration so deleting it from CZ');
1563 END IF;
1564
1565 ASO_CFG_INT.DELETE_CONFIGURATION_AUTO( P_API_VERSION_NUMBER => 1.0,
1566 P_INIT_MSG_LIST => FND_API.G_FALSE,
1567 P_CONFIG_HDR_ID => p_config_hdr_id,
1568 P_CONFIG_REV_NBR => p_config_rev_nbr,
1569 X_RETURN_STATUS => lx_return_status,
1570 X_MSG_COUNT => x_msg_count,
1571 X_MSG_DATA => x_msg_data);
1572
1573 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1574 aso_debug_pub.add('After call to ASO_CFG_INT.DELETE_CONFIGURATION: x_Return_Status: ' || lx_Return_Status);
1575 END IF;
1576
1577 IF lx_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1578
1579 x_return_status := lx_return_status;
1580 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1581 FND_MESSAGE.Set_Name('ASO', 'ASO_DELETE');
1582 FND_MESSAGE.Set_Token('OBJECT', 'CONFIGURATION', FALSE);
1583 FND_MSG_PUB.ADD;
1584 END IF;
1585
1586 RAISE FND_API.G_EXC_ERROR;
1587
1588 END IF;
1589
1590 else
1591 close c_config_exist_in_cz;
1592 end if;
1593
1594 ASO_UTILITY_PVT.HANDLE_EXCEPTIONS(
1595 P_API_NAME => L_API_NAME
1596 ,P_PKG_NAME => G_PKG_NAME
1597 ,P_EXCEPTION_LEVEL => FND_MSG_PUB.G_MSG_LVL_ERROR
1598 ,P_PACKAGE_TYPE => ASO_UTILITY_PVT.G_INT
1599 ,X_MSG_COUNT => X_MSG_COUNT
1600 ,X_MSG_DATA => X_MSG_DATA
1601 ,X_RETURN_STATUS => X_RETURN_STATUS);
1602
1603 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1604
1605 open c_config_exist_in_cz(p_config_hdr_id, p_config_rev_nbr);
1606 fetch c_config_exist_in_cz into l_old_config_hdr_id;
1607
1608 if c_config_exist_in_cz%found then
1609
1610 close c_config_exist_in_cz;
1611
1612 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1613 aso_debug_pub.add('Get_config_details: A previous version exist for this configuration so deleting it from CZ');
1614 END IF;
1615
1616 ASO_CFG_INT.DELETE_CONFIGURATION_AUTO( P_API_VERSION_NUMBER => 1.0,
1617 P_INIT_MSG_LIST => FND_API.G_FALSE,
1618 P_CONFIG_HDR_ID => p_config_hdr_id,
1619 P_CONFIG_REV_NBR => p_config_rev_nbr,
1620 X_RETURN_STATUS => lx_return_status,
1621 X_MSG_COUNT => x_msg_count,
1622 X_MSG_DATA => x_msg_data);
1623
1624 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1625 aso_debug_pub.add('After call to ASO_CFG_INT.DELETE_CONFIGURATION: x_Return_Status: ' || lx_Return_Status);
1626 END IF;
1627
1628 IF lx_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1629
1630 x_return_status := lx_return_status;
1631 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1632 FND_MESSAGE.Set_Name('ASO', 'ASO_DELETE');
1633 FND_MESSAGE.Set_Token('OBJECT', 'CONFIGURATION', FALSE);
1634 FND_MSG_PUB.ADD;
1635 END IF;
1636
1637 RAISE FND_API.G_EXC_ERROR;
1638
1639 END IF;
1640
1641 else
1642 close c_config_exist_in_cz;
1643 end if;
1644
1645 ASO_UTILITY_PVT.HANDLE_EXCEPTIONS(
1646 P_API_NAME => L_API_NAME
1647 ,P_PKG_NAME => G_PKG_NAME
1648 ,P_EXCEPTION_LEVEL => FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR
1649 ,P_PACKAGE_TYPE => ASO_UTILITY_PVT.G_INT
1653
1650 ,X_MSG_COUNT => X_MSG_COUNT
1651 ,X_MSG_DATA => X_MSG_DATA
1652 ,X_RETURN_STATUS => X_RETURN_STATUS);
1654 WHEN OTHERS THEN
1655
1656 open c_config_exist_in_cz(p_config_hdr_id, p_config_rev_nbr);
1657 fetch c_config_exist_in_cz into l_old_config_hdr_id;
1658
1659 if c_config_exist_in_cz%found then
1660
1661 close c_config_exist_in_cz;
1662
1663 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1664 aso_debug_pub.add('Get_config_details: A previous version exist for this configuration so deleting it from CZ');
1665 END IF;
1666
1667 ASO_CFG_INT.DELETE_CONFIGURATION_AUTO( P_API_VERSION_NUMBER => 1.0,
1668 P_INIT_MSG_LIST => FND_API.G_FALSE,
1669 P_CONFIG_HDR_ID => p_config_hdr_id,
1670 P_CONFIG_REV_NBR => p_config_rev_nbr,
1671 X_RETURN_STATUS => lx_return_status,
1672 X_MSG_COUNT => x_msg_count,
1673 X_MSG_DATA => x_msg_data);
1674
1675 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1676 aso_debug_pub.add('After call to ASO_CFG_INT.DELETE_CONFIGURATION: x_Return_Status: ' || lx_Return_Status);
1677 END IF;
1678
1679 IF lx_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1680
1681 x_return_status := lx_return_status;
1682 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
1683 FND_MESSAGE.Set_Name('ASO', 'ASO_DELETE');
1684 FND_MESSAGE.Set_Token('OBJECT', 'CONFIGURATION', FALSE);
1685 FND_MSG_PUB.ADD;
1686 END IF;
1687
1688 RAISE FND_API.G_EXC_ERROR;
1689
1690 END IF;
1691
1692 else
1693 close c_config_exist_in_cz;
1694 end if;
1695
1696 ASO_UTILITY_PVT.HANDLE_EXCEPTIONS(
1697 P_API_NAME => L_API_NAME
1698 ,P_PKG_NAME => G_PKG_NAME
1699 ,P_EXCEPTION_LEVEL => ASO_UTILITY_PVT.G_EXC_OTHERS
1700 ,P_PACKAGE_TYPE => ASO_UTILITY_PVT.G_INT
1701 ,P_SQLCODE => SQLCODE
1702 ,P_SQLERRM => SQLERRM
1703 ,X_MSG_COUNT => X_MSG_COUNT
1704 ,X_MSG_DATA => X_MSG_DATA
1705 ,X_RETURN_STATUS => X_RETURN_STATUS);
1706
1707 END Get_Config_Details;
1708
1709
1710 -- This pricing_callback procedure needs the followings things
1711 -- The cz_prc_callback_util.root_bom_config_item_id function will always return the config_item_id of the
1712 -- root model no matter what the price_type is.
1713 PROCEDURE Pricing_Callback( p_config_session_key IN VARCHAR2,
1714 p_price_type IN VARCHAR2,
1715 x_total_price OUT NOCOPY /* file.sql.39 change */ NUMBER )
1716 IS
1717
1718 Cursor c_options is
1719 Select item_key, cz_atp_callback_util.inv_item_id_from_item_key(item_key) item_id,
1720 quantity, uom_code,substr(item_key, 1,instr( item_key, ':' ,1)-1) component_code,
1721 config_item_id
1722 from cz_pricing_structures
1723 Where configurator_session_key = p_config_session_key
1724 and item_key_type = 1;
1725
1726 Cursor c_quote_hdr_id ( p_quote_line_id NUMBER ) is
1727 select a.quote_header_id, a.price_list_id, b.org_id
1728 from aso_quote_lines_all a, aso_quote_headers_all b
1729 where a.quote_header_id = b.quote_header_id
1730 and a.quote_line_id = p_quote_line_id;
1731
1732 Cursor c_config_header_id ( p_quote_line_id NUMBER ) is
1733 Select config_header_id
1734 from aso_quote_line_details
1735 where quote_line_id = p_quote_line_id;
1736
1737 Cursor c_pricelist_id ( p_config_item_id NUMBER, p_config_header_id NUMBER ) is
1738 Select qtl.price_list_id, qtl.quote_line_id
1739 from aso_quote_lines_all qtl,
1740 aso_quote_line_details qtl_dtl
1741 where qtl.quote_line_id = qtl_dtl.quote_line_id
1742 and qtl_dtl.config_item_id = p_config_item_id
1743 and qtl_dtl.config_header_id = p_config_header_id
1744 and ref_line_id is not null;
1745
1746 Cursor c_config_line(p_quote_line_id NUMBER, p_config_header_id NUMBER) is
1747 Select quote_line_id
1748 from aso_quote_line_details
1749 where quote_line_id = p_quote_line_id
1750 and config_header_id = p_config_header_id
1751 and ref_line_id is not null;
1752
1753 Cursor c_get_pricing_structure(p_session_key VARCHAR2) is
1754 select list_price,selling_price,config_item_id
1755 from cz_pricing_structures
1756 where configurator_session_key = p_session_key;
1757
1758 Cursor c_charge_periodicity_code(p_inventory_item_id number, p_organization_id number) is
1759 select charge_periodicity_code
1760 from mtl_system_items_b
1761 where inventory_item_id = p_inventory_item_id
1762 and organization_id = p_organization_id;
1763
1764 l_pricing_control_rec ASO_PRICING_INT.Pricing_Control_rec_Type;
1765 l_qte_header_rec ASO_QUOTE_PUB.Qte_Header_Rec_Type;
1769 l_hd_price_attr_rec ASO_QUOTE_PUB.Price_Attributes_Rec_Type;
1766 l_hd_shipment_rec ASO_QUOTE_PUB.Shipment_Rec_Type;
1767 l_hd_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
1768 l_hd_price_attr_tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
1770 l_qte_line_rec ASO_QUOTE_PUB.Qte_Line_Rec_Type;
1771 l_qte_line_tbl ASO_QUOTE_PUB.Qte_Line_Tbl_Type;
1772 l_qte_line_dtl_rec ASO_QUOTE_PUB.Qte_Line_Dtl_Rec_Type;
1773 l_qte_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type;
1774 l_l_qte_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type;
1775 l_ln_shipment_rec ASO_QUOTE_PUB.Shipment_Rec_Type;
1776 l_ln_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
1777 l_l_ln_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
1778 l_ln_price_attr_tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
1779 l_l_ln_price_attr_tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
1780 l_ln_price_attr_rec ASO_QUOTE_PUB.Price_Attributes_rec_Type;
1781 l_price_adj_tbl ASO_QUOTE_PUB.Price_Adj_Tbl_Type;
1782 l_l_price_adj_tbl ASO_QUOTE_PUB.Price_Adj_Tbl_Type;
1783 l_line_rltship_tbl ASO_QUOTE_PUB.Line_Rltship_Tbl_Type;
1784
1785 lx_qte_header_rec ASO_QUOTE_PUB.Qte_Header_Rec_Type;
1786 lx_qte_line_tbl ASO_QUOTE_PUB.Qte_Line_Tbl_Type;
1787 lx_qte_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type;
1788 lx_price_adj_tbl ASO_QUOTE_PUB.Price_Adj_Tbl_Type;
1789 lx_price_adj_attr_tbl ASO_QUOTE_PUB.Price_Adj_Attr_Tbl_Type;
1790 lx_price_adj_rltship_tbl ASO_QUOTE_PUB.Price_Adj_Rltship_Tbl_Type;
1791
1792 lx_return_status VARCHAR2(1);
1793 lx_msg_count NUMBER;
1794 lx_msg_data VARCHAR2(2000);
1795
1796 l_model_quote_line_id NUMBER;
1797 l_quote_line_id NUMBER;
1798 l_c_quote_line_id NUMBER;
1799 l_quote_header_id NUMBER;
1800 l_model_price_list_id NUMBER;
1801 i NUMBER;
1802 record_count1 NUMBER := 0;
1803 l_line_price_list_id NUMBER;
1804 l_file VARCHAR2(200);
1805 l_mymsg VARCHAR2(2000);
1806 l_root_model_config_item_id NUMBER;
1807 l_config_header_id NUMBER;
1808 l_count NUMBER := 0;
1809 l_org_id NUMBER;
1810 l_master_organization_id NUMBER;
1811
1812 Begin
1813 /*
1814 aso_debug_pub.g_debug_flag := 'Y';
1815 aso_debug_pub.SetDebugLevel(10);
1816 aso_debug_pub.Initialize;
1817 l_file := ASO_DEBUG_PUB.Set_Debug_Mode('FILE');
1818 aso_debug_pub.debug_on;
1819 */
1820
1821 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1822
1823 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: Start %%%%%%%%%%%%%%%%%%%%' , 1, 'Y' );
1824 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: p_config_session_key: '|| p_config_session_key);
1825 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: p_price_type: '|| p_price_type);
1826
1827 END IF;
1828
1829 -- Store the derived model item quote_line_id from the p_config_session_key for subsequent use
1830
1831 l_model_quote_line_id := to_number( substr(p_config_session_key, 1,instr( p_config_session_key, '-') - 1));
1832
1833 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1834 aso_debug_pub.add('PRICING CALLBACK: l_model_quote_line_id: ' || l_model_quote_line_id);
1835 END IF;
1836
1837 OPEN c_quote_hdr_id( l_model_quote_line_id );
1838 FETCH c_quote_hdr_id into l_quote_header_id, l_model_price_list_id, l_org_id;
1839
1840 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1841 aso_debug_pub.add('PRICING CALLBACK: l_quote_header_id: ' || l_quote_header_id);
1842 aso_debug_pub.add('PRICING CALLBACK: l_model_price_list_id: ' || l_model_price_list_id);
1843 aso_debug_pub.add('PRICING CALLBACK: l_org_id: ' || l_org_id);
1844 END IF;
1845
1846 IF c_quote_hdr_id%FOUND THEN
1847
1848 l_qte_header_rec := ASO_UTILITY_PVT.Query_Header_Row ( l_quote_header_id );
1849
1850 -- The following function returns all other rows of the quote which do not belong to
1851 -- this configuration plus the model line itself
1852
1853 l_qte_line_tbl := Query_Qte_Line_Rows( l_quote_header_id,l_model_quote_line_id );
1854
1855 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1856 aso_debug_pub.add('PRICING CALLBACK: After call to Query_Qte_Line_Rows');
1857 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_tbl.count: '|| l_qte_line_tbl.count);
1858 END IF;
1859
1860 l_master_organization_id := oe_sys_parameters.value(param_name => 'MASTER_ORGANIZATION_ID', p_org_id => l_org_id);
1861
1862 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1863 aso_debug_pub.add('PRICING CALLBACK: l_master_organization_id: ' || l_master_organization_id);
1864 END IF;
1865
1866 ELSE
1867
1868 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1869 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: c_quote_hdr_id NOT FOUND.');
1870 END IF;
1871
1872 END IF;
1873
1874 CLOSE c_quote_hdr_id;
1875
1876 --Get the config_header_id of the model line. The config_header_id will be null in
1877 --case it is first time configuration
1878
1879 OPEN c_config_header_id( l_model_quote_line_id );
1883 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1880 FETCH c_config_header_id into l_config_header_id;
1881 CLOSE c_config_header_id;
1882
1884 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: l_config_header_id: ' || l_config_header_id);
1885 END IF;
1886
1887 IF p_price_type = cz_prc_callback_util.g_prc_type_list THEN
1888
1889 FOR row IN C_options LOOP
1890
1891 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1892
1893 aso_debug_pub.add( 'PRICING CALLBACK: item_key: ' || row.item_key);
1894 aso_debug_pub.add( 'PRICING CALLBACK: (inv) item_id: ' || row.item_id);
1895 aso_debug_pub.add( 'PRICING CALLBACK: quantity: ' || row.quantity);
1896 aso_debug_pub.add( 'PRICING CALLBACK: uom_code: ' || row.uom_code);
1897 aso_debug_pub.add( 'PRICING CALLBACK: component_code: ' || row.component_code);
1898 aso_debug_pub.add( 'PRICING CALLBACK: config_item_id: ' || row.config_item_id);
1899
1900 END IF;
1901
1902 record_count1 := record_count1 + 1;
1903
1904 l_qte_line_tbl(record_count1).inventory_item_id := row.item_id;
1905 l_qte_line_tbl(record_count1).quantity := row.quantity;
1906 l_qte_line_tbl(record_count1).uom_code := row.uom_code;
1907 l_qte_line_dtl_tbl(record_count1).config_item_id := row.config_item_id;
1908
1909 open c_charge_periodicity_code(row.item_id, l_master_organization_id);
1910 fetch c_charge_periodicity_code into l_qte_line_tbl(record_count1).charge_periodicity_code;
1911 close c_charge_periodicity_code;
1912
1913 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1914 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_tbl('|| record_count1 ||').charge_periodicity_code: '|| l_qte_line_tbl(record_count1).charge_periodicity_code);
1915 End if;
1916
1917 IF l_config_header_id IS NOT NULL THEN
1918
1919 OPEN c_pricelist_id(row.config_item_id, l_config_header_id);
1920 FETCH c_pricelist_id into l_line_price_list_id, l_quote_line_id;
1921
1922 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1923 aso_debug_pub.add('PRICING CALLBACK: l_line_price_list_id: ' || l_line_price_list_id);
1924 aso_debug_pub.add('PRICING CALLBACK: l_quote_line_id: ' || l_quote_line_id);
1925 END IF;
1926
1927 IF c_pricelist_id%FOUND THEN
1928
1929 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1930 aso_debug_pub.add('PRICING CALLBACK: Inside c_pricelist_id cursor FOUND');
1931 END IF;
1932
1933 IF l_line_price_list_id IS NOT NULL THEN
1934 l_qte_line_tbl(record_count1).price_list_id := l_line_price_list_id;
1935 ELSE
1936 l_qte_line_tbl(record_count1).price_list_id := l_model_price_list_id;
1937 END IF;
1938
1939 l_qte_line_tbl(record_count1).quote_line_id := l_quote_line_id;
1940
1941 ELSE
1942
1943 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1944 aso_debug_pub.add('PRICING CALLBACK: Inside ELSE c_pricelist_id cursor FOUND');
1945 END IF;
1946
1947 l_qte_line_tbl(record_count1).quote_line_id := 0;
1948 l_qte_line_tbl(record_count1).price_list_id := l_model_price_list_id;
1949
1950 END IF;
1951
1952 CLOSE c_pricelist_id;
1953
1954 ELSE
1955
1956 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1957 aso_debug_pub.add('PRICING CALLBACK: Inside ELSE l_config_header_id IS NOT NULL');
1958 END IF;
1959
1960 l_qte_line_tbl(record_count1).quote_line_id := 0;
1961 l_qte_line_tbl(record_count1).price_list_id := l_model_price_list_id;
1962
1963 END IF;
1964
1965 END LOOP;
1966
1967 l_pricing_control_rec.request_type := 'ASO';
1968 l_pricing_control_rec.pricing_event := 'PRICE';
1969 l_pricing_control_rec.price_mode := 'QUOTE_LINE';
1970
1971 ELSE
1972
1973 -- Get the config_item_id of the root model
1974 l_root_model_config_item_id := cz_prc_callback_util.root_bom_config_item_id(p_config_session_key);
1975
1976 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1977 aso_debug_pub.add( 'ASO_CFG_INT: PRICING CALLBACK: l_root_model_config_item_id: ' || l_root_model_config_item_id);
1978 END IF;
1979
1980 record_count1 := l_qte_line_tbl.count;
1981 l_count := l_qte_line_tbl.count;
1982
1983 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1984 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: l_count: ' || l_count);
1985 END IF;
1986
1987 FOR row IN C_options LOOP
1988
1989 IF aso_debug_pub.g_debug_flag = 'Y' THEN
1990
1991 aso_debug_pub.add( 'PRICING CALLBACK: item_key: ' || row.item_key);
1992 aso_debug_pub.add( 'PRICING CALLBACK: (inv) item_id: ' || row.item_id);
1993 aso_debug_pub.add( 'PRICING CALLBACK: quantity: ' || row.quantity);
1994 aso_debug_pub.add( 'PRICING CALLBACK: uom_code: ' || row.uom_code);
1998 END IF;
1995 aso_debug_pub.add( 'PRICING CALLBACK: component_code: ' || row.component_code);
1996 aso_debug_pub.add( 'PRICING CALLBACK: config_item_id: ' || row.config_item_id);
1997
1999
2000 IF row.config_item_id <> l_root_model_config_item_id THEN
2001
2002 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2003 aso_debug_pub.add('PRICING CALLBACK: It is a child line');
2004 END IF;
2005
2006 record_count1 := record_count1 + 1;
2007
2008 l_qte_line_tbl(record_count1).inventory_item_id := row.item_id;
2009 l_qte_line_tbl(record_count1).quantity := row.quantity;
2010 l_qte_line_tbl(record_count1).uom_code := row.uom_code;
2011 l_qte_line_dtl_tbl(record_count1).config_item_id := row.config_item_id;
2012
2013 IF l_config_header_id IS NOT NULL THEN
2014
2015 OPEN c_pricelist_id(row.config_item_id, l_config_header_id);
2016 FETCH c_pricelist_id into l_line_price_list_id, l_quote_line_id;
2017
2018 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2019 aso_debug_pub.add('PRICING CALLBACK: l_line_price_list_id: ' || l_line_price_list_id);
2020 aso_debug_pub.add('PRICING CALLBACK: l_quote_line_id: ' || l_quote_line_id);
2021 END IF;
2022
2023 IF c_pricelist_id%FOUND THEN
2024
2025 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2026 aso_debug_pub.add('PRICING CALLBACK: Inside c_pricelist_id cursor FOUND');
2027 END IF;
2028
2029 IF l_line_price_list_id IS NOT NULL THEN
2030 l_qte_line_tbl(record_count1).price_list_id := l_line_price_list_id;
2031 ELSE
2032 l_qte_line_tbl(record_count1).price_list_id := l_model_price_list_id;
2033 END IF;
2034 l_qte_line_tbl(record_count1).quote_line_id := l_quote_line_id;
2035
2036 ELSE
2037
2038 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2039 aso_debug_pub.add('PRICING CALLBACK: Inside ELSE c_pricelist_id cursor FOUND');
2040 END IF;
2041
2042 l_qte_line_tbl(record_count1).quote_line_id := 0;
2043 l_qte_line_tbl(record_count1).price_list_id := l_model_price_list_id;
2044
2045 END IF;
2046
2047 CLOSE c_pricelist_id;
2048
2049 ELSE
2050
2051 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2052 aso_debug_pub.add('PRICING CALLBACK: Inside ELSE l_config_header_id IS NOT NULL');
2053 END IF;
2054
2055 l_qte_line_tbl(record_count1).quote_line_id := 0;
2056 l_qte_line_tbl(record_count1).price_list_id := l_model_price_list_id;
2057
2058 END IF;
2059
2060 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2061 aso_debug_pub.add('PRICING CALLBACK: It is a child line: After populating the child line information');
2062 END IF;
2063
2064 ELSE
2065
2066 record_count1 := record_count1 + 1;
2067 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2068 aso_debug_pub.add('PRICING CALLBACK: ELSE cond of row.config_item_id <> l_root_model_config_item_id: It is model line');
2069 END IF;
2070
2071 l_qte_line_tbl(record_count1).inventory_item_id := row.item_id;
2072 l_qte_line_tbl(record_count1).quantity := row.quantity;
2073 l_qte_line_tbl(record_count1).uom_code := row.uom_code;
2074 l_qte_line_tbl(record_count1).price_list_id := l_model_price_list_id;
2075 l_qte_line_tbl(record_count1).quote_line_id := l_model_quote_line_id;
2076 l_qte_line_dtl_tbl(record_count1).config_item_id := row.config_item_id;
2077
2078 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2079 aso_debug_pub.add('PRICING CALLBACK: It is model line: After populating the model information');
2080 END IF;
2081
2082 END IF;
2083
2084 open c_charge_periodicity_code(row.item_id, l_master_organization_id);
2085 fetch c_charge_periodicity_code into l_qte_line_tbl(record_count1).charge_periodicity_code;
2086 close c_charge_periodicity_code;
2087
2088 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2089 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_tbl('|| record_count1 ||').charge_periodicity_code: '|| l_qte_line_tbl(record_count1).charge_periodicity_code);
2090 End if;
2091
2092 END LOOP;
2093
2094 l_pricing_control_rec.request_type := 'ASO';
2095 l_pricing_control_rec.pricing_event := 'BATCH';
2096 l_pricing_control_rec.price_mode := 'ENTIRE_QUOTE';
2097
2098 END IF;
2099
2100 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2101
2102 aso_debug_pub.add('PRICING CALLBACK: After C_options cursor loop: l_qte_line_tbl.count: '||l_qte_line_tbl.count);
2103
2107 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_tbl('||i||').inventory_item_id: '|| l_qte_line_tbl(i).inventory_item_id);
2104 FOR i IN 1..l_qte_line_tbl.count LOOP
2105
2106 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_tbl('||i||').quote_line_id: '|| l_qte_line_tbl(i).quote_line_id);
2108 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_tbl('||i||').quantity: '|| l_qte_line_tbl(i).quantity);
2109 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_tbl('||i||').uom_code: '|| l_qte_line_tbl(i).uom_code);
2110 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_tbl('||i||').price_list_id: '|| l_qte_line_tbl(i).price_list_id);
2111 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_tbl('||i||').charge_periodicity_code: '|| l_qte_line_tbl(i).charge_periodicity_code);
2112 --aso_debug_pub.add('PRICING CALLBACK: l_qte_line_dtl_tbl('||i||').config_item_id:'|| l_qte_line_dtl_tbl(i).config_item_id);
2113
2114 END LOOP;
2115
2116 END IF;
2117
2118 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2119
2120 aso_debug_pub.add('PRICING CALLBACK: After C_options cursor loop: l_qte_line_dtl_tbl.count: '||l_qte_line_dtl_tbl.count);
2121
2122 FOR i IN 1..l_qte_line_dtl_tbl.count LOOP
2123
2124 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_dtl_tbl('||i||').config_item_id:'|| l_qte_line_dtl_tbl(i).config_item_id);
2125
2126 END LOOP;
2127
2128 END IF;
2129
2130 --Set the control record parameter values
2131
2132 l_pricing_control_rec.price_config_flag := 'Y';
2133
2134 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2135
2136 aso_debug_pub.add('l_pricing_control_rec.request_type: '||l_pricing_control_rec.request_type);
2137 aso_debug_pub.add('l_pricing_control_rec.pricing_event: '||l_pricing_control_rec.pricing_event);
2138 aso_debug_pub.add('l_pricing_control_rec.price_mode: '||l_pricing_control_rec.price_mode);
2139 aso_debug_pub.add('l_pricing_control_rec.price_config_flag: '||l_pricing_control_rec.price_config_flag);
2140
2141 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: Before call to ASO_PRICING_INT.Pricing_Order');
2142
2143 END IF;
2144
2145 ASO_PRICING_INT.Pricing_Order(
2146 P_Api_Version_Number => 1.0,
2147 P_Init_Msg_List => FND_API.G_TRUE,
2148 P_Commit => FND_API.G_FALSE,
2149 p_control_rec => l_pricing_control_rec,
2150 p_qte_header_rec => l_qte_header_rec,
2151 p_hd_shipment_rec => l_hd_shipment_rec,
2152 p_hd_price_attr_tbl => l_hd_price_attr_tbl,
2153 p_qte_line_tbl => l_qte_line_tbl,
2154 p_line_rltship_tbl => l_line_rltship_tbl,
2155 p_qte_line_dtl_tbl => l_l_qte_line_dtl_tbl,
2156 p_ln_shipment_tbl => l_l_ln_shipment_tbl,
2157 p_ln_price_attr_tbl => l_l_ln_price_attr_tbl,
2158 --p_price_adj_tbl => l_l_price_adj_tbl,
2159 x_qte_header_rec => lx_qte_header_rec,
2160 x_qte_line_tbl => lx_qte_line_tbl,
2161 x_qte_line_dtl_tbl => lx_qte_line_dtl_tbl,
2162 x_price_adj_tbl => lx_price_adj_tbl,
2163 x_price_adj_attr_tbl => lx_price_adj_attr_tbl,
2164 x_price_adj_rltship_tbl => lx_price_adj_rltship_tbl,
2165 x_return_status => lx_return_status ,
2166 x_msg_count => lx_msg_count,
2167 x_msg_data => lx_msg_data
2168 );
2169
2170 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2171
2172 aso_debug_pub.add('PRICING CALLBACK: After call to ASO_PRICING_INT.Pricing_Order');
2173 aso_debug_pub.add('PRICING CALLBACK: lx_return_status: '|| lx_return_status);
2174 aso_debug_pub.add('PRICING CALLBACK: lx_msg_count: '|| lx_msg_count);
2175 aso_debug_pub.add('PRICING CALLBACK: lx_msg_data: '|| lx_msg_data);
2176 aso_debug_pub.add('PRICING CALLBACK: lx_qte_line_tbl.count: '|| lx_qte_line_tbl.count);
2177
2178 END IF;
2179
2180 IF lx_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2181
2182 fnd_msg_pub.count_and_get( p_encoded => 'F',
2183 p_count => lx_msg_count,
2184 p_data => lx_msg_data);
2185
2186 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2187
2188 aso_debug_pub.add('PRICING CALLBACK: After call to fnd_msg_pub.count_and_get');
2189 aso_debug_pub.add('PRICING CALLBACK: lx_msg_count: '|| lx_msg_count);
2190 aso_debug_pub.add('PRICING CALLBACK: lx_msg_data: '|| lx_msg_data);
2191
2192 END IF;
2193
2194 FOR k IN 1 .. lx_msg_count LOOP
2195
2196 lx_msg_data := fnd_msg_pub.get( p_msg_index => k,
2197 p_encoded => 'F');
2198
2199 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2200 aso_debug_pub.add('PRICING CALLBACK: Inside Loop fnd_msg_pub.get: lx_msg_data: ' ||lx_msg_data);
2201 END IF;
2202
2203 l_mymsg := l_mymsg || ' ' || lx_msg_data;
2204
2205 END LOOP;
2206
2207 END IF;
2208
2209 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2210 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: l_mymsg: ' || l_mymsg);
2211 END IF;
2212
2213 -- set the error message in the model line msg_data field of cz_pricing_structure
2214
2218 aso_debug_pub.add('PRICING CALLBACK: Inside IF condition lx_return_status <> FND_API.G_RET_STS_SUCCESS');
2215 IF lx_return_status <> FND_API.G_RET_STS_SUCCESS AND p_price_type <> 'LIST' THEN
2216
2217 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2219 END IF;
2220
2221 UPDATE CZ_PRICING_STRUCTURES
2222 SET MSG_DATA = l_mymsg
2223 WHERE configurator_session_key = p_config_session_key;
2224 --AND config_item_id = l_root_model_config_item_id;
2225
2226 END IF;
2227
2228 -- Assuming that the ASO_PRICING_INT.Pricing_Order will return the same number of lines send as input.
2229 -- That means the l_qte_line_tbl and lx_qte_line_tbl will have same count and order else the update of
2230 -- in cz_pricing_structure will have incorrect result.
2231
2232 FOR i IN l_count+1..lx_qte_line_tbl.count LOOP
2233
2234
2235 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2236
2237 aso_debug_pub.add('PRICING CALLBACK: Inside Loop IF quote_line_id = 0');
2238 aso_debug_pub.add('PRICING CALLBACK: lx_qte_line_tbl('||i||').quote_line_id: '|| lx_qte_line_tbl(i).quote_line_id);
2239 aso_debug_pub.add('PRICING CALLBACK: lx_qte_line_tbl('||i||').line_list_price: '|| lx_qte_line_tbl(i).line_list_price);
2240 aso_debug_pub.add('PRICING CALLBACK: lx_qte_line_tbl('||i||').line_quote_price: '|| lx_qte_line_tbl(i).line_quote_price);
2241 aso_debug_pub.add('PRICING CALLBACK: l_count: '|| l_count);
2242 --aso_debug_pub.add('PRICING CALLBACK: l_qte_line_dtl_tbl('|| i - l_count||').config_item_id: '|| l_qte_line_dtl_tbl(i - l_count).config_item_id);
2243 aso_debug_pub.add('PRICING CALLBACK: l_qte_line_dtl_tbl('|| i||').config_item_id: '|| l_qte_line_dtl_tbl(i
2244 - l_count).config_item_id);
2245
2246 END IF;
2247
2248 UPDATE CZ_PRICING_STRUCTURES
2249 SET selling_price = lx_qte_line_tbl(i).LINE_QUOTE_PRICE,
2250 list_price = lx_qte_line_tbl(i).line_list_price
2251 WHERE configurator_session_key = p_config_session_key
2252 AND config_item_id = l_qte_line_dtl_tbl(i - l_count).config_item_id;
2253
2254 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2255 aso_debug_pub.add('PRICING CALLBACK: After Update sql%rowcount: '|| sql%rowcount);
2256 END IF;
2257
2258 END LOOP;
2259
2260 BEGIN
2261
2262 SELECT sum(selling_price) INTO x_total_price
2263 FROM CZ_PRICING_STRUCTURES
2264 WHERE configurator_session_key = p_config_session_key;
2265
2266 EXCEPTION
2267
2268 WHEN OTHERS THEN
2269
2270 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2271 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: Inside When Others Exception for select sum(selling_price)');
2272 END IF;
2273
2274 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2275
2276 END;
2277
2278
2279 -- Writing Data from CZ table to ASO Debug File
2280
2281 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2282
2283 FOR row IN c_get_pricing_structure(p_config_session_key) LOOP
2284
2285 aso_debug_pub.add('PRICING CALLBACK: Data in CZ_PRICING_STRUCTURES table after update to list and selling prices columns.');
2286 aso_debug_pub.add('PRICING CALLBACK: CZ_PRICING_STRUCTURES: config_item_id: ' || row.config_item_id);
2287 aso_debug_pub.add('PRICING CALLBACK: CZ_PRICING_STRUCTURES: list_price: ' || row.list_price);
2288 aso_debug_pub.add('PRICING CALLBACK: CZ_PRICING_STRUCTURES: selling_price: ' || row.selling_price);
2289
2290 END LOOP;
2291
2292 END IF;
2293
2294
2295 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2296 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK End %%%%%%%%%%%%%%%%%%%%', 1, 'Y' );
2297 END IF;
2298
2299
2300 EXCEPTION
2301
2302 WHEN OTHERS THEN
2303
2304 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2305 aso_debug_pub.add('ASO_CFG_INT: PRICING CALLBACK: Inside When Others Exception');
2306 END IF;
2307
2308 -- set the error message in the model line msg_data field of cz_pricing_structure
2309 UPDATE CZ_PRICING_STRUCTURES
2310 SET MSG_DATA = lx_msg_data
2311 WHERE configurator_session_key = p_config_session_key;
2312 --AND config_item_id = l_root_model_config_item_id;
2313
2314 END Pricing_Callback;
2315
2316
2317
2318 -- This function returns all the quote lines which belong to the given quote but not belong
2319 -- to the given configuration plus the root model line of the configuration
2320
2321 FUNCTION Query_Qte_Line_Rows (
2322 P_Qte_Header_Id IN NUMBER,
2323 p_qte_line_id IN NUMBER
2324 ) RETURN ASO_QUOTE_PUB.Qte_Line_Tbl_Type
2325 IS
2326
2327 cursor c_qte_line is
2328 select quote_line_id,
2329 inventory_item_id,
2330 quantity,
2331 uom_code,
2332 price_list_id,
2333 charge_periodicity_code
2334 from aso_quote_lines_all
2335 where quote_header_id = p_qte_header_id
2336 and quote_line_id not in ( select a.quote_line_id
2337 from aso_quote_line_details a
2338 where (a.config_header_id, a.config_revision_num)
2342 and quote_line_id <> p_qte_line_id;
2339 = ( select config_header_id, config_revision_num
2340 from aso_quote_line_details
2341 where quote_line_id = p_qte_line_id ))
2343
2344
2345 l_Qte_Line_rec ASO_QUOTE_PUB.Qte_Line_Rec_Type;
2346 l_Qte_Line_tbl ASO_QUOTE_PUB.Qte_Line_Tbl_Type;
2347
2348 l_index NUMBER := 0;
2349
2350 BEGIN
2351
2352 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2353 aso_debug_pub.add('ASO_CFG_INT: Query_Qte_Line_Rows: P_Qte_Header_Id: '|| P_Qte_Header_Id);
2354 aso_debug_pub.add('ASO_CFG_INT: Query_Qte_Line_Rows: p_qte_line_id : '|| p_qte_line_id );
2355 END IF;
2356
2357 FOR line_rec IN c_Qte_Line LOOP
2358
2359 l_qte_line_rec.QUOTE_LINE_ID := line_rec.QUOTE_LINE_ID;
2360 l_qte_line_rec.INVENTORY_ITEM_ID := line_rec.INVENTORY_ITEM_ID;
2361 l_qte_line_rec.QUANTITY := line_rec.QUANTITY;
2362 l_qte_line_rec.UOM_CODE := line_rec.UOM_CODE;
2363 l_qte_line_rec.PRICE_LIST_ID := line_rec.PRICE_LIST_ID;
2364 l_qte_line_rec.charge_periodicity_code := line_rec.charge_periodicity_code;
2365
2366 l_index := l_index + 1;
2367
2368 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2369
2370 aso_debug_pub.add('Query_Qte_Line_Rows: line_rec.QUOTE_LINE_ID: '|| line_rec.QUOTE_LINE_ID);
2371 aso_debug_pub.add('Query_Qte_Line_Rows: line_rec.QUANTITY: '|| line_rec.QUANTITY);
2372 aso_debug_pub.add('Query_Qte_Line_Rows: line_rec.UOM_CODE: '|| line_rec.UOM_CODE);
2373 aso_debug_pub.add('Query_Qte_Line_Rows: line_rec.PRICE_LIST_ID: '|| line_rec.PRICE_LIST_ID);
2374 aso_debug_pub.add('Query_Qte_Line_Rows: line_rec.INVENTORY_ITEM_ID: '|| line_rec.INVENTORY_ITEM_ID);
2375 aso_debug_pub.add('Query_Qte_Line_Rows: line_rec.charge_periodicity_code: '|| line_rec.charge_periodicity_code);
2376
2377 END IF;
2378
2379 l_Qte_Line_tbl(l_index) := l_Qte_Line_rec;
2380
2381 END LOOP;
2382
2383 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2384 aso_debug_pub.add('ASO_CFG_INT: Query_Qte_Line_Rows: l_Qte_Line_tbl.count: '|| l_Qte_Line_tbl.count);
2385 END IF;
2386
2387 RETURN l_Qte_Line_tbl;
2388
2389 END Query_Qte_Line_Rows;
2390
2391
2392 /*-------------------------------------------------------------------------
2393 Procedure Name : Create_hdr_xml
2394 Description : creates a batch validation header message.
2395 --------------------------------------------------------------------------*/
2396
2397 PROCEDURE Create_hdr_xml
2398 ( p_model_line_id IN NUMBER,
2399 x_xml_hdr OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
2400 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
2401 IS
2402
2403 Cursor C_org_id (p_quote_header_id NUMBER) is
2404 select org_id from aso_quote_headers_all
2405 where quote_header_id = p_quote_header_id;
2406
2407 Cursor c_inv_org_id (p_quote_line_id NUMBER) is
2408 select organization_id from aso_quote_lines_all
2409 where quote_line_id = p_quote_line_id;
2410
2411 TYPE param_name_type IS TABLE OF VARCHAR2(25)
2412 INDEX BY BINARY_INTEGER;
2413
2414 TYPE param_value_type IS TABLE OF VARCHAR2(255)
2415 INDEX BY BINARY_INTEGER;
2416
2417 param_name param_name_type;
2418 param_value param_value_type;
2419
2420 l_rec_index BINARY_INTEGER;
2421
2422 l_model_line_rec ASO_QUOTE_PUB.Qte_Line_Rec_Type;
2423 l_model_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type;
2424 l_org_id NUMBER;
2425
2426 --Configurator specific params
2427 l_calling_application_id VARCHAR2(30);
2428 l_responsibility_id VARCHAR2(30);
2429 l_database_id VARCHAR2(255);
2430 l_read_only VARCHAR2(30) := null;
2431 l_save_config_behavior VARCHAR2(30) := 'new_revision';
2432 l_ui_type VARCHAR2(30) := null;
2433 l_msg_behavior VARCHAR2(30) := 'brief';
2434 l_icx_session_ticket VARCHAR2(200);
2435
2436 --Order Capture specific parameters
2437 l_context_org_id VARCHAR2(30);
2438 l_config_creation_date VARCHAR2(30);
2439 l_inventory_item_id VARCHAR2(30);
2440 l_config_header_id VARCHAR2(30);
2441 l_config_rev_nbr VARCHAR2(30);
2442 l_model_quantity VARCHAR2(30);
2443 l_count NUMBER;
2444 --l_validation_org_id NUMBER;
2445
2446 --message related
2447 l_xml_hdr VARCHAR2(2000):= '<initialize>';
2448 l_dummy VARCHAR2(500) := NULL;
2449
2450 BEGIN
2451 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2452 aso_debug_pub.add('Create_hdr_xml Begins.', 1, 'Y');
2453 END IF;
2454
2455 --Initialize API return status to SUCCESS
2456 x_return_status := FND_API.G_RET_STS_SUCCESS;
2457
2461 aso_debug_pub.add('Create_hdr_xml: After call to aso_utility_pvt.Query_Qte_Line_Row');
2458 l_model_line_rec := aso_utility_pvt.Query_Qte_Line_Row( P_Qte_Line_Id => p_model_line_id );
2459
2460 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2462 END IF;
2463
2464 l_model_line_dtl_tbl := aso_utility_pvt.Query_Line_Dtl_Rows( P_Qte_Line_Id => p_model_line_id );
2465
2466 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2467 aso_debug_pub.add('Create_hdr_xml: After call to aso_utility_pvt.Query_Line_Dtl_Rows');
2468 END IF;
2469
2470 /* Fix for bug 3998564 */
2471 --OPEN C_org_id( l_model_line_rec.quote_header_id);
2472 --FETCH C_org_id INTO l_org_id;
2473 --CLOSE C_org_id;
2474 OPEN c_inv_org_id( l_model_line_rec.quote_line_id);
2475 FETCH c_inv_org_id INTO l_org_id;
2476 CLOSE c_inv_org_id;
2477 /* End of fix for bug 3998564 */
2478
2479 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2480 aso_debug_pub.add('Create_hdr_xml: After C_org_id cursor: l_org_id: '|| l_org_id, 1, 'N');
2481 END IF;
2482
2483 IF l_org_id IS NULL THEN
2484
2485 --Commented Code Start Yogeshwar(MOAC)
2486 /* IF SUBSTRB(USERENV('CLIENT_INFO'),1 ,1) = ' ' THEN
2487 l_org_id := NULL;
2488 ELSE
2489 l_org_id := TO_NUMBER(SUBSTRB(USERENV('CLIENT_INFO'), 1,10));
2490 END IF;
2491 */
2492 --Commented Code End Yogeshwar (MOAC)
2493
2494 L_org_id := l_model_line_rec.org_id; --New Code Yogeshwar MOAC
2495
2496 END IF;
2497
2498 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2499 aso_debug_pub.add('Create_hdr_xml: After Defaulting from client info. l_org_id: '|| l_org_id);
2500 END IF;
2501
2502 --Set the values from model_line_rec, model_line_dtl_tbl and org_id
2503 l_context_org_id := to_char(l_org_id);
2504 l_inventory_item_id := to_char(l_model_line_rec.inventory_item_id);
2505 l_config_header_id := to_char(l_model_line_dtl_tbl(1).config_header_id);
2506 l_config_rev_nbr := to_char(l_model_line_dtl_tbl(1).config_revision_num);
2507 l_config_creation_date := to_char(l_model_line_rec.creation_date,'MM-DD-YYYY-HH24-MI-SS');
2508 l_model_quantity := to_char(l_model_line_rec.quantity);
2509
2510 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2511
2512 aso_debug_pub.add('Create_hdr_xml: l_context_org_id :' || l_context_org_id);
2513 aso_debug_pub.add('Create_hdr_xml: l_inventory_item_id :' || l_inventory_item_id);
2514 aso_debug_pub.add('Create_hdr_xml: l_config_header_id :' || l_config_header_id);
2515 aso_debug_pub.add('Create_hdr_xml: l_config_rev_nbr :' || l_config_rev_nbr);
2516 aso_debug_pub.add('Create_hdr_xml: l_config_creation_date:' || l_config_creation_date);
2517 aso_debug_pub.add('Create_hdr_xml: l_model_quantity :' || l_model_quantity);
2518
2519 END IF;
2520
2521 -- Set values from profiles and env. variables.
2522 l_calling_application_id := fnd_global.resp_appl_id;
2523 l_responsibility_id := fnd_global.resp_id;
2524 l_database_id := fnd_web_config.database_id;
2525 l_icx_session_ticket := cz_cf_api.icx_session_ticket;
2526
2527 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2528
2529 aso_debug_pub.add('Create_hdr_xml: l_calling_application_id:' || l_calling_application_id);
2530 aso_debug_pub.add('Create_hdr_xml: l_responsibility_id :' || l_responsibility_id);
2531 aso_debug_pub.add('Create_hdr_xml: l_database_id :' || l_database_id);
2532 aso_debug_pub.add('Create_hdr_xml: l_icx_session_ticket :' || l_icx_session_ticket);
2533
2534 END IF;
2535
2536 -- set param_names
2537 param_name(1) := 'database_id';
2538 param_name(2) := 'context_org_id';
2539 param_name(3) := 'config_creation_date';
2540 param_name(4) := 'calling_application_id';
2541 param_name(5) := 'responsibility_id';
2542 param_name(6) := 'model_id';
2543 param_name(7) := 'config_header_id';
2544 param_name(8) := 'config_rev_nbr';
2545 param_name(9) := 'read_only';
2546 param_name(10) := 'save_config_behavior';
2547 --param_name(11) := 'ui_type';
2548 --param_name(12) := 'validation_org_id';
2549 param_name(11) := 'terminate_msg_behavior';
2550 param_name(12) := 'model_quantity';
2551 param_name(13) := 'icx_session_ticket';
2552
2553 l_count := 13;
2554
2555 -- set parameter values
2556
2557 param_value(1) := l_database_id;
2558 param_value(2) := l_context_org_id;
2559 param_value(3) := l_config_creation_date;
2560 param_value(4) := l_calling_application_id;
2561 param_value(5) := l_responsibility_id;
2562 param_value(6) := l_inventory_item_id;
2563 param_value(7) := l_config_header_id;
2564 param_value(8) := l_config_rev_nbr;
2565 param_value(9) := l_read_only;
2566 param_value(10) := l_save_config_behavior;
2567 --param_value(11) := l_ui_type;
2568 --param_value(12) := l_validation_org_id;
2569 param_value(11) := l_msg_behavior;
2570 param_value(12) := l_model_quantity;
2571 param_value(13) := l_icx_session_ticket;
2572
2573 l_rec_index := 1;
2574
2575 LOOP
2576 -- ex : <param name="config_header_id">1890</param>
2577
2578 IF (param_value(l_rec_index) IS NOT NULL) THEN
2582 ||'>'|| param_value(l_rec_index) ||
2579
2580 l_dummy := '<param name=' ||
2581 '"' || param_name(l_rec_index) || '"'
2583 '</param>';
2584
2585 l_xml_hdr := l_xml_hdr || l_dummy;
2586
2587 END IF;
2588
2589 l_dummy := NULL;
2590
2591 l_rec_index := l_rec_index + 1;
2592 EXIT WHEN l_rec_index > l_count;
2593
2594 END LOOP;
2595
2596 -- add termination tags
2597
2598 l_xml_hdr := l_xml_hdr || '</initialize>';
2599 l_xml_hdr := REPLACE(l_xml_hdr, ' ' , '+');
2600
2601 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2602
2603 aso_debug_pub.add('Create_hdr_xml: Length of l_xml_hdr mesg: '||length(l_xml_hdr));
2604 aso_debug_pub.add('Create_hdr_xml: 1st Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 1, 100));
2605 aso_debug_pub.add('Create_hdr_xml: 2nd Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 101, 100));
2606 aso_debug_pub.add('Create_hdr_xml: 3rd Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 201, 100));
2607 aso_debug_pub.add('Create_hdr_xml: 4th Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 301, 100));
2608 aso_debug_pub.add('Create_hdr_xml: 5st Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 401, 100));
2609 aso_debug_pub.add('Create_hdr_xml: 6nd Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 501, 100));
2610 aso_debug_pub.add('Create_hdr_xml: 7rd Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 601, 100));
2611 aso_debug_pub.add('Create_hdr_xml: 8th Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 701, 100));
2612
2613 END IF;
2614
2615 x_xml_hdr := l_xml_hdr;
2616
2617 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2618 aso_debug_pub.add('End of Create_hdr_xml.', 1, 'Y');
2619 END IF;
2620
2621
2622 EXCEPTION
2623
2624 when others then
2625
2626 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2627
2628 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2629 aso_debug_pub.add('Create_hdr_xml: Inside When Others Exception: x_return_status: '||x_return_status, 1, 'N');
2630 END IF;
2631
2632 END Create_hdr_xml;
2633
2634
2635
2636 -- create xml message, send it to ui manager
2637 -- get back pieces of xml message
2638 -- process them and generate a long output xml message
2639 -- hardcoded :url,user, passwd, gwyuid,fndnam,two_task
2640
2641 /*-------------------------------------------------------------------------
2642 Procedure Name : Send_input_xml
2643 Description : sends the xml batch validation message to SPC that has
2644 options that are newly inserted/updated/deleted
2645 from the model.
2646
2647 SPC validation_status :
2648 CONFIG_PROCESSED constant NUMBER :=0;
2649 CONFIG_PROCESSED_NO_TERMINATE constant NUMBER :=1;
2650 INIT_TOO_LONG constant NUMBER :=2;
2651 INVALID_OPTION_REQUEST constant NUMBER :=3;
2652 CONFIG_EXCEPTION constant NUMBER :=4;
2653 DATABASE_ERROR constant NUMBER :=5;
2654 UTL_HTTP_INIT_FAILED constant NUMBER :=6;
2655 UTL_HTTP_REQUEST_FAILED constant NUMBER :=7;
2656
2657
2658 --------------------------------------------------------------------------*/
2659
2660 PROCEDURE Send_input_xml
2661 ( P_Qte_Line_Tbl IN ASO_QUOTE_PUB.Qte_Line_Tbl_Type
2662 := ASO_QUOTE_PUB.G_MISS_QTE_LINE_TBL,
2663 P_Qte_Line_Dtl_Tbl IN ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type
2664 := ASO_QUOTE_PUB.G_MISS_QTE_LINE_DTL_TBL,
2665 P_xml_hdr IN VARCHAR2,
2666 X_out_xml_msg OUT NOCOPY /* file.sql.39 change */ LONG ,
2667 X_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
2668 X_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
2669 X_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
2670 )
2671 IS
2672 l_html_pieces CZ_CF_API.CFG_OUTPUT_PIECES; -- table of VARCHAR2(2000)
2673 l_option_rec CZ_CF_API.INPUT_SELECTION;
2674 l_batch_val_tbl CZ_CF_API.CFG_INPUT_LIST;
2675
2676 l_qte_line_rec ASO_QUOTE_PUB.Qte_Line_Rec_Type;
2677 l_qte_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type;
2678
2679 l_delete_qty VARCHAR2(30) := '0';
2680
2681 --variable to fetch from cursor Get_Options
2682 l_component_code VARCHAR2(1000);
2683 --l_config_item_id NUMBER;
2684 l_inventory_item_id VARCHAR2(30);
2685 l_option_quantity VARCHAR2(30);
2686
2687 -- message related
2688 l_validation_status NUMBER;
2689 l_url VARCHAR2(500):= FND_PROFILE.Value('CZ_UIMGR_URL');
2690 l_xml_hdr VARCHAR2(2000);
2691 l_dummy VARCHAR2(2000) := NULL;
2692 l_long_xml LONG := NULL;
2693 l_item_type_code VARCHAR2(50);
2694 l_index BINARY_INTEGER;
2695 i NUMBER;
2696 l_return_status VARCHAR2(1);
2697 BEGIN
2698 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2702 --Initialize API return status to SUCCESS
2699 aso_debug_pub.add('ASO_CFG_INT: Send_input_xml Begin.', 1, 'Y');
2700 END IF;
2701
2703 l_return_status := FND_API.G_RET_STS_SUCCESS;
2704
2705 l_xml_hdr := p_xml_hdr;
2706
2707 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2708 aso_debug_pub.add('ASO_CFG_INT: Send_input_xml: Before the quote line Loop.', 1, 'Y');
2709 END IF;
2710
2711 FOR i IN 1..P_Qte_Line_Tbl.COUNT LOOP
2712
2713 l_option_rec.input_seq := i;
2714 l_option_rec.component_code := p_qte_line_dtl_tbl(i).component_code;
2715 l_option_rec.config_item_id := p_qte_line_dtl_tbl(i).config_item_id;
2716
2717 IF P_Qte_Line_Tbl(i).operation_code = 'DELETE' THEN
2718 l_option_rec.quantity := l_delete_qty;
2719 ELSIF P_Qte_Line_Tbl(i).operation_code = 'UPDATE' THEN
2720 l_option_rec.quantity := P_Qte_Line_Tbl(i).quantity;
2721 END IF;
2722
2723 l_batch_val_tbl(i) := l_option_rec;
2724
2725 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2726
2727 aso_debug_pub.add('l_batch_val_tbl('||i||').input_seq: '||l_batch_val_tbl(i).input_seq);
2728 aso_debug_pub.add('l_batch_val_tbl('||i||').component_code: '||l_batch_val_tbl(i).component_code);
2729 aso_debug_pub.add('l_batch_val_tbl('||i||').quantity: '||l_batch_val_tbl(i).quantity);
2730 aso_debug_pub.add('l_batch_val_tbl('||i||').config_item_id: '||l_batch_val_tbl(i).config_item_id);
2731
2732 END IF;
2733
2734 END LOOP;
2735
2736 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2737 aso_debug_pub.add('ASO_CFG_INT: Send_input_xml: After the quote line Loop.', 1, 'Y');
2738 END IF;
2739
2740 -- delete previous data.
2741 IF (l_html_pieces.COUNT <> 0) THEN
2742 l_html_pieces.DELETE;
2743 END IF;
2744
2745 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2746 aso_debug_pub.add('Send_input_xml: l_html_pieces.COUNT: '||l_html_pieces.COUNT);
2747 aso_debug_pub.add('Send_input_xml: Before call to CZ_CF_API.Validate');
2748 END IF;
2749
2750 CZ_CF_API.Validate( config_input_list => l_batch_val_tbl,
2751 init_message => l_xml_hdr,
2752 config_messages => l_html_pieces,
2753 validation_status => l_validation_status,
2754 URL => l_url );
2755
2756 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2757 aso_debug_pub.add('Send_input_xml: After call to CZ_CF_API.Validate: l_validation_status: '||l_validation_status);
2758 END IF;
2759
2760 IF l_validation_status <> 0 THEN
2761
2762 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2763 aso_debug_pub.add('Send_input_xml: Error returned from CZ_CF_API.Validate');
2764 END IF;
2765
2766 FND_MESSAGE.Set_Name('ASO', 'ASO_BATCH_VALIDATE');
2767 FND_MESSAGE.Set_token('ERR_TEXT' , 'Error returned from CZ_CF_API.Validate, validation_status <> 0' );
2768 FND_MSG_PUB.ADD;
2769 l_return_status := FND_API.G_RET_STS_ERROR;
2770 END IF;
2771
2772 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2773 aso_debug_pub.add('Send_input_xml: After call to CZ_CF_API.Validate: l_html_pieces.COUNT: '||l_html_pieces.COUNT);
2774 END IF;
2775
2776 IF (l_html_pieces.COUNT <= 0) THEN
2777
2778 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2779 aso_debug_pub.add('Send_input_xml: No XML message returned from CZ_CF_API.Validate api', 1, 'Y');
2780 END IF;
2781
2782 FND_MESSAGE.Set_Name('ASO', 'ASO_BATCH_VALIDATE');
2783 FND_MESSAGE.Set_token('ERR_TEXT' , 'Error returned from CZ_CF_API.Validate, config_messages: l_html_pieces.COUNT <= 0' );
2784 FND_MSG_PUB.ADD;
2785 l_return_status := FND_API.G_RET_STS_ERROR;
2786
2787 END IF;
2788
2789 l_index := l_html_pieces.FIRST;
2790
2791 LOOP
2792
2793 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2794 aso_debug_pub.add('Send_input_xml: Part of output_message :'|| SUBSTR(l_html_pieces(l_index), 1, 100));
2795 END IF;
2796
2797 l_long_xml := l_long_xml || l_html_pieces(l_index);
2798
2799 EXIT WHEN l_index = l_html_pieces.LAST;
2800 l_index := l_html_pieces.NEXT(l_index);
2801
2802 END LOOP;
2803
2804 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2805
2806 aso_debug_pub.add('Send_input_xml: Part of output_message :'|| SUBSTR(l_long_xml, 1, 100));
2807 aso_debug_pub.add('Send_input_xml: Part of output_message :'|| SUBSTR(l_long_xml, 101, 200));
2808 aso_debug_pub.add('Send_input_xml: Part of output_message :'|| SUBSTR(l_long_xml, 201, 300));
2809 aso_debug_pub.add('Send_input_xml: Part of output_message :'|| SUBSTR(l_long_xml, 301, 400));
2810
2811 END IF;
2812
2813 -- Return the output XML message
2814 x_out_xml_msg := l_long_xml;
2815 x_return_status := l_return_status;
2816
2817 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2818 aso_debug_pub.Add('End of Send_input_xml', 1, 'Y');
2819 END IF;
2820
2821 EXCEPTION
2822
2823 WHEN OTHERS THEN
2824
2825 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2826
2827 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2831 END Send_input_xml;
2828 aso_debug_pub.add('Send_input_xml: Inside When Others Exception:', 1, 'N');
2829 END IF;
2830
2832
2833
2834 /*-------------------------------------------------------------------------
2835 Procedure Name : Parse_output_xml
2836 Description : Parses the output XML message returned from the CZ to get the
2837 valid and complete configuration flag.
2838 If error is returned then populates CZ messages into ASO
2839 message stack.
2840 --------------------------------------------------------------------------*/
2841
2842 PROCEDURE Parse_output_xml
2843 ( p_xml_msg IN LONG,
2844 x_valid_configuration_flag OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
2845 x_complete_configuration_flag OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
2846 x_config_header_id OUT NOCOPY /* file.sql.39 change */ NUMBER,
2847 x_config_revision_num OUT NOCOPY /* file.sql.39 change */ NUMBER,
2848 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
2849 x_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
2850 x_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
2851 )
2852 IS
2853
2854 CURSOR c_messages(p_config_hdr_id NUMBER, p_config_rev_nbr NUMBER) is
2855 SELECT constraint_type , message
2856 FROM cz_config_messages
2857 WHERE config_hdr_id = p_config_hdr_id
2858 AND config_rev_nbr = p_config_rev_nbr;
2859
2860 i NUMBER := 1;
2861 l_config_header_id NUMBER;
2862 l_config_revision_num NUMBER;
2863 l_valid_configuration VARCHAR2(10);
2864 l_complete_configuration VARCHAR2(10);
2865 l_complete_configuration_flag VARCHAR2(1);
2866 l_valid_configuration_flag VARCHAR2(1);
2867 l_message_type VARCHAR2(100);
2868 l_message_text VARCHAR2(4000);
2869 l_exit VARCHAR2(100);
2870 l_msg VARCHAR2(2000);
2871 l_len_msg NUMBER;
2872 l_constraint VARCHAR2(16);
2873
2874 l_return_status VARCHAR2(1);
2875 l_msg_count NUMBER;
2876 l_msg_data VARCHAR2(2000);
2877
2878 BEGIN
2879 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2880 aso_debug_pub.add('ASO_CFG_INT: Parse_output_xml Begin.', 1, 'Y');
2881 END IF;
2882
2883 --Initialize API return status to SUCCESS
2884 l_return_status := FND_API.G_RET_STS_SUCCESS;
2885
2886 l_config_header_id := to_number(substr(p_xml_msg,(instr(p_xml_msg, '<config_header_id>',1,1)+18),
2887 (instr(p_xml_msg,'</config_header_id>',1,1) -
2888 (instr(p_xml_msg, '<config_header_id>',1,1)+18))));
2889
2890 l_config_revision_num := to_number(substr(p_xml_msg,(instr(p_xml_msg,'<config_rev_nbr>',1,1)+16),
2891 (instr(p_xml_msg,'</config_rev_nbr>',1,1) -
2892 (instr(p_xml_msg,'<config_rev_nbr>',1,1)+16))));
2893
2894 l_valid_configuration := substr(p_xml_msg,(instr(p_xml_msg,'<valid_configuration>',1,1)+21),
2895 (instr(p_xml_msg,'</valid_configuration>',1,1) -
2896 (instr(p_xml_msg,'<valid_configuration>',1,1)+21)));
2897
2898 l_complete_configuration := substr(p_xml_msg,(instr(p_xml_msg,'<complete_configuration>',1,1)+24),
2899 (instr(p_xml_msg,'</complete_configuration>',1,1) -
2900 (instr(p_xml_msg,'<complete_configuration>',1,1)+24)));
2901
2902 l_message_type := substr(p_xml_msg,(instr(p_xml_msg,'<message_type>',1,1)+14),
2903 (instr(p_xml_msg,'</message_type>',1,1) -
2904 (instr(p_xml_msg,'<message_type>',1,1)+14)));
2905
2906 l_message_text := substr(p_xml_msg,(instr(p_xml_msg,'<message_text>',1,1)+14),
2907 (instr(p_xml_msg,'</message_text>',1,1) -
2908 (instr(p_xml_msg,'<message_text>',1,1)+14)));
2909
2910 l_exit := substr(p_xml_msg,(instr(p_xml_msg,'<exit>',1,1)+6),
2911 (instr(p_xml_msg,'</exit>',1,1) -
2912 (instr(p_xml_msg,'<exit>',1,1)+6)));
2913
2914
2915 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2916 aso_debug_pub.add('Parse_output_xml: l_message_type: '|| l_message_type);
2917 aso_debug_pub.add('Parse_output_xml: l_message_text: '|| substr(l_message_text,1,150));
2918 aso_debug_pub.add('Parse_output_xml: l_exit : '|| l_exit);
2919 END IF;
2920
2921 IF l_exit = 'error' AND l_message_type = 'error' THEN
2922
2923 i := 1;
2924 l_len_msg := Length(l_message_text);
2925
2926 While l_len_msg >= i Loop
2927
2928 FND_MESSAGE.Set_Name('ASO', 'ASO_BATCH_VALIDATE');
2929 FND_MESSAGE.Set_token('ERR_TEXT' , substr(l_message_text,i,240));
2933
2930 FND_MSG_PUB.ADD;
2931
2932 i := i + 240;
2934 End Loop;
2935
2936 l_return_status := FND_API.G_RET_STS_ERROR;
2937
2938 END IF;
2939
2940
2941 IF (nvl(l_valid_configuration, 'N') <> 'true') THEN
2942 l_valid_configuration_flag := 'N';
2943 ELSE
2944 l_valid_configuration_flag := 'Y';
2945 END IF ;
2946
2947 IF (nvl(l_complete_configuration, 'N') <> 'true' ) THEN
2951 END IF;
2948 l_complete_configuration_flag := 'N';
2949 ELSE
2950 l_complete_configuration_flag := 'Y';
2952
2953
2954 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2955 aso_debug_pub.add('Parse_output_xml: l_valid_configuration_flag: '|| l_valid_configuration_flag);
2956 aso_debug_pub.add('Parse_output_xml: l_complete_configuration_flag: '|| l_complete_configuration_flag);
2957 END IF;
2958
2959 IF l_config_header_id is NULL THEN
2960
2961 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2962 aso_debug_pub.add('Parse_output_xml: Getting messages from cz_config_messages');
2963 END IF;
2964
2965 OPEN c_messages(l_config_header_id, l_config_revision_num);
2966
2967 LOOP
2968
2969 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2970 aso_debug_pub.add('Parse_output_xml: CZ message: c_messages%rowcount: '||c_messages%rowcount);
2971 END IF;
2972
2973 FETCH c_messages into l_constraint,l_msg;
2974 EXIT when c_messages%notfound;
2975
2976 i := 1;
2977 l_len_msg := Length(l_msg);
2978
2979 While l_len_msg >= i Loop
2980
2981 FND_MESSAGE.Set_Name('ASO', 'ASO_BATCH_VALIDATE');
2982 FND_MESSAGE.Set_token('ERR_TEXT' , substr(l_msg,i,240));
2983 i := i + 240;
2984 FND_MSG_PUB.ADD;
2985
2986 End Loop;
2987
2988 IF aso_debug_pub.g_debug_flag = 'Y' THEN
2989 aso_debug_pub.add('Parse_output_xml: '|| substr(l_msg, 1, 100));
2990 aso_debug_pub.add('Parse_output_xml: '|| substr(l_msg, 101, 200));
2991 aso_debug_pub.add('Parse_output_xml: '|| substr(l_msg, 201, 300));
2992 END IF;
2993
2994 END LOOP;
2995
2996 l_return_status := FND_API.G_RET_STS_ERROR;
2997
2998 END IF;
2999
3000 -- if everything ok, set return values
3001
3002 x_valid_configuration_flag := l_valid_configuration_flag;
3003 x_complete_configuration_flag := l_complete_configuration_flag;
3004 x_return_status := l_return_status;
3005 x_config_header_id := l_config_header_id;
3006 x_config_revision_num := l_config_revision_num;
3007 x_msg_count := l_msg_count;
3008 x_msg_data := l_msg_data;
3009
3010 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3011 aso_debug_pub.Add('End of parse_output_xml', 1, 'Y');
3012 END IF;
3013
3014 EXCEPTION
3015
3016 WHEN OTHERS THEN
3017
3018 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3019
3020 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3021 aso_Debug_Pub.Add( 'Parse_Output_xml: In WHEN OTHERS exception ', 1, 'N');
3022 END IF;
3023
3024 END Parse_output_xml;
3025
3026
3027
3028 /*----------------------------------------------------------------------
3029 PROCEDURE : Validate_configuration
3030 Description : Checks if the configuration is complete and valid.
3031 Returns success/error as status. It calls
3032 Create_hdr_xml : To create the CZ batch validation header xml message
3033 Send_input_xml : Sends the xml message created by Create_hdr_xml to the
3034 CZ configurator along with a pl/sql table which has options
3035 that are updated and deleted from the model.
3036 Parse_output_xml : parses the CZ output xml message to see if the configuration
3037 is valid and complete.
3038 Get_config_details : To save options along with the model line in ASO_QUOTE_LINES_ALL
3039 , ASO_QUOTE_LINE_DETAILS and ASO_LINE_RELATIONSHIPS
3040 -----------------------------------------------------------------------*/
3041
3042 PROCEDURE Validate_Configuration
3043 (P_Api_Version_Number IN NUMBER := FND_API.G_MISS_NUM,
3044 P_Init_Msg_List IN VARCHAR2 := FND_API.G_FALSE,
3045 P_Commit IN VARCHAR2 := FND_API.G_FALSE,
3046 p_control_rec IN aso_quote_pub.control_rec_type
3047 := aso_quote_pub.G_MISS_control_rec,
3048 P_model_line_id IN NUMBER,
3049 P_Qte_Line_Tbl IN ASO_QUOTE_PUB.Qte_Line_Tbl_Type
3050 := ASO_QUOTE_PUB.G_MISS_QTE_LINE_TBL,
3051 P_Qte_Line_Dtl_Tbl IN ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type
3052 := ASO_QUOTE_PUB.G_MISS_QTE_LINE_DTL_TBL,
3053 X_config_header_id OUT NOCOPY /* file.sql.39 change */ NUMBER,
3054 X_config_revision_num OUT NOCOPY /* file.sql.39 change */ NUMBER,
3055 X_valid_configuration_flag OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
3056 X_complete_configuration_flag OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
3057 X_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
3058 X_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
3059 X_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
3060 )
3061 IS
3062 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Configuration' ;
3063 l_api_version_number CONSTANT NUMBER := 1.0;
3064
3065 l_model_line_id NUMBER := p_model_line_id;
3066 l_qte_header_rec aso_quote_pub.qte_header_rec_type := aso_quote_pub.g_miss_qte_header_rec;
3067 l_model_line_rec ASO_QUOTE_PUB.Qte_Line_Rec_Type := ASO_QUOTE_PUB.G_MISS_QTE_LINE_REC;
3071 l_config_revision_num NUMBER;
3068 l_model_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type := ASO_QUOTE_PUB.G_MISS_QTE_LINE_DTL_TBL;
3069
3070 l_config_header_id NUMBER;
3072 l_valid_configuration_flag VARCHAR2(1);
3073 l_complete_configuration_flag VARCHAR2(1);
3074 --l_model_qty NUMBER;
3075 l_msg_count NUMBER;
3076 l_msg_data VARCHAR2(2000);
3077
3078 l_result_out VARCHAR2(30);
3079
3080 -- input xml message
3081 l_xml_message LONG := NULL;
3082 l_xml_hdr VARCHAR2(2000);
3083
3084 -- upgrade stuff
3085 l_upgraded_flag VARCHAR2(1);
3086
3087 -- cz's delete return value
3088 l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
3089 l_delete_config VARCHAR2(1) := fnd_api.g_false;
3090 l_old_config_hdr_id NUMBER;
3091
3092 BEGIN
3093 -- Standard Start of API savepoint
3094 -- SAVEPOINT VALIDATE_CONFIGURATION_INT;
3095
3096 l_return_status := FND_API.G_RET_STS_SUCCESS;
3097
3098 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3099 aso_debug_pub.add('ASO_CFG_INT: Validate_Configuration Begins', 1, 'Y');
3100 END IF;
3101
3102 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
3103 p_api_version_number,
3104 l_api_name,
3105 G_PKG_NAME) THEN
3106 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3107 END IF;
3108
3109 IF FND_API.to_Boolean( p_init_msg_list ) THEN
3110 FND_MSG_PUB.initialize;
3111 END IF;
3112
3113 -- Get model line info
3114 l_model_line_rec := ASO_UTILITY_PVT.Query_Qte_Line_Row(p_model_line_id);
3115 l_model_line_dtl_tbl := ASO_UTILITY_PVT.Query_Line_Dtl_Rows(p_model_line_id);
3116
3117 -- Call Create_hdr_xml to create the input header XML message
3118 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3119 aso_debug_pub.add('Validate_Configuration: Before call to Create_hdr_xml.');
3120 END IF;
3121
3122 Create_hdr_xml ( P_model_line_id => P_model_line_id,
3123 X_xml_hdr => l_xml_hdr,
3124 X_return_status => l_return_status );
3125
3126 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3127
3128 aso_debug_pub.add('Validate_Configuration: After call to Create_hdr_xml l_return_status: '||l_return_status);
3129 aso_debug_pub.add('Validate_Configuration: After call to Create_hdr_xml Length of l_xml_hdr : '||length(l_xml_hdr));
3130
3131 END IF;
3132
3133 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
3134
3135 -- Call Send_Input_Xml to call CZ batch validate procedure and get the output XML message
3136
3137 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3138 aso_debug_pub.add('ASO_CFG_INT: Validate_Configuration: Before call to Send_input_xml');
3139 END IF;
3140
3141 Send_input_xml( P_Qte_Line_Tbl => P_Qte_Line_Tbl,
3142 P_Qte_Line_Dtl_Tbl => P_Qte_Line_Dtl_Tbl,
3143 P_xml_hdr => l_xml_hdr,
3144 X_out_xml_msg => l_xml_message,
3145 X_return_status => l_return_status,
3146 X_msg_count => l_msg_count,
3147 X_msg_data => l_msg_data
3148 );
3149
3150 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3151 aso_debug_pub.add('Validate_Configuration: After call to Send_input_xml');
3152 aso_debug_pub.add('Validate_Configuration: l_return_status: '||l_return_status);
3153 END IF;
3154
3155
3156
3157 -- extract data from xml message.
3158
3159 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3160 l_delete_config := fnd_api.g_true;
3161 END IF;
3162
3163 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3164 aso_debug_pub.add('Validate_Configuration: Before Call to Parse_Output_xml',1,'N');
3165 aso_debug_pub.add('Validate_Configuration: l_delete_config: '||l_delete_config);
3166 END IF;
3167
3168 Parse_output_xml
3169 ( p_xml_msg => l_xml_message,
3170 x_valid_configuration_flag => l_valid_configuration_flag,
3171 x_complete_configuration_flag => l_complete_configuration_flag,
3172 x_config_header_id => l_config_header_id,
3173 x_config_revision_num => l_config_revision_num,
3174 x_return_status => l_return_status,
3175 x_msg_count => l_msg_count,
3176 x_msg_data => l_msg_data
3177 );
3178
3179 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3180 aso_debug_pub.add('Validate_Configuration: After call to Parse_output_xml');
3181 aso_debug_pub.add('Validate_Configuration: l_return_status: '||l_return_status);
3182 END IF;
3183
3184 END IF;
3185
3186 IF (l_return_status = FND_API.G_RET_STS_SUCCESS) and (l_delete_config = fnd_api.g_false) THEN
3187
3188 -- Call GET_CONFIG_DETAILS to update the existing configuration
3189 -- Set the Call_batch_validation_flag to FND_API.G_FALSE to avoid recursive call to update_quote
3190
3191 l_model_line_dtl_tbl(1).valid_configuration_flag := l_valid_configuration_flag;
3192 l_model_line_dtl_tbl(1).complete_configuration_flag := l_complete_configuration_flag;
3193
3194 l_qte_header_rec.quote_header_id := l_model_line_rec.quote_header_id;
3195
3196
3197 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3198 aso_debug_pub.add('Validate_Configuration: Before Call to ASO_CFG_INT.Get_config_details');
3199 END IF;
3200
3201 ASO_CFG_INT.Get_config_details(
3202 p_api_version_number => 1.0,
3203 p_init_msg_list => FND_API.G_FALSE,
3204 p_commit => FND_API.G_FALSE,
3205 p_control_rec => p_control_rec,
3206 p_qte_header_rec => l_qte_header_rec,
3207 p_model_line_rec => l_model_line_rec,
3208 p_config_rec => l_model_line_dtl_tbl(1),
3209 p_config_hdr_id => l_config_header_id,
3210 p_config_rev_nbr => l_config_revision_num,
3211 x_return_status => l_return_status,
3212 x_msg_count => l_msg_count,
3213 x_msg_data => l_msg_data );
3214
3215 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3216 aso_debug_pub.add('Validate_Configuration: After Call to Get_config_details');
3217 aso_debug_pub.add('Validate_Configuration: l_return_status: '||l_return_status);
3218 END IF;
3219
3220 ELSE
3221 l_delete_config := fnd_api.g_true;
3222 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3223 aso_debug_pub.add('Validate_Configuration: l_delete_config: '||l_delete_config);
3224 END IF;
3225
3226 END IF;
3227
3228 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3229
3230 aso_debug_pub.add('End of procedure Validate_Configuration');
3231 aso_debug_pub.add('l_return_status: '|| l_return_status);
3232 aso_debug_pub.add('l_valid_configuration_flag: '|| l_valid_configuration_flag);
3233 aso_debug_pub.add('l_complete_configuration_flag: '|| l_complete_configuration_flag);
3234
3235 END IF;
3236
3237 x_config_header_id := l_config_header_id;
3238 x_config_revision_num := l_config_revision_num;
3239 x_valid_configuration_flag := l_valid_configuration_flag;
3240 x_complete_configuration_flag := l_complete_configuration_flag;
3241 x_return_status := l_return_status;
3242 x_msg_count := l_msg_count;
3243 x_msg_data := l_msg_data;
3244
3245 if l_delete_config = fnd_api.g_true then
3246
3247 x_return_status := FND_API.G_RET_STS_ERROR;
3248
3249 end if;
3250
3251 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3252 aso_debug_pub.add('End of Validate_Configuration', 1, 'N');
3253 END IF;
3254
3255 EXCEPTION
3256
3257 WHEN OTHERS THEN
3258
3259 IF aso_debug_pub.g_debug_flag = 'Y' THEN
3260 aso_debug_pub.add('Validate_Configuration: Inside WHEN OTHERS EXCEPTION', 1, 'Y');
3261 END IF;
3262
3263 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3264
3265 END Validate_Configuration;
3266
3267
3268 End aso_cfg_int;