[Home] [Help]
PACKAGE BODY: APPS.ASO_VALIDATE_CFG_PVT
Source
1 PACKAGE BODY ASO_VALIDATE_CFG_PVT as
2 /* $Header: asovcfgb.pls 120.0.12010000.2 2010/04/14 06:50:57 rassharm noship $ */
3
4 G_PKG_NAME CONSTANT VARCHAR2(30):= 'ASO_VALIDATE_CFG_PVT';
5 G_FILE_NAME CONSTANT VARCHAR2(12) := 'asovcfgb.pls';
6
7
8 /*----------------------------------------------------------------------
9 PROCEDURE : Validate_configuration
10 Description : Checks if the configuration is complete and valid.
11 Returns success/error as status. It calls
12 Create_header_xml : To create the CZ batch validation header xml message
13 ASO_CFG_INT.Send_input_xml : Sends the xml message created by Create_header_xml to the
14 CZ configurator along with a pl/sql table which has options
15 that are updated and deleted from the model.
16 ASO_CFG_INT.Parse_output_xml : parses the CZ output xml message to see if the configuration
17 is valid and complete.
18 ASO_CFG_INT.Get_config_details : To save options along with the model line in ASO_QUOTE_LINES_ALL
19 , ASO_QUOTE_LINE_DETAILS and ASO_LINE_RELATIONSHIPS
20 -----------------------------------------------------------------------*/
21
22 PROCEDURE Validate_Configuration
23 (P_Api_Version_Number IN NUMBER ,
24 P_Init_Msg_List IN VARCHAR2 := FND_API.G_FALSE,
25 P_Commit IN VARCHAR2 := FND_API.G_FALSE,
26 p_control_rec IN aso_quote_pub.control_rec_type
27 := aso_quote_pub.G_MISS_control_rec,
28 P_model_line_id IN NUMBER,
29 P_Qte_Line_Tbl IN ASO_QUOTE_PUB.Qte_Line_Tbl_Type
30 := ASO_QUOTE_PUB.G_MISS_QTE_LINE_TBL,
31 P_Qte_Line_Dtl_Tbl IN ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type
32 := ASO_QUOTE_PUB.G_MISS_QTE_LINE_DTL_TBL,
33 P_UPDATE_QUOTE IN VARCHAR2 := FND_API.G_FALSE,
34 P_EFFECTIVE_DATE IN Date := FND_API.G_MISS_DATE,
35 P_model_lookup_DATE IN Date := FND_API.G_MISS_DATE,
36 X_config_header_id OUT NOCOPY /* file.sql.39 change */ NUMBER,
37 X_config_revision_num OUT NOCOPY /* file.sql.39 change */ NUMBER,
38 X_valid_configuration_flag OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
39 X_complete_configuration_flag OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
40 X_config_changed OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
41 X_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
42 X_msg_count OUT NOCOPY /* file.sql.39 change */ NUMBER,
43 X_msg_data OUT NOCOPY /* file.sql.39 change */ VARCHAR2
44 )
45 IS
46 l_api_name CONSTANT VARCHAR2(30) := 'Validate_Configuration' ;
47 l_api_version_number CONSTANT NUMBER := 1.0;
48
49 l_model_line_id NUMBER := p_model_line_id;
50 l_qte_header_rec aso_quote_pub.qte_header_rec_type := aso_quote_pub.g_miss_qte_header_rec;
51 l_model_line_rec ASO_QUOTE_PUB.Qte_Line_Rec_Type := ASO_QUOTE_PUB.G_MISS_QTE_LINE_REC;
52 l_model_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type := ASO_QUOTE_PUB.G_MISS_QTE_LINE_DTL_TBL;
53
54 l_config_header_id NUMBER;
55 l_config_revision_num NUMBER;
56 l_valid_configuration_flag VARCHAR2(1);
57 l_complete_configuration_flag VARCHAR2(1);
58 l_config_changed_flag VARCHAR2(1);
59 --l_model_qty NUMBER;
60 l_msg_count NUMBER;
61 l_msg_data VARCHAR2(2000);
62
63 l_result_out VARCHAR2(30);
64
65 -- input xml message
66 l_xml_message LONG := NULL;
67 l_xml_hdr VARCHAR2(2000);
68
69 -- upgrade stuff
70 l_upgraded_flag VARCHAR2(1);
71
72 -- cz's delete return value
73 l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
74 l_delete_config VARCHAR2(1) := fnd_api.g_false;
75 l_old_config_hdr_id NUMBER;
76 l_new_config_hdr_id number;
77
78 CURSOR c_config_exist_in_cz (p_config_hdr_id number, p_config_rev_nbr number) IS
79 select config_hdr_id
80 from cz_config_details_v
81 where config_hdr_id = p_config_hdr_id
82 and config_rev_nbr = p_config_rev_nbr;
83
84 BEGIN
85
86 l_return_status := FND_API.G_RET_STS_SUCCESS;
87
88 IF aso_debug_pub.g_debug_flag = 'Y' THEN
89 aso_debug_pub.add('ASO_VALIDATE_CFG_PVT: Validate_Configuration Begins', 1, 'Y');
90 END IF;
91
92 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
93 p_api_version_number,
94 l_api_name,
95 G_PKG_NAME) THEN
96 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
97 END IF;
98
99 IF FND_API.to_Boolean( p_init_msg_list ) THEN
100 FND_MSG_PUB.initialize;
101 END IF;
102
103 -- Get model line info
104 l_model_line_rec := ASO_UTILITY_PVT.Query_Qte_Line_Row(p_model_line_id);
105 l_model_line_dtl_tbl := ASO_UTILITY_PVT.Query_Line_Dtl_Rows(p_model_line_id);
106
107 -- Call Create_header_xml to create the input header XML message
108 IF aso_debug_pub.g_debug_flag = 'Y' THEN
109 aso_debug_pub.add('Validate_Configuration: Before call to Create_header_xml.');
110 aso_debug_pub.add('Validate_Configuration: Before call to Create_header_xml. P_EFFECTIVE_DATE'||P_EFFECTIVE_DATE);
111 aso_debug_pub.add('Validate_Configuration: Before call to Create_header_xml. P_model_lookup_DATE'||P_model_lookup_DATE);
112 END IF;
113
114 -- dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT before create header xml');
115 /*aso_cfg_int.create_hdr_xml(P_model_line_id => P_model_line_id,
116 X_xml_hdr => l_xml_hdr,
117 X_return_status => l_return_status );*/
118 Create_header_xml ( P_model_line_id => P_model_line_id,
119 P_EFFECTIVE_DATE => P_EFFECTIVE_DATE,
120 P_model_lookup_DATE => P_model_lookup_DATE,
121 X_xml_hdr => l_xml_hdr,
122 X_return_status => l_return_status );
123
124 IF aso_debug_pub.g_debug_flag = 'Y' THEN
125
126 aso_debug_pub.add('Validate_Configuration: After call to Create_header_xml l_return_status: '||l_return_status);
127 aso_debug_pub.add('Validate_Configuration: After call to Create_header_xml Length of l_xml_hdr : '||length(l_xml_hdr));
128 --aso_debug_pub.add('ASO_CFG_INT: Validate_Configuration: Before call to Send_input_xml'||l_xml_hdr);
129 END IF;
130
131 -- dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT before send input xml'||l_return_status);
132 -- dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT before send input xml'||l_xml_hdr);
133
134 IF l_return_status = FND_API.G_RET_STS_SUCCESS THEN
135
136 -- Call Send_Input_Xml to call CZ batch validate procedure and get the output XML message
137
138 IF aso_debug_pub.g_debug_flag = 'Y' THEN
139 aso_debug_pub.add('ASO_CFG_INT: Validate_Configuration: Before call to Send_input_xml');
140 END IF;
141
142 ASO_CFG_INT.Send_input_xml( P_Qte_Line_Tbl => P_Qte_Line_Tbl,
143 P_Qte_Line_Dtl_Tbl => P_Qte_Line_Dtl_Tbl,
144 P_xml_hdr => l_xml_hdr,
145 X_out_xml_msg => l_xml_message,
146 X_config_changed => l_config_changed_flag,
147 X_return_status => l_return_status,
148 X_msg_count => l_msg_count,
149 X_msg_data => l_msg_data
150 );
151
152 IF aso_debug_pub.g_debug_flag = 'Y' THEN
153 aso_debug_pub.add('Validate_Configuration: After call to Send_input_xml');
154 aso_debug_pub.add('Validate_Configuration: l_return_status: '||l_return_status);
155 END IF;
156
157 --dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT after send input xml'||l_return_status);
158 --dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT after send input xml'||l_config_changed_flag);
159
160 -- extract data from xml message.
161
162 IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
163 l_delete_config := fnd_api.g_true;
164 END IF;
165
166 IF aso_debug_pub.g_debug_flag = 'Y' THEN
167 aso_debug_pub.add('Validate_Configuration: Before Call to Parse_Output_xml',1,'N');
168 aso_debug_pub.add('Validate_Configuration: l_delete_config: '||l_delete_config);
169 END IF;
170
171 --dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT before parse header xml'||l_return_status);
172
173 ASO_CFG_INT.Parse_output_xml
174 ( p_xml_msg => l_xml_message,
175 x_valid_configuration_flag => l_valid_configuration_flag,
176 x_complete_configuration_flag => l_complete_configuration_flag,
177 x_config_header_id => l_config_header_id,
178 x_config_revision_num => l_config_revision_num,
179 x_return_status => l_return_status,
180 x_msg_count => l_msg_count,
181 x_msg_data => l_msg_data
182 );
183
184 IF aso_debug_pub.g_debug_flag = 'Y' THEN
185 aso_debug_pub.add('Validate_Configuration: After call to Parse_output_xml');
186 aso_debug_pub.add('Validate_Configuration: l_return_status: '||l_return_status);
187 END IF;
188
189 END IF;
190 --dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT after parse header xml'||l_return_status);
191
192 IF ((l_return_status =FND_API.G_RET_STS_SUCCESS) and (p_update_quote=fnd_api.g_false) and (l_delete_config=fnd_api.g_false))THEN
193
194 --dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT p_update_quote is false');
195 open c_config_exist_in_cz(l_config_header_id, l_config_revision_num);
196 fetch c_config_exist_in_cz into l_new_config_hdr_id;
197
198 if c_config_exist_in_cz%found then
199
200 close c_config_exist_in_cz;
201
202 IF aso_debug_pub.g_debug_flag = 'Y' THEN
203 aso_debug_pub.add('Update Quote: A higher version exist for this configuration so deleting it from CZ');
204 END IF;
205
206 ASO_CFG_INT.DELETE_CONFIGURATION_AUTO( P_API_VERSION_NUMBER => 1.0,
207 P_INIT_MSG_LIST => FND_API.G_FALSE,
208 P_CONFIG_HDR_ID => l_config_header_id,
209 P_CONFIG_REV_NBR => l_config_revision_num,
210 X_RETURN_STATUS => x_return_status,
211 X_MSG_COUNT => x_msg_count,
212 X_MSG_DATA => x_msg_data);
213
214 IF aso_debug_pub.g_debug_flag = 'Y' THEN
215 aso_debug_pub.add('After call to ASO_CFG_INT.DELETE_CONFIGURATION_AUTO: x_Return_Status: ' || x_Return_Status);
216 END IF;
217
218 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
219
220 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
221 FND_MESSAGE.Set_Name('ASO', 'ASO_DELETE');
222 FND_MESSAGE.Set_Token('OBJECT', 'CONFIGURATION', FALSE);
223 FND_MSG_PUB.ADD;
224 END IF;
225
226 RAISE FND_API.G_EXC_ERROR;
227
228 END IF;
229
230 else
231 close c_config_exist_in_cz;
232 end if;
233
234 -- END IF;
235
236 elsif (l_return_status = FND_API.G_RET_STS_SUCCESS) and (l_delete_config = fnd_api.g_false) and (p_update_quote = fnd_api.g_true)THEN
237
238 -- Call GET_CONFIG_DETAILS to update the existing configuration
239 -- Set the Call_batch_validation_flag to FND_API.G_FALSE to avoid recursive call to update_quote
240 --dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT p_update_quote is true');
241 l_model_line_dtl_tbl(1).valid_configuration_flag := l_valid_configuration_flag;
242 l_model_line_dtl_tbl(1).complete_configuration_flag := l_complete_configuration_flag;
243
244 l_qte_header_rec.quote_header_id := l_model_line_rec.quote_header_id;
245
246
247 IF aso_debug_pub.g_debug_flag = 'Y' THEN
248 aso_debug_pub.add('Validate_Configuration: Before Call to ASO_CFG_INT.Get_config_details');
249 END IF;
250
251 ASO_CFG_INT.Get_config_details(
252 p_api_version_number => 1.0,
253 p_init_msg_list => FND_API.G_FALSE,
254 p_commit => FND_API.G_FALSE,
255 p_control_rec => p_control_rec,
256 p_qte_header_rec => l_qte_header_rec,
257 p_model_line_rec => l_model_line_rec,
258 p_config_rec => l_model_line_dtl_tbl(1),
259 p_config_hdr_id => l_config_header_id,
260 p_config_rev_nbr => l_config_revision_num,
261 x_return_status => l_return_status,
262 x_msg_count => l_msg_count,
263 x_msg_data => l_msg_data );
264
265 IF aso_debug_pub.g_debug_flag = 'Y' THEN
266 aso_debug_pub.add('Validate_Configuration: After Call to Get_config_details');
267 aso_debug_pub.add('Validate_Configuration: l_return_status: '||l_return_status);
268 END IF;
269
270 ELSE
271 --dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT l_delete_config is true');
272 l_delete_config := fnd_api.g_true;
273 IF aso_debug_pub.g_debug_flag = 'Y' THEN
274 aso_debug_pub.add('Validate_Configuration: l_delete_config: '||l_delete_config);
275 END IF;
276
277 END IF;
278
279 IF aso_debug_pub.g_debug_flag = 'Y' THEN
280
281 aso_debug_pub.add('End of procedure Validate_Configuration');
282 aso_debug_pub.add('l_return_status: '|| l_return_status);
283 aso_debug_pub.add('l_valid_configuration_flag: '|| l_valid_configuration_flag);
284 aso_debug_pub.add('l_complete_configuration_flag: '|| l_complete_configuration_flag);
285 aso_debug_pub.add('l_config_changed_flag: '|| l_config_changed_flag);
286 END IF;
287
288 x_config_header_id := l_config_header_id;
289 x_config_revision_num := l_config_revision_num;
290 x_valid_configuration_flag := l_valid_configuration_flag;
291 x_complete_configuration_flag := l_complete_configuration_flag;
292 X_config_changed := l_config_changed_flag;
293 x_return_status := l_return_status;
294 x_msg_count := l_msg_count;
295 x_msg_data := l_msg_data;
296
297 if l_delete_config = fnd_api.g_true then
298
299 x_return_status := FND_API.G_RET_STS_ERROR;
300
301 end if;
302
303 IF aso_debug_pub.g_debug_flag = 'Y' THEN
304 aso_debug_pub.add('End of Validate_Configuration', 1, 'N');
305 END IF;
306
307 EXCEPTION
308
309 WHEN OTHERS THEN
310
311 IF aso_debug_pub.g_debug_flag = 'Y' THEN
312 aso_debug_pub.add('Validate_Configuration: Inside WHEN OTHERS EXCEPTION', 1, 'Y');
313 END IF;
314
315 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
316
317 END Validate_Configuration;
318
319 /*-------------------------------------------------------------------------
320 Procedure Name : Create_header_xml
321 Description : creates a batch validation header message with effective dates
322 --------------------------------------------------------------------------*/
323
324 PROCEDURE Create_header_xml
325 ( p_model_line_id IN NUMBER,
326 P_EFFECTIVE_DATE IN Date := FND_API.G_MISS_DATE,
327 P_model_lookup_DATE IN Date := FND_API.G_MISS_DATE,
328 x_xml_hdr OUT NOCOPY /* file.sql.39 change */ VARCHAR2,
329 x_return_status OUT NOCOPY /* file.sql.39 change */ VARCHAR2 )
330 IS
331
332 Cursor C_org_id (p_quote_header_id NUMBER) is
333 select org_id from aso_quote_headers_all
334 where quote_header_id = p_quote_header_id;
335
336 Cursor c_inv_org_id (p_quote_line_id NUMBER) is
337 select organization_id from aso_quote_lines_all
338 where quote_line_id = p_quote_line_id;
339
340 TYPE param_name_type IS TABLE OF VARCHAR2(25)
341 INDEX BY BINARY_INTEGER;
342
343 TYPE param_value_type IS TABLE OF VARCHAR2(255)
344 INDEX BY BINARY_INTEGER;
345
346 param_name param_name_type;
347 param_value param_value_type;
348
349 l_rec_index BINARY_INTEGER;
350
351 l_model_line_rec ASO_QUOTE_PUB.Qte_Line_Rec_Type;
352 l_model_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type;
353 l_org_id NUMBER;
354
355 --Configurator specific params
356 l_calling_application_id VARCHAR2(30);
357 l_responsibility_id VARCHAR2(30);
358 l_database_id VARCHAR2(255);
359 l_read_only VARCHAR2(30) := null;
360 l_save_config_behavior VARCHAR2(30) := 'new_revision';
361 l_ui_type VARCHAR2(30) := null;
362 l_msg_behavior VARCHAR2(30) := 'brief';
363 l_icx_session_ticket VARCHAR2(200);
364
365 --Order Capture specific parameters
366 l_context_org_id VARCHAR2(30);
367 l_config_creation_date VARCHAR2(30);
368 l_inventory_item_id VARCHAR2(30);
369 l_config_header_id VARCHAR2(30);
370 l_config_rev_nbr VARCHAR2(30);
371 l_model_quantity VARCHAR2(30);
372 l_count NUMBER;
373 --l_validation_org_id NUMBER;
374
375 --message related
376 l_xml_hdr VARCHAR2(2000):= '<initialize>';
377 l_dummy VARCHAR2(500) := NULL;
378
379
380 -- ER ER 3177722
381 l_config_effective_date_prof VARCHAR2(1):=nvl(fnd_profile.value('ASO_CONFIG_EFFECTIVE_DATE'),'X');
382 l_current_date VARCHAR2(30);
383 x_config_effective_date DATE;
384 x_config_lookup_date DATE;
385
386 BEGIN
387 IF aso_debug_pub.g_debug_flag = 'Y' THEN
388 aso_debug_pub.add('ASO_VALIDATE_CFG_PVT Create_header_xml Begins.', 1, 'Y');
389 END IF;
390
391 --dbms_output.put_line('Entered ASO_VALIDATE_CFG_PVT rassharm create header xml');
392 --Initialize API return status to SUCCESS
393 x_return_status := FND_API.G_RET_STS_SUCCESS;
394
395 l_model_line_rec := aso_utility_pvt.Query_Qte_Line_Row( P_Qte_Line_Id => p_model_line_id );
396
397 IF aso_debug_pub.g_debug_flag = 'Y' THEN
398 aso_debug_pub.add('Create_header_xml: After call to aso_utility_pvt.Query_Qte_Line_Row');
399 END IF;
400
401 l_model_line_dtl_tbl := aso_utility_pvt.Query_Line_Dtl_Rows( P_Qte_Line_Id => p_model_line_id );
402
403 IF aso_debug_pub.g_debug_flag = 'Y' THEN
404 aso_debug_pub.add('Create_header_xml: After call to aso_utility_pvt.Query_Line_Dtl_Rows');
405 END IF;
406
407 /* Fix for bug 3998564 */
408 --OPEN C_org_id( l_model_line_rec.quote_header_id);
409 --FETCH C_org_id INTO l_org_id;
410 --CLOSE C_org_id;
411 OPEN c_inv_org_id( l_model_line_rec.quote_line_id);
412 FETCH c_inv_org_id INTO l_org_id;
413 CLOSE c_inv_org_id;
414 /* End of fix for bug 3998564 */
415
416 IF aso_debug_pub.g_debug_flag = 'Y' THEN
417 aso_debug_pub.add('Create_header_xml: After C_org_id cursor: l_org_id: '|| l_org_id, 1, 'N');
418 END IF;
419
420 IF l_org_id IS NULL THEN
421
422 --Commented Code Start Yogeshwar(MOAC)
423 /* IF SUBSTRB(USERENV('CLIENT_INFO'),1 ,1) = ' ' THEN
424 l_org_id := NULL;
425 ELSE
426 l_org_id := TO_NUMBER(SUBSTRB(USERENV('CLIENT_INFO'), 1,10));
427 END IF;
428 */
429 --Commented Code End Yogeshwar (MOAC)
430
431 L_org_id := l_model_line_rec.org_id; --New Code Yogeshwar MOAC
432
433 END IF;
434
435 IF aso_debug_pub.g_debug_flag = 'Y' THEN
436 aso_debug_pub.add('Create_header_xml: After Defaulting from client info. l_org_id: '|| l_org_id);
437 END IF;
438
439 --Set the values from model_line_rec, model_line_dtl_tbl and org_id
440 l_context_org_id := to_char(l_org_id);
441 l_inventory_item_id := to_char(l_model_line_rec.inventory_item_id);
442
443 /* Added by Arul */
444
445 If l_model_line_dtl_tbl.count = 0 then
446 l_config_header_id := NULL;
447 l_config_rev_nbr := NULL;
448 Else
449 l_config_header_id := to_char(l_model_line_dtl_tbl(1).config_header_id);
450 l_config_rev_nbr := to_char(l_model_line_dtl_tbl(1).config_revision_num);
451 End if;
452 /* End Added by Arul */
453
454 -- l_config_header_id := to_char(l_model_line_dtl_tbl(1).config_header_id);
455 -- l_config_rev_nbr := to_char(l_model_line_dtl_tbl(1).config_revision_num);
456 l_config_creation_date := to_char(l_model_line_rec.creation_date,'MM-DD-YYYY-HH24-MI-SS');
457 l_model_quantity := to_char(l_model_line_rec.quantity);
458 l_current_date:= to_char(sysdate,'MM-DD-YYYY-HH24-MI-SS');
459
460 IF aso_debug_pub.g_debug_flag = 'Y' THEN
461
462 aso_debug_pub.add('Create_header_xml: l_context_org_id :' || l_context_org_id);
463 aso_debug_pub.add('Create_header_xml: l_inventory_item_id :' || l_inventory_item_id);
464 aso_debug_pub.add('Create_header_xml: l_config_header_id :' || l_config_header_id);
465 aso_debug_pub.add('Create_header_xml: l_config_rev_nbr :' || l_config_rev_nbr);
466 aso_debug_pub.add('Create_header_xml: l_config_creation_date:' || l_config_creation_date);
467 aso_debug_pub.add('Create_header_xml: l_model_quantity :' || l_model_quantity);
468 aso_debug_pub.add('Create_header_xml: l_current_date:' || l_current_date);
469
470 END IF;
471
472 -- Set values from profiles and env. variables.
473 l_calling_application_id := fnd_global.resp_appl_id;
474 l_responsibility_id := fnd_global.resp_id;
475 l_database_id := fnd_web_config.database_id;
476 l_icx_session_ticket := cz_cf_api.icx_session_ticket;
477
478 IF aso_debug_pub.g_debug_flag = 'Y' THEN
479
480 aso_debug_pub.add('Create_header_xml: l_calling_application_id:' || l_calling_application_id);
481 aso_debug_pub.add('Create_header_xml: l_responsibility_id :' || l_responsibility_id);
482 aso_debug_pub.add('Create_header_xml: l_database_id :' || l_database_id);
483 aso_debug_pub.add('Create_header_xml: l_icx_session_ticket :' || l_icx_session_ticket);
484 aso_debug_pub.add('Create_header_xml: profile value:'|| l_config_effective_date_prof);
485
486 END IF;
487
488 -- set param_names
489 param_name(1) := 'database_id';
490 param_name(2) := 'context_org_id';
491 param_name(3) := 'config_creation_date';
492 param_name(4) := 'calling_application_id';
493 param_name(5) := 'responsibility_id';
494 param_name(6) := 'model_id';
495 param_name(7) := 'config_header_id';
496 param_name(8) := 'config_rev_nbr';
497 param_name(9) := 'read_only';
498 param_name(10) := 'save_config_behavior';
499 --param_name(11) := 'ui_type';
500 --param_name(12) := 'validation_org_id';
501 param_name(11) := 'terminate_msg_behavior';
502 param_name(12) := 'model_quantity';
503 param_name(13) := 'icx_session_ticket';
504
505 -- Added extra parameters for config effective and lookup date ER 3177722
506 param_name(14) := 'config_effective_date';
507 param_name(15) := 'config_model_lookup_date';
508 l_count := 15;
509 --l_count := 13;
510
511 -- set parameter values
512
513 param_value(1) := l_database_id;
514 param_value(2) := l_context_org_id;
515 param_value(3) := l_config_creation_date;
516 param_value(4) := l_calling_application_id;
517 param_value(5) := l_responsibility_id;
518 param_value(6) := l_inventory_item_id;
519 param_value(7) := l_config_header_id;
520 param_value(8) := l_config_rev_nbr;
521 param_value(9) := l_read_only;
522 param_value(10) := l_save_config_behavior;
523 --param_value(11) := l_ui_type;
524 --param_value(12) := l_validation_org_id;
525 param_value(11) := l_msg_behavior;
526 param_value(12) := l_model_quantity;
527 param_value(13) := l_icx_session_ticket;
528
529 if (p_effective_date<>fnd_API.G_MISS_DATE) then
530 aso_debug_pub.add('Create_header_xml: Effective date provided ');
531 param_value(14) := to_char(p_effective_date,'MM-DD-YYYY-HH24-MI-SS');
532 param_value(15) :=to_char(P_model_lookup_DATE,'MM-DD-YYYY-HH24-MI-SS');
533 else
534 aso_debug_pub.add('Create_header_xml: Effective date not provided, use profile instead ');
535 -- Added extra parameters for config effective and lookup date ER 3177722 and setting the value based on new profile ASO : Configuration Effective Date
536 if l_config_effective_date_prof='C' then -- set to creation date
537 param_value(14) := l_config_creation_date;
538 param_value(15) := l_config_creation_date;
539 elsif l_config_effective_date_prof='S' then -- set to current date
540 param_value(14) := to_char(sysdate,'MM-DD-YYYY-HH24-MI-SS');
541 param_value(15) := to_char(sysdate,'MM-DD-YYYY-HH24-MI-SS');
542 elsif l_config_effective_date_prof='F' then -- set to callback function Add code for callback function
543 ASO_QUOTE_HOOK.Get_Model_Configuration_Date
544 ( p_quote_header_id=>l_model_line_rec.quote_header_id,
545 P_QUOTE_LINE_ID=> l_model_line_rec.quote_line_id,
546 X_CONFIG_EFFECTIVE_DATE=> x_config_effective_date,
547 X_CONFIG_MODEL_LOOKUP_DATE=> x_config_lookup_date
548 );
549 param_value(14) := to_char(x_config_effective_date,'MM-DD-YYYY-HH24-MI-SS');
550 param_value(15) := to_char(x_config_lookup_date,'MM-DD-YYYY-HH24-MI-SS');
551
552 else -- profile not set
553 param_value(14) := null;
554 param_value(15) := null;
555 end if;
556 end if; -- p_effective_date
557
558 l_rec_index := 1;
559 -- aso_debug_pub.add('Create_header_xml: before forming xml loop ');
560 LOOP
561 -- ex : <param name="config_header_id">1890</param>
562
563 IF (param_value(l_rec_index) IS NOT NULL) THEN
564
565 l_dummy := '<param name=' ||
566 '"' || param_name(l_rec_index) || '"'
567 ||'>'|| param_value(l_rec_index) ||
568 '</param>';
569 -- aso_debug_pub.add('Create_header_xml: before forming xml loop '||length(l_dummy));
570 -- aso_debug_pub.add('Create_header_xml: before forming xml loop '||l_dummy);
571 --aso_debug_pub.add('Create_header_xml: before forming xml loop '||length(l_xml_hdr));
572 l_xml_hdr := l_xml_hdr || l_dummy;
573
574 END IF;
575
576 l_dummy := NULL;
577
578 l_rec_index := l_rec_index + 1;
579 EXIT WHEN l_rec_index > l_count;
580
581 END LOOP;
582
583 -- add termination tags
584
585 l_xml_hdr := l_xml_hdr || '</initialize>';
586 l_xml_hdr := REPLACE(l_xml_hdr, ' ' , '+');
587
588 IF aso_debug_pub.g_debug_flag = 'Y' THEN
589
590 aso_debug_pub.add('Create_header_xml: Length of l_xml_hdr mesg: '||length(l_xml_hdr));
591 aso_debug_pub.add('Create_header_xml: 1st Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 1, 100));
592 aso_debug_pub.add('Create_header_xml: 2nd Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 101, 100));
593 aso_debug_pub.add('Create_header_xml: 3rd Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 201, 100));
594 aso_debug_pub.add('Create_header_xml: 4th Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 301, 100));
595 aso_debug_pub.add('Create_header_xml: 5st Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 401, 100));
596 aso_debug_pub.add('Create_header_xml: 6nd Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 501, 100));
597 aso_debug_pub.add('Create_header_xml: 7rd Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 601, 100));
598 aso_debug_pub.add('Create_header_xml: 8th Part of l_xml_hdr is: '||SUBSTR(l_xml_hdr, 701, 100));
599
600 END IF;
601
602 x_xml_hdr := l_xml_hdr;
603
604 IF aso_debug_pub.g_debug_flag = 'Y' THEN
605 aso_debug_pub.add('End of Create_header_xml.', 1, 'Y');
606 END IF;
607
608
609 EXCEPTION
610
611 when others then
612
613 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
614
615 IF aso_debug_pub.g_debug_flag = 'Y' THEN
616 aso_debug_pub.add('Create_header_xml: Inside When Others Exception: x_return_status: '||x_return_status, 1, 'N');
617 END IF;
618
619 END Create_header_xml;
620
621
622
623 end ASO_VALIDATE_CFG_PVT;