DBA Data[Home] [Help]

PACKAGE BODY: APPS.QPR_MAINTAIN_AW

Source


1 PACKAGE BODY QPR_MAINTAIN_AW AS
2 /* $Header: QPRUMNTB.pls 120.3 2008/01/18 14:47:18 vinnaray noship $ */
3 
4 procedure maint_aw(p_plan_id number, p_clean_meas varchar2,
5 		p_clean_dim varchar2,
6 		p_include_dim varchar2);
7 
8 
9 
10 procedure log_debug(text varchar2) is
11 begin
12 	fnd_file.put_line( fnd_file.log, text);
13 end;
14 
15 FUNCTION get_day(p_time_pk varchar2, p_low_lvl_time varchar2) return date is
16 i_date date;
17 begin
18 
19 if p_low_lvl_time = 'MONTH'   then
20 	begin
21 	select day into i_date
22 	from qpr_time_allhier_v
23 	where month = p_time_pk
24 	and rownum<2;
25 	exception
26 	when others then null;
27 	end;
28 elsif p_low_lvl_time = 'FISCAL_MONTH'   then
29 	begin
30 	select day into i_date
31 	from qpr_time_allhier_v
32 	where fiscal_month = p_time_pk
33 	and rownum<2;
34 	exception
35 	when others then null;
36 	end;
37 elsif p_low_lvl_time = 'QUARTER'   then
38 	begin
39 	select day into i_date
40 	from qpr_time_allhier_v
41 	where quarter = p_time_pk
42 	and rownum<2;
43 	exception
44 	when others then null;
45 	end;
46 elsif p_low_lvl_time = 'FISCAL_QUARTER'   then
47 	begin
48 	select day into i_date
49 	from qpr_time_allhier_v
50 	where fiscal_quarter = p_time_pk
51 	and rownum<2;
52 	exception
53 	when others then null;
54 	end;
55 elsif p_low_lvl_time = 'YEAR'   then
56 	begin
57 	select day into i_date
58 	from qpr_time_allhier_v
59 	where year = p_time_pk
60 	and rownum<2;
61 	exception
62 	when others then null;
63 	end;
64 elsif p_low_lvl_time = 'FISCAL_YEAR'   then
65 	begin
66 	select day into i_date
67 	from qpr_time_allhier_v
68 	where fiscal_year = p_time_pk
69 	and rownum<2;
70 	exception
71 	when others then null;
72 	end;
73 end if;
74 return(i_date);
75 end;
76 
77 FUNCTION get_run_number return number is
78 begin
79 	return g_run_number;
80 end;
81 
82 FUNCTION get_instance return number is
83 begin
84 	return g_instance;
85 end;
86 
87 FUNCTION get_price_plan_id return number is
88 begin
89 	return g_price_plan_id;
90 end;
91 
92 FUNCTION get_calendar_code return varchar2 is
93 begin
94 	return g_calendar_code;
95 end;
96 
97 FUNCTION get_start_date return date is
98 begin
99 	return g_start_date;
100 end;
101 
102 FUNCTION get_end_date return date is
103 begin
104 	return g_end_date;
105 end;
106 
107 function get_base_uom return varchar2 is
108 begin
109     return g_base_uom;
110 end;
111 
112 function get_currency_code return varchar2 is
113 begin
114     return g_currency_code;
115 end;
116 
117 --LOB Functions
118 FUNCTION get_ORD_LINE return varchar2 is
119 begin
120 	return g_ord_line;
121 end;
122 
123 FUNCTION get_ITEM return varchar2 is
124 begin
125 	return g_item;
126 end;
127 
128 FUNCTION get_TP_SITE return varchar2 is
129 begin
130 	return g_tp_site;
131 end;
132 
133 FUNCTION get_CUS return varchar2 is
134 begin
135 	return g_cus;
136 end;
137 
138 FUNCTION get_OU return varchar2 is
139 begin
140 	return g_ou;
141 end;
142 
143 FUNCTION get_SR return varchar2 is
144 begin
145 	return g_sr;
146 end;
147 
148 FUNCTION get_CHN return varchar2 is
149 begin
150 	return g_chn;
151 end;
152 
153 FUNCTION get_ADJ return varchar2 is
154 begin
155 	return g_adj;
156 end;
157 
158 FUNCTION get_psg return varchar2 is
159 begin
160 	return g_psg;
161 end;
162 --
163 procedure insert_lob_values (p_dim_code varchar2,
164 				p_hierarchy_code varchar2,
165 				p_level_code varchar2,
166 				p_level_seq_num number,
167 				p_scope_value varchar2) is
168 
169 cursor c_level_values  is
170 	select level1_value from qpr_dimension_values
171 	where dim_code = p_dim_code
172 	and hierarchy_code = p_hierarchy_code
173 	and instance_id = g_instance
174 	and (decode(p_level_seq_num, 1, level1_value,
175 				 2, level2_value,
176 				 3, level3_value,
177 				 4, level4_value,
178 				 5, level5_value,null)=p_scope_value);
179 level_value_rec char240_type;
180 l_rows natural :=1000;
181 begin
182 	open c_level_values;
183 	loop
184 		level_value_rec.delete;
185 		fetch c_level_values bulk collect into
186 			level_value_rec limit l_rows;
187 		   FORALL I IN
188 		      1..level_value_rec.count
189 			INSERT INTO qpr_plan_measures
190 			(PRICE_PLAN_DATA_ID,
191 			PRICE_PLAN_ID,
192 			PRICE_PLAN_MEAS_GRP_ID,
193 			PRICE_PLAN_MEAS_GRP_NAME,
194 			run_number,
195 			attribute_1,
196 			CREATION_DATE,
197 			CREATED_BY,
198 			LAST_UPDATE_DATE,
199 			LAST_UPDATED_BY,
200 			LAST_UPDATE_LOGIN,
201 			REQUEST_ID) values
202 			(qpr_plan_measures_s.nextval,
203 			g_price_plan_id,
204 			decode(p_dim_code,
205 				'ORD', 1,
206 				'PRD', 2,
207 				'GEO', 3,
208 				'CUS', 4,
209 				'ORG', 5,
210 				'REP', 6,
211 				'CHN', 7,
212 				'PSG', 8,
213 				'ADJ', 0),
214 			p_level_code,
215 			g_run_number,
216 			level_value_rec(I)
217 			,SYSDATE
218 			,FND_GLOBAL.USER_ID
219 			,SYSDATE
220 			,FND_GLOBAL.USER_ID
221 			,FND_GLOBAL.CONC_LOGIN_ID
222 			,FND_GLOBAL.conc_request_id);
223 	exit when c_level_values%NOTFOUND;
224 	end loop;
225 	close c_level_values;
226 	commit;
227 end;
228 
229 procedure maintanance_process(
230                         errbuf              OUT NOCOPY VARCHAR2,
231                         retcode             OUT NOCOPY VARCHAR2,
232                         p_price_plan_id     NUMBER,
233 			p_from_date	    varchar2,
234 			p_to_date	    varchar2,
235 			p_clean_temp varchar2 default 'Y',
236 			p_clean_meas varchar2 default 'N',
237 			p_clean_dim varchar2 default 'N',
238 			p_include_dim varchar2 default 'Y',
239 			p_run_number number default 0) IS
240 
241 cursor c_scope_lines is
242 	select  a.level_id level_id, a.operator operator,
243 	a.scope_value scope_value, b.level_ppa_code level_ppa_code,
244 	b.level_seq_num level_seq_num, c.hierarchy_ppa_code hierarchy_ppa_code,
245 	c.dim_code dim_code
246 	from qpr_scopes a, qpr_hier_levels b, qpr_hierarchies_v c
247 	where b.price_plan_id= qpr_sr_util.g_datamart_tmpl_id
248   and b.hierarchy_level_id=a.level_id
249 	and b.hierarchy_id = c.hierarchy_id
250 	and a.parent_entity_type = 'DATAMART'
251   and a.parent_id = p_price_plan_id;
252 
253   i number := 1;
254   i_cube number;
255   l_rows natural :=1000;
256   p_sr_instance_id number;
257   l_scope_id number;
258   l_dummy number;
259   l_start_date date;
260   l_end_date date;
261   l_start_time number;
262   l_end_time number;
263   l_return_status varchar2(10);
264   l_msg_count number;
265   l_msg_data varchar2(30);
266 
267 Begin
268      log_debug('Starting...');
269      select hsecs into l_start_time from v$timer;
270      log_debug('Start time :'||to_char(sysdate,'MM/DD/YYYY:HH:MM:SS'));
271      begin
272 	select instance_id,
273 		base_uom_code, currency_code,
274 		start_date, end_date
275 	into p_sr_instance_id, g_base_uom,
276               g_currency_code,
277 	      l_start_date, l_end_date
278 	from qpr_price_plans_b
279 	where price_plan_id=p_price_plan_id
280 	and aw_created_flag = 'Y';
281     exception
282 	 WHEN NO_DATA_FOUND THEN
283 	    retcode := 2;
284 	    errbuf  := FND_MESSAGE.GET;
285 	    log_debug('Unexpected error '||substr(sqlerrm,1200));
286 	    Return;
287     end;
288     g_instance:=p_sr_instance_id;
289     g_price_plan_id := p_price_plan_id;
290     if p_run_number = 0 then
291 	fnd_profile.get('CONC_REQUEST_ID', g_run_number);
292     else
293     	g_run_number := p_run_number;
294     end if;
295 
296     log_debug('Price Plan read.');
297     begin
298     select calendar_code into g_calendar_code
299     from qpr_hierarchies_v
300     where price_plan_id=p_price_plan_id
301     --and dim_code = 'TIM'
302     and rownum<2
303     and hierarchy_ppa_code='FISCAL';
304     exception
305 	when others then null;
306     end;
307     g_start_date := fnd_date.canonical_to_date(p_from_date);
308     g_end_date := FND_DATE.canonical_to_date(p_to_date);
309 
310     if g_start_date is null or g_start_date < l_start_date then
311 	g_start_date := l_start_date;
312     end if;
313     if (g_end_date is null and l_end_date is not null) or
314        (g_end_date is not null and l_end_date is not null and
315 	g_end_date > l_end_date) then
316   	g_end_date := l_end_date;
317     end if;
318     begin
319 	select 1
320 	into l_dummy
321 	from qpr_measure_data
322 	where instance_id = g_instance
323 	and measure_type_code = 'SALESDATA'
324 	and time_level_value between g_start_date and
325 	nvl(g_end_date, time_level_value)
326 	and rownum<2;
327     exception
328 	 WHEN NO_DATA_FOUND THEN
329 	    retcode := 2;
330 	    errbuf  := FND_MESSAGE.GET;
331 	    log_debug('Unexpected error '||substr(sqlerrm,1200));
332 	    log_debug('No fact data found');
333 	    Return;
334     end;
335 
336     g_ord_line :=null;
337     g_item :=null;
338     g_tp_site :=null;
339     g_cus :=null;
340     g_ou :=null;
341     g_sr :=null;
342     g_chn :=null;
343     g_adj :=null;
344     g_psg :=null;
345 
346     for c_scope_lines_rec in c_scope_lines loop
347 	log_debug('inside scope loop '||c_scope_lines_rec.level_ppa_code);
348 	if c_scope_lines_rec.level_ppa_code = 'ORDER_LINE'
349 	or c_scope_lines_rec.level_ppa_code= 'MODEL'
350 	or c_scope_lines_rec.level_ppa_code= 'TOP_MODEL'
351 	or c_scope_lines_rec.level_ppa_code= 'ORDER'
352 	or c_scope_lines_rec.level_ppa_code= 'ORDER_TYPE' then
353 		log_debug('Inside '||c_scope_lines_rec.level_ppa_code);
354 		log_debug('Scope value '||c_scope_lines_rec.scope_value);
355 		g_ord_line := c_scope_lines_rec.scope_value;
356 	elsif c_scope_lines_rec.level_ppa_code= 'PRODUCT_FAMILY'
357 	or c_scope_lines_rec.level_ppa_code= 'PRODUCT_CATEGORY'
358 	or c_scope_lines_rec.level_ppa_code= 'ITEM' then
359 		log_debug('Inside '||c_scope_lines_rec.level_ppa_code);
360 		log_debug('Scope value '||c_scope_lines_rec.scope_value);
361 		g_item  := c_scope_lines_rec.scope_value;
362 	elsif c_scope_lines_rec.level_ppa_code= 'AREA'
363 	or c_scope_lines_rec.level_ppa_code= 'COUNTRY'
364 	or c_scope_lines_rec.level_ppa_code= 'REGION'
365 	or c_scope_lines_rec.level_ppa_code= 'GEO_SEGMENT'
366 	or c_scope_lines_rec.level_ppa_code= 'TRADING_PARTNER_SITE' then
367 		log_debug('Inside '||c_scope_lines_rec.level_ppa_code);
368 		log_debug('Scope value '||c_scope_lines_rec.scope_value);
369 		g_tp_site  := c_scope_lines_rec.scope_value;
370 	elsif c_scope_lines_rec.level_ppa_code= 'TRADING_PARTNER_CLASS'
371 	or c_scope_lines_rec.level_ppa_code= 'CUSTOMER_GROUP'
372 	or c_scope_lines_rec.level_ppa_code= 'TRADING_PARTNER' then
373 		log_debug('Inside '||c_scope_lines_rec.level_ppa_code);
374 		log_debug('Scope value '||c_scope_lines_rec.scope_value);
375 		g_cus  := c_scope_lines_rec.scope_value;
376 	elsif c_scope_lines_rec.level_ppa_code= 'LEGAL_ENTITY'
377 	or c_scope_lines_rec.level_ppa_code= 'BUSINESS_GROUP'
378 	or c_scope_lines_rec.level_ppa_code= 'OPERATING_UNIT' then
379 		log_debug('Inside '||c_scope_lines_rec.level_ppa_code);
380 		log_debug('Scope value '||c_scope_lines_rec.scope_value);
381 		g_ou  := c_scope_lines_rec.scope_value;
382 	elsif c_scope_lines_rec.level_ppa_code= 'SALES_CHANNEL' then
383 		log_debug('Inside '||c_scope_lines_rec.level_ppa_code);
384 		log_debug('Scope value '||c_scope_lines_rec.scope_value);
385 		g_chn  := c_scope_lines_rec.scope_value;
386 	elsif c_scope_lines_rec.level_ppa_code= 'PR_SEGMENT' then
387 		log_debug('Inside '||c_scope_lines_rec.level_ppa_code);
388 		log_debug('Scope value '||c_scope_lines_rec.scope_value);
389 		g_psg  := c_scope_lines_rec.scope_value;
390 	elsif c_scope_lines_rec.level_ppa_code= 'SALES_GROUP1'
391 	or c_scope_lines_rec.level_ppa_code= 'SALES_GROUP2'
392 	or c_scope_lines_rec.level_ppa_code= 'SALES_GROUP3'
393 	or c_scope_lines_rec.level_ppa_code= 'SALES_GROUP4'
394 	or c_scope_lines_rec.level_ppa_code= 'SALES_REP' then
395 		log_debug('Inside '||c_scope_lines_rec.level_ppa_code);
396 		log_debug('Scope value '||c_scope_lines_rec.scope_value);
397 		g_sr  := c_scope_lines_rec.scope_value;
398 	elsif c_scope_lines_rec.level_ppa_code= 'ADJUSTMENT'
399 	or c_scope_lines_rec.level_ppa_code= 'ADJUSTMENT_TYPE'
400 	or c_scope_lines_rec.level_ppa_code= 'ADJUSTMENT_GROUP' then
401 		log_debug('Inside '||c_scope_lines_rec.level_ppa_code);
402 		log_debug('Scope value '||c_scope_lines_rec.scope_value);
403 		g_adj  := c_scope_lines_rec.scope_value;
404 	end if;
405 	insert_lob_values(c_scope_lines_rec.dim_code,
406 				c_scope_lines_rec.hierarchy_ppa_code,
407 				c_scope_lines_rec.level_ppa_code,
408 				c_scope_lines_rec.level_seq_num,
409 				c_scope_lines_rec.scope_value);
410     end loop; --c_scope_lines
411 
412 select hsecs into l_start_time from v$timer;
413 log_debug('Start time :'||to_char(sysdate,'MM/DD/YYYY:HH:MM:SS'));
414 
415 log_debug('PricePlanId: '||p_price_plan_id);
416 
417 maint_aw(p_price_plan_id, p_clean_meas,
418 		p_clean_dim,
419 		p_include_dim);
420 
421 /*
422 This is not needed in deal management
423 log_debug('user plan initialization');
424 qpr_user_plan_init_pvt.Initialize
425 	(  p_api_version     =>1.0,
426 	   p_init_msg_list   =>FND_API.G_TRUE,
427 	 p_commit   =>FND_API.G_FALSE,
428 		p_validation_level=>FND_API.G_VALID_LEVEL_NONE,
429 		p_user_id          =>null,
430 		p_plan_id          =>p_price_plan_id,
431 		p_event_id         =>qpr_user_plan_init_pvt.g_maintain_datamart,
432 	 x_return_status    =>l_return_status,
433 	 x_msg_count =>l_msg_count,
437 		retcode := 1;
434 	 x_msg_data =>l_msg_data
435 	);
436 	if l_return_status <> FND_API.G_RET_STS_SUCCESS then
438 		log_debug('User Plan initialization is not fully successful');
439 	end if;
440 */
441 select hsecs into l_end_time from v$timer;
442 log_debug('End time :'||to_char(sysdate,'MM/DD/YYYY:HH:MM:SS'));
443 FND_FILE.PUT_LINE(FND_FILE.LOG, 'Time taken for AW Maintanance (sec):' ||
444 		(l_end_time - l_start_time)/100);
445 
446 if p_clean_temp='Y' then
447 	delete qpr_plan_measures
448 	where run_number=g_run_number;
449 end if;
450 	update qpr_price_plans_b
451 	set aw_status_code = 'PROCESS'
452 	where price_plan_id=p_price_plan_id;
453 	commit;
454 
455 exception
456  WHEN NO_DATA_FOUND THEN
457     retcode := 2;
458     errbuf  := FND_MESSAGE.GET;
459     log_debug('Unexpected error '||substr(sqlerrm,1200));
460 End;
461 /* Public Procedures */
462 
463 procedure maint_aw(p_plan_id number, p_clean_meas varchar2,
464 		p_clean_dim varchar2,
465 		p_include_dim varchar2) is
466 
467   cursor c_aw_dim is
468   select dim_code
469   from qpr_dimensions
470   where price_plan_id = p_plan_id;
471 
472   cursor c_cube_meas is
473   select a.cube_code cube_code,
474 	b.measure_ppa_code measure_ppa_code,
475 	c.measure_id measure_id
476   from qpr_cubes a, qpr_measures b, qpr_measures c
477   where a.cube_id=b.cube_id and
478   b.price_plan_id=p_plan_id
479   and b.measure_ppa_code = c.measure_ppa_code
480   and c.price_plan_id = qpr_sr_util.g_datamart_tmpl_id
481   and b.meas_type='INPUT'
482   order by a.cube_id, c.measure_id;
483 
484   cursor c_xml_load_log is
485   select xml_message
486   from olapsys.xml_load_log
487   where xml_loadid = (select max(xml_loadid) from olapsys.xml_load_log )
488   order by xml_date  ;
489 
490 
491 xml_clob clob;
492 xml_clob1 clob;
493 xml_clob2 clob;
494 xml_str varchar2(4000);
495 xml_str_temp varchar2(9000);
496 xml_str_temp1 varchar2(9000);
497 l_str varchar2(250);
498 --l_request_id number;
499 isAW number;
500 l_aw_name varchar2(30);
501 l_schem varchar2(5):='APPS';
502 measure_count number;
503 measure_limit number;
504 itr number ;
505 begin
506 
507 begin
508 	select  aw_code into l_aw_name
509 	from qpr_price_plans_b
510 	where price_plan_id= p_plan_id;
511 exception
512 	when others then null;
513 end;
514 
515 
516 select count(*) into measure_count
517 from qpr_cubes a, qpr_measures b
518 where a.cube_id=b.cube_id and
519 b.price_plan_id=p_plan_id
520 and b.meas_type='INPUT';
521 
522 
523 itr:=0;
524 
525 DBMS_LOB.CREATETEMPORARY(xml_clob,TRUE);
526 dbms_lob.open(xml_clob, DBMS_LOB.LOB_READWRITE);
527 l_str:='  <BuildDatabase ';
528 l_str:= l_str|| 'Id="Action'||g_run_number||'" ';
529 l_str:= l_str|| 'AWName="'||l_schem||'.'||l_aw_name||
530 		'" BuildType="EXECUTE" RunSolve="true" ';
531 if p_clean_meas = 'Y' then
532 	l_str:= l_str|| 'CleanMeasures="true" ';
533 else
534 	l_str:= l_str|| 'CleanMeasures="false" ';
535 end if;
536 if p_clean_dim = 'Y' then
537 	l_str:= l_str|| 'CleanAttrs="true" CleanDim="true" '||
538 			'trackStatus="false" MaxJobQueues="0">';
539 else
540 	l_str:= l_str|| 'CleanAttrs="false" CleanDim="false" '||
541 			'trackStatus="false" MaxJobQueues="0">';
542 end if;
543 dbms_lob.writeappend(xml_clob, length(l_str), l_str);
544 log_debug(l_str);
545 if p_include_dim = 'Y' then
546 	for c_aw_dim_rec in c_aw_dim loop
547 		log_debug(c_aw_dim_rec.dim_code);
548 		l_str:='	<BuildList XMLIDref="'||
549 			c_aw_dim_rec.dim_code||'.DIMENSION" />';
550 		dbms_lob.writeappend(xml_clob, length(l_str), l_str);
551 		log_debug(l_str);
552 	end loop;
553 end if;
554 for c_cube_meas_rec in c_cube_meas loop
555 	itr:=itr+1;
556 	l_str:= '	<BuildList XMLIDref="'||
557 			c_cube_meas_rec.cube_code||'.'||
558 			c_cube_meas_rec.measure_ppa_code||'.MEASURE" />';
559 	if measure_count > 40 and itr > 40 then
560 		if measure_count > 83 and itr > 83 then
561 			xml_str_temp1:=xml_str_temp1 || l_str;
562 		else
563 			xml_str_temp:=xml_str_temp || l_str;
564 		end if;
565 	else
566 		dbms_lob.writeappend(xml_clob, length(l_str), l_str);
567 		log_debug(l_str);
568 	end if;
569 end loop;
570 dbms_lob.writeappend(xml_clob, 18, '  </BuildDatabase>');
571 dbms_lob.close(xml_clob);
572 xml_str := sys.interactionExecute(xml_clob);
573 log_debug(xml_str);
574 for c_xml_load_log_rec in c_xml_load_log loop
575 	log_debug(c_xml_load_log_rec.xml_message);
576 end loop;
577 
578 if xml_str_temp is not null then
579 	log_debug('Second Load');
580 	DBMS_LOB.CREATETEMPORARY(xml_clob1,TRUE);
581 	dbms_lob.open(xml_clob1, DBMS_LOB.LOB_READWRITE);
582 	l_str:='  <BuildDatabase ';
583 	l_str:= l_str|| 'Id="Action1'||g_run_number||'" ';
584 	l_str:= l_str|| 'AWName="'||l_schem||'.'||l_aw_name||
585 			'" BuildType="EXECUTE" RunSolve="true" ';
586 	if p_clean_meas = 'Y' then
587 		l_str:= l_str|| 'CleanMeasures="true" ';
588 	else
589 		l_str:= l_str|| 'CleanMeasures="false" ';
590 	end if;
591 	if p_clean_dim = 'Y' then
592 		l_str:= l_str|| 'CleanAttrs="true" CleanDim="true" '||
593 				'trackStatus="false" MaxJobQueues="0">';
594 	else
595 		l_str:= l_str|| 'CleanAttrs="false" CleanDim="false" '||
596 				'trackStatus="false" MaxJobQueues="0">';
597 	end if;
598 	dbms_lob.writeappend(xml_clob1, length(l_str), l_str);
599 	dbms_lob.writeappend(xml_clob1, length(xml_str_temp), xml_str_temp);
600 	log_debug(l_str);
601 	log_debug(xml_str_temp);
605 	log_debug(xml_str);
602 	dbms_lob.writeappend(xml_clob1, 18, '  </BuildDatabase>');
603 	dbms_lob.close(xml_clob1);
604 	xml_str := sys.interactionExecute(xml_clob1);
606 	for c_xml_load_log_rec in c_xml_load_log loop
607 		log_debug(c_xml_load_log_rec.xml_message);
608 	end loop;
609 end if;
610 
611 if xml_str_temp1 is not null then
612 	log_debug('Third Load');
613 	DBMS_LOB.CREATETEMPORARY(xml_clob2,TRUE);
614 	dbms_lob.open(xml_clob2, DBMS_LOB.LOB_READWRITE);
615 	l_str:='  <BuildDatabase ';
616 	l_str:= l_str|| 'Id="Action2'||g_run_number||'" ';
617 	l_str:= l_str|| 'AWName="'||l_schem||'.'||l_aw_name||
618 			'" BuildType="EXECUTE" RunSolve="true" ';
619 	if p_clean_meas = 'Y' then
620 		l_str:= l_str|| 'CleanMeasures="true" ';
621 	else
622 		l_str:= l_str|| 'CleanMeasures="false" ';
623 	end if;
624 	if p_clean_dim = 'Y' then
625 		l_str:= l_str|| 'CleanAttrs="true" CleanDim="true" '||
626 				'trackStatus="false" MaxJobQueues="0">';
627 	else
628 		l_str:= l_str|| 'CleanAttrs="false" CleanDim="false" '||
629 				'trackStatus="false" MaxJobQueues="0">';
630 	end if;
631 	dbms_lob.writeappend(xml_clob2, length(l_str), l_str);
632 	dbms_lob.writeappend(xml_clob2, length(xml_str_temp1), xml_str_temp1);
633 	log_debug(l_str);
634 	log_debug(xml_str_temp1);
635 	dbms_lob.writeappend(xml_clob2, 18, '  </BuildDatabase>');
636 	dbms_lob.close(xml_clob2);
637 	xml_str := sys.interactionExecute(xml_clob2);
638 	log_debug(xml_str);
639 	for c_xml_load_log_rec in c_xml_load_log loop
640 		log_debug(c_xml_load_log_rec.xml_message);
641 	end loop;
642 end if;
643 end;
644 
645 END QPR_MAINTAIN_AW ;
646