DBA Data[Home] [Help]

PACKAGE BODY: APPS.AS_VALIDATE_SETUP

Source


1 PACKAGE BODY AS_VALIDATE_SETUP as
2 /* $Header: asxsetvb.pls 120.9 2006/09/01 09:51:05 mohali noship $ */
3 
4 PROCEDURE Write_Log(p_module in VARCHAR2, msg in VARCHAR2)
5 IS
6     l_length        NUMBER;
7     l_start         NUMBER := 1;
8     l_substring     VARCHAR2(77);
9     l_debug BOOLEAN := FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW);
10 BEGIN
11     IF l_debug THEN
12        	AS_UTILITY_PVT.Debug_Message(p_module, FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, msg);
13     ELSE
14 	    -- chop the message to 77 long
15 	    l_length := length(msg);
16 	    WHILE l_length > 77 LOOP
17 		l_substring := substr(msg, l_start, 77);
18 		FND_FILE.PUT_LINE(FND_FILE.LOG, l_substring);
19 		l_start := l_start + 77;
20 		l_length := l_length - 77;
21 	    END LOOP;
22 	    l_substring := substr(msg, l_start);
23 	    FND_FILE.PUT_LINE(FND_FILE.LOG, l_substring);
24     END IF;
25 EXCEPTION
26     WHEN others THEN
27         FND_FILE.PUT_LINE(FND_FILE.LOG, 'Exception: others in Write_Log');
28         FND_FILE.PUT_LINE(FND_FILE.LOG,
29                'SQLCODE ' || to_char(SQLCODE) ||
30                ' SQLERRM ' || substr(SQLERRM, 1, 100));
31 END Write_Log;
32 
33 FUNCTION Get_Profile_Site_Value(
34     p_NAME      VARCHAR2) RETURN VARCHAR2
35 IS
36     Cursor c_prof_value IS
37     SELECT v.PROFILE_OPTION_VALUE
38     FROM FND_PROFILE_OPTIONS b, FND_PROFILE_OPTION_VALUES v
39     WHERE b.APPLICATION_ID=279
40       AND b.PROFILE_OPTION_NAME=p_name
41       AND v.PROFILE_OPTION_ID=b.PROFILE_OPTION_ID
42       AND v.level_id=10001;
43     l_value VARCHAR2(240);
44 BEGIN
45     OPEN c_prof_value;
46     FETCH c_prof_value INTO l_value;
47     CLOSE c_prof_value;
48     RETURN l_value;
49 END Get_Profile_Site_Value;
50 
51 FUNCTION Get_Profile_JTF_Site_Value(
52     p_NAME      VARCHAR2) RETURN VARCHAR2
53 IS
54     Cursor c_prof_value IS
55     SELECT v.PROFILE_OPTION_VALUE
56     FROM FND_PROFILE_OPTIONS b, FND_PROFILE_OPTION_VALUES v
57     WHERE b.APPLICATION_ID=690
58       AND b.PROFILE_OPTION_NAME=p_name
59       AND v.PROFILE_OPTION_ID=b.PROFILE_OPTION_ID
60       AND v.level_id=10001;
61     l_value VARCHAR2(240);
62 BEGIN
63     OPEN c_prof_value;
64     FETCH c_prof_value INTO l_value;
65     CLOSE c_prof_value;
66     RETURN l_value;
67 END Get_Profile_JTF_Site_Value;
68 
69 PROCEDURE Validate_Setup(
70     ERRBUF      out NOCOPY VARCHAR2,
71     RETCODE     out NOCOPY VARCHAR2,
72     p_upgrade   IN VARCHAR2)
73 IS
74     CURSOR C_Get_Stage_Info (c_SALES_STAGE_ID NUMBER) IS
75       SELECT  nvl(min_win_probability, 0), nvl(max_win_probability, 100)
76       FROM  as_sales_stages_all_b
77       WHERE sales_stage_id = c_Sales_Stage_Id;
78 
79     cursor Get_FileDebugDir IS
80       select rtrim(ltrim(value)) from v$parameter
81       where upper(name) = 'UTL_FILE_DIR';
82 
83     -- SOLIN, 06/12/2001
84     CURSOR C_GET_MISSING_OPP_CURR IS
85         SELECT OPP.CURRENCY_CODE
86         FROM AS_LEADS_ALL OPP
87         WHERE OPP.CURRENCY_CODE NOT IN (
88             SELECT LOOKUP.LOOKUP_CODE
89             FROM FND_LOOKUP_VALUES LOOKUP
90             WHERE LOOKUP.LOOKUP_TYPE = 'REPORTING_CURRENCY'
91             AND LOOKUP.ENABLED_FLAG = 'Y');
92     -- end SOLIN, 06/12/2001
93 
94     l_write_dir          VARCHAR2(2000);
95 
96     l_sales_stage_id    NUMBER := to_number(GET_PROFILE_SITE_VALUE('AS_OPP_SALES_STAGE'));
97     l_win_prob      NUMBER := to_number(GET_PROFILE_SITE_VALUE('AS_OPP_WIN_PROBABILITY'));
98     l_prob_ss_link  VARCHAR2(10) :=
99             NVL(Get_Profile_Site_Value('AS_OPPTY_PROB_SS_LINK'), 'WARNING');
100 
101     l_cust_access   VARCHAR2(240) := GET_PROFILE_SITE_VALUE('AS_CUST_ACCESS');
102     l_opp_access    VARCHAR2(240) := GET_PROFILE_SITE_VALUE('AS_OPP_ACCESS');
103     l_lead_access   VARCHAR2(240) := GET_PROFILE_SITE_VALUE('AS_LEAD_ACCESS');
104 
105     l_mgr_update    VARCHAR2(240) := Get_Profile_Site_Value('AS_MGR_UPDATE');
106     l_admin_update  VARCHAR2(240) := Get_Profile_Site_Value('AS_ADMIN_UPDATE');
107 
108     l_opp_status    VARCHAR2(240) := Get_Profile_Site_Value('AS_OPP_STATUS');
109     l_opp_closing   VARCHAR2(240) :=
110                 Get_Profile_Site_Value('AS_OPP_CLOSING_DATE_DAYS');
111 
112     l_fst_credit_type   VARCHAR2(240) :=
113                 Get_Profile_Site_Value('AS_FORECAST_CREDIT_TYPE_ID');
114     l_cn_credit_type    VARCHAR2(240) :=
115                 Get_Profile_Site_Value('AS_COMPENSATION_CREDIT_TYPE_ID');
116     l_opp_channel   VARCHAR2(240) :=
117                 Get_Profile_Site_Value('AS_OPP_SALES_CHANNEL');
118     l_mc_roll_days  VARCHAR2(240) :=
119                 Get_Profile_Site_Value('AS_MC_MAX_ROLL_DAYS');
120     l_mc_mapping_type   VARCHAR2(240) :=
121                 Get_Profile_Site_Value('AS_MC_DATE_MAPPING_TYPE');
122     l_mc_conv_type  VARCHAR2(240) :=
123                 Get_Profile_Site_Value('AS_MC_DAILY_CONVERSION_TYPE');
124     l_fst_calendar  VARCHAR2(240) :=
125                 Get_Profile_Site_Value('AS_FORECAST_CALENDAR');
126     l_prefer_currency   VARCHAR2(240) :=
127                 Get_Profile_Site_Value('AS_PREFERRED_CURRENCY');
128     l_default_currency  VARCHAR2(240) :=
129                 Get_Profile_JTF_Site_Value('JTF_PROFILE_DEFAULT_CURRENCY');
130 -- fix for Bug#3256105
131 /*    l_prod_org      VARCHAR2(240) :=
132                 Get_Profile_Site_Value('ASO_PRODUCT_ORGANIZATION_ID');*/
133 
134     l_count     NUMBER;
135     l_curr_code         VARCHAR2(15);
136 
137     l_min_winprob   NUMBER;
138     l_max_winprob   NUMBER;
139 
140     l_err_num       BINARY_INTEGER;
141     l_err_total     BINARY_INTEGER;
142     l_warn_total    BINARY_INTEGER;
143     l_module CONSTANT VARCHAR2(255) := 'as.plsql.setv.Validate_Setup';
144 
145 BEGIN
146 
147     l_err_total := 0;
148     l_warn_total := 0;
149     IF p_upgrade = 'N' THEN
150     Write_Log(l_module, '**** Run time checking for Oracle Sales application ****');
151     ELSE
152     Write_Log(l_module, '**** Setup checking for Oracle Sales 11i data migration');
153     OPEN Get_FileDebugDir;
154     FETCH Get_FileDebugDir into l_write_dir;
155         IF(l_write_dir IS NULL) THEN
156         CLOSE Get_FileDebugDir;
157         l_err_total := l_err_total+1;
158         Write_Log(l_module, ' ');
159         Write_Log(l_module, 'Error('||to_char(l_err_total)||
160             '): no directory defined in utl_file_dir.');
161         Write_Log(l_module, ' ');
162     ELSE
163         CLOSE Get_FileDebugDir;
164         Write_Log(l_module, ' ');
165         Write_Log(l_module, 'Success: found valid directory '
166             ||'for migration log file.');
167         Write_Log(l_module, ' ');
168         END IF;
169     END IF;
170 
171     -- checking Security Setup
172     l_err_num := 0;
173     IF p_upgrade = 'N' THEN
174         Write_Log(l_module, '**** Checking the setup for Access security ****');
175         IF l_cust_access IS NULL THEN
176         l_err_num := l_err_num+1;
177         l_err_total := l_err_total+1;
178         Write_Log(l_module, ' ');
179         Write_Log(l_module, 'Error('||to_char(l_err_total)||
180            '): Default value is missing in profile ''OS: Customer Access Privilege''');
181         ELSE
182         Write_Log(l_module, ' ');
183         Write_Log(l_module, 'Success: profile '||
184         '''OS: Customer Access Privilege'' has value <'
185         ||l_cust_access||'> at site level');
186         END IF;
187         IF l_lead_access IS NULL THEN
188         l_err_num := l_err_num+1;
189         l_err_total := l_err_total+1;
190         Write_Log(l_module, ' ');
191         Write_Log(l_module, 'Error('||to_char(l_err_total)||
192            '): Default value is missing in profile ''OS: Sales Lead Access Privilege''');
193         ELSE
194         Write_Log(l_module, ' ');
195         Write_Log(l_module, 'Success: profile '
196         ||'''OS: Sales Lead Access Privilege'' has value <'
197         ||l_lead_access||'> at site level.');
198         END IF;
199         IF l_opp_access IS NULL THEN
200         l_err_num := l_err_num+1;
201         l_err_total := l_err_total+1;
202         Write_Log(l_module, ' ');
203         Write_Log(l_module, 'Error('||to_char(l_err_total)||
204             '): Default value is missing in profile '||
205             '''OS: Opportunity Access Privilege''');
206         ELSE
207         Write_Log(l_module, ' ');
208         Write_Log(l_module, 'Success: profile '
209         ||'''OS: Opportunity Access Privilege'' has value <'
210         ||l_opp_access||'> at site level.');
211         END IF;
212         IF l_cust_access = 'T' AND (l_lead_access IN ('F', 'P')
213         OR l_opp_access IN ('F', 'P')) THEN
214         l_err_num := l_err_num+1;
215         l_err_total := l_err_total+1;
216         Write_Log(l_module, ' ');
217         Write_Log(l_module, 'Error('||to_char(l_err_total)||
218            '): Invalid combination of access privilege profiles.');
219         Write_Log(l_module, ' ');
220         Write_Log(l_module, 'If OS: Customer Access Privilege set to '||
221         'Sales Team, you cannot set either Sales Lead Access '||
222         'Privilege or opportunity Access Privilege to Full or Prospecting.');
223         ELSE
224         Write_Log(l_module, ' ');
225         Write_Log(l_module, 'Success: no invalid combination of access privilege profiles.');
226         END IF;
227         IF l_mgr_update IS NULL THEN
228         l_err_num := l_err_num+1;
229         l_err_total := l_err_total+1;
230         Write_Log(l_module, ' ');
231         Write_Log(l_module, 'Error('||to_char(l_err_total)||
232            '): Default value is missing in profile ''OS: Manager Update Access''');
233         ELSE
234         Write_Log(l_module, ' ');
235         Write_Log(l_module, 'Success: profile '
236         ||'''OS: Manager Update Access'' has value <'
237         ||l_mgr_update||'> at site level.');
238         END IF;
239         IF l_admin_update IS NULL THEN
240         l_err_num := l_err_num+1;
241         l_err_total := l_err_total+1;
242         Write_Log(l_module, ' ');
243         Write_Log(l_module, 'Error('||to_char(l_err_total)||
244            '): Default value is missing in profile ''OS: Sales Admin Update Access''');
245         ELSE
246         Write_Log(l_module, ' ');
247         Write_Log(l_module, 'Success: profile '
248         ||'''OS: Sales Admin Update Access'' has value <'
249         ||l_admin_update||'> at site level.');
250         END IF;
251     Write_Log(l_module, ' ');
252         Write_Log(l_module, '**** '||to_char(l_err_num)
253         ||' error(s) found in  Security setup ****');
254         Write_Log(l_module, '+---------------------------------------'||
255         '------------------------------------+');
256     END IF;
257     -- checking TCA Setup
258     IF p_upgrade = 'Y' THEN
259         l_err_num := 0;
260         Write_Log(l_module, ' ');
261         Write_Log(l_module, '**** Checking the setup for TCA/Resource module ****');
262         BEGIN
263     SELECT count(*) INTO l_count
264     FROM AS_CONTACT_FAMILY cf
265     WHERE not exists
266       ( select aslkp.lookup_code
267         , arlkp.lookup_code
268         from AS_LOOKUPS aslkp
269         ,AR_LOOKUPS arlkp
270         ,AS_CONTACT_FAMILY acf
271         where aslkp.lookup_type = 'CONTACT_RELATION'
272           and upper(ltrim(rtrim(aslkp.meaning))) =
273           upper(ltrim(rtrim(acf.relation)))
274           and arlkp.lookup_type = 'PARTY_RELATIONS_TYPE'
275           and instr(arlkp.lookup_code , aslkp.lookup_code) > 0
276           and cf.family_id = acf.family_id );
277         EXCEPTION
278             WHEN OTHERS THEN
279                 l_count := 0;
280         END;
281     IF l_count > 0 THEN
282         l_err_num := l_err_num+1;
283         l_err_total := l_err_total+1;
284         Write_Log(l_module, ' ');
285         Write_Log(l_module, 'Error('||to_char(l_err_total)
286         ||'): Contact Relation is not set in TCA');
287         ELSE
288         Write_Log(l_module, ' ');
289         Write_Log(l_module, 'Success: no invalid Contact Relation in AS_CONTACT_FAMILY');
290     END IF;
291 
292         BEGIN
293     SELECT count(*) INTO l_count FROM RA_SALESREPS_ALL rrep
294     WHERE not exists
295         (select 1 from OE_SALES_CREDIT_TYPES osct
296          where rrep.sales_credit_type_id = osct.sales_credit_type_id);
297         EXCEPTION
298             WHEN OTHERS THEN
299                 l_count := 0;
300         END;
301 
302     IF l_count > 0 THEN
303         l_err_num := l_err_num+1;
304         l_err_total := l_err_total+1;
305         Write_Log(l_module, ' ');
306         Write_Log(l_module, 'Error('||to_char(l_err_total)
307         ||'): bad data found in RA_SALESREPS_ALL');
308         Write_Log(l_module, 'The sales_credit_type of the salesrep must be'
309         ||' defined in OE_SALES_CREDIT_TYPES');
310         ELSE
311         Write_Log(l_module, ' ');
312         Write_Log(l_module, 'Success: all salesrep in RA_SALESREPS_ALL have valid sales credit type');
313     END IF;
314 
315         BEGIN
316     SELECT count(*) INTO l_count FROM RA_SALESREPS_ALL
317     WHERE (start_date_active > end_date_active
318         AND start_date_active is not null
319         AND end_date_active is not null)
320        OR (start_date_active is null
321         AND end_date_active is not null);
322         EXCEPTION
323             WHEN OTHERS THEN
324                 l_count := 0;
325         END;
326     IF l_count > 0 THEN
327         l_err_num := l_err_num+1;
328         l_err_total := l_err_total+1;
329         Write_Log(l_module, ' ');
330         Write_Log(l_module, 'Error('||to_char(l_err_total)
331         ||'): bad data found in RA_SALESREPS_ALL');
332         Write_Log(l_module, 'The start_date_active of the salesrep must earlier '
333         ||'than the end_date_active');
334         ELSE
335         Write_Log(l_module, ' ');
336         Write_Log(l_module, 'Success: all salesrep in RA_SALESREPS_ALL have '
337         ||'valid active date');
338     END IF;
339 
340         BEGIN
341     SELECT count(*) INTO l_count FROM (select salesrep_number
342             from RA_SALESREPS_ALL
343             group by salesrep_number having count(1) > 1);
344         EXCEPTION
345             WHEN OTHERS THEN
346                 l_count := 0;
347         END;
348     IF l_count > 0 THEN
349         l_err_num := l_err_num+1;
350         l_err_total := l_err_total+1;
351         Write_Log(l_module, ' ');
352         Write_Log(l_module, 'Error('||to_char(l_err_total)
353         ||'): found duplicate SALESREP_NUMBER in RA_SALESREPS_ALL');
354         ELSE
355         Write_Log(l_module, ' ');
356         Write_Log(l_module, 'Success: no duplicate SALESREP_NUMBER found '
357         ||'in RA_SALESREPS_ALL');
358     END IF;
359 
360 /*        BEGIN
361     SELECT count(*) INTO l_count
362     FROM AS_SALES_GROUPS a, AS_SALESFORCE b
363     WHERE a.manager_person_id = b.employee_person_id
364       and a.manager_salesforce_id <> b.salesforce_id
365       and b.type = 'EMPLOYEE';
366         EXCEPTION
367             WHEN OTHERS THEN
368                 l_count := 0;
369         END;
370     IF l_count > 0 THEN
371         l_err_num := l_err_num+1;
372         l_err_total := l_err_total+1;
373         Write_Log(l_module, ' ');
374         Write_Log(l_module, 'Error('||to_char(l_err_total)
375         ||'): Dangling FK to AS_SALESFORCE found in AS_SALES_GROUPS');
376         ELSE
377         Write_Log(l_module, ' ');
378         Write_Log(l_module, 'Success: manager_salesforce_id in AS_SALES_GROUPS'
379         ||' exists in AS_SALESFORCE');
380     END IF;*/
381 
382         BEGIN
383     SELECT count(*) INTO l_count
384     FROM AS_SALES_GRP_ADMIN sga
385     WHERE not exists
386         ( select 1 from PER_ALL_PEOPLE_F per
387           where per.person_id = sga.person_id )
388       and not exists
389         ( select 1 from AS_SALESFORCE sf
390           where sf.salesforce_id = sga.salesforce_id );
391         EXCEPTION
392             WHEN OTHERS THEN
393                 l_count := 0;
394         END;
395     IF l_count > 0 THEN
396         l_err_num := l_err_num+1;
397         l_err_total := l_err_total+1;
398         Write_Log(l_module, ' ');
399         Write_Log(l_module, 'Error('||to_char(l_err_total)
400         ||'): found record(s) with invalid person_id/salesforce_id'
401         ||' in AS_SALES_GRP_ADMIN');
402         ELSE
403         Write_Log(l_module, ' ');
404         Write_Log(l_module, 'Success: records in AS_SALES_GRP_ADMIN'
405         ||' having valid person_id/salesforce_id');
406     END IF;
407 
408         BEGIN
409     SELECT count(*) INTO l_count
410     FROM AS_SALES_GRP_ADMIN a, AS_SALESFORCE b
411     WHERE a.salesforce_id <> b.salesforce_id
412       and a.person_id = b.employee_person_id
413       and b.type = 'EMPLOYEE';
414         EXCEPTION
415             WHEN OTHERS THEN
416                 l_count := 0;
417         END;
418     IF l_count > 0 THEN
419         l_err_num := l_err_num+1;
420         l_err_total := l_err_total+1;
421         Write_Log(l_module, ' ');
422         Write_Log(l_module, 'Error('||to_char(l_err_total)
423         ||'): Dangling FK to AS_SALESFORCE found in AS_SALES_GRP_ADMIN');
424         ELSE
425         Write_Log(l_module, ' ');
426         Write_Log(l_module, 'Success: salesforce_id in AS_SALES_GRP_ADMIN'
427         ||' exists in AS_SALESFORCE');
428     END IF;
429 
430 /*        BEGIN
431     SELECT count(*) INTO l_count
432     FROM AS_SALES_GRP_ADMIN sga
433     WHERE not exists
434       ( select 1 from AS_SALES_GROUPS sg
435         where sga.sales_group_id = sg.sales_group_id );
436         EXCEPTION
437             WHEN OTHERS THEN
438                 l_count := 0;
439         END;
440     IF l_count > 0 THEN
441         l_err_num := l_err_num+1;
442         l_err_total := l_err_total+1;
443         Write_Log(l_module, ' ');
444         Write_Log(l_module, 'Error('||to_char(l_err_total)
445         ||'): found record(s) with invalid sales_group_id'
446         ||' in AS_SALES_GRP_ADMIN');
447         ELSE
448         Write_Log(l_module, ' ');
449         Write_Log(l_module, 'Success: sales_group_id in AS_SALES_GRP_ADMIN'
450         ||' exists in AS_SALES_GROUPS');
451     END IF;
452 */
453     Write_Log(l_module, ' ');
454         Write_Log(l_module, '**** '||to_char(l_err_num)
455         ||' error(s) found in  TCA/Resource setup ****');
456 
457     Write_Log(l_module, '+-------------------------------------'||
458         '--------------------------------------+');
459 
460         l_err_num := 0;
461         Write_Log(l_module, ' ');
462         Write_Log(l_module, '**** Checking the setup for Task/Interaction module ****');
463 
464         BEGIN
465     SELECT count(*) INTO l_count
466         FROM AS_LOOKUPS aslkp
467     WHERE aslkp.lookup_type = 'TODO'
468         and not exists
469             ( select 1 from JTF_TASK_TYPES_VL
470               where upper(rtrim(ltrim(aslkp.meaning))) =
471             upper(rtrim(ltrim(name))));
472         EXCEPTION
473             WHEN OTHERS THEN
474                 l_count := 0;
475         END;
476     IF l_count > 0 THEN
477         l_err_num := l_err_num+1;
478         l_err_total := l_err_total+1;
479         Write_Log(l_module, ' ');
480         Write_Log(l_module, 'Error('||to_char(l_err_total)
481         ||'): Lookup_Type ''TODO'' has some lookup code(s), which are not'
482         ||' defined in JTF_TASK_TYPES_VL');
483         ELSE
484         Write_Log(l_module, ' ');
485         Write_Log(l_module, 'Success: all lookup codes for ''TODO'''
486         ||' have been setup in JTF_TASK_TYPES_VL');
487     END IF;
488 
489         BEGIN
490     SELECT count(*) INTO l_count
491     FROM AS_LOOKUPS aslkp
492     WHERE aslkp.lookup_type = 'TODO_PRIORITY'
493         and not exists
494         ( select 1 from JTF_TASK_PRIORITIES_VL
495           where upper(rtrim(ltrim(aslkp.meaning))) =
496             upper(rtrim(ltrim(name))));
497         EXCEPTION
498             WHEN OTHERS THEN
499                 l_count := 0;
500         END;
501     IF l_count > 0 THEN
502         l_err_num := l_err_num+1;
503         l_err_total := l_err_total+1;
504         Write_Log(l_module, ' ');
505         Write_Log(l_module, 'Error('||to_char(l_err_total)
506         ||'): Lookup_Type ''TODO_PRIORITY'' has some lookup code(s), '
507         ||'which are not defined in JTF_TASK_PRIORITIES_VL');
508         ELSE
509         Write_Log(l_module, ' ');
510         Write_Log(l_module, 'Success: all lookup codes for ''TODO_PRIORITY'''
511         ||' have been setup in JTF_TASK_PRIORITIES_VL');
512     END IF;
513 
514         BEGIN
515     SELECT count(*) INTO l_count
516     FROM AS_LOOKUPS aslkp
517     WHERE aslkp.lookup_type = 'INTERACTION_TYPE'
518         and aslkp.lookup_code not in ('MAIL_BLITZ','MAILED_IN_RESPONSE'
519         ,'INBOUND','OUTBOUND','VISIT')
520         and not exists
521          ( select 1 from FND_LOOKUP_VALUES flv
522               where flv.lookup_code = aslkp.lookup_code
523               and flv.lookup_type = 'JTF_MEDIA_TYPE' );
524         EXCEPTION
525             WHEN OTHERS THEN
526                 l_count := 0;
527         END;
528     IF l_count > 0 THEN
529         l_err_num := l_err_num+1;
530         l_err_total := l_err_total+1;
531         Write_Log(l_module, ' ');
532         Write_Log(l_module, 'Error('||to_char(l_err_total)
533         ||'): Lookup_Type ''INTERACTION_TYPE'' has some lookup code(s), '
534         ||'which are not defined in lookup_type ''JTF_MEDIA_TYPE''');
535         ELSE
536         Write_Log(l_module, ' ');
537         Write_Log(l_module, 'Success: all lookup codes for ''INTERACTION_TYPE'''
538         ||' have been setup in lookup_type ''JTF_MEDIA_TYPE''');
539     END IF;
540     Write_Log(l_module, ' ');
541         Write_Log(l_module, '**** '||to_char(l_err_num)
542         ||' error(s) found in  Task/Interaction setup ****');
543     Write_Log(l_module, '+-------------------------------------'||
544         '--------------------------------------+');
545     END IF;
546 
547     -- checking Opportunity Setup
548     l_err_num := 0;
549     Write_Log(l_module, '**** Checking the setup for Opportunity module ****');
550     IF p_upgrade = 'N' THEN
551         IF l_opp_status IS NULL THEN
552         l_err_num := l_err_num+1;
553         l_err_total := l_err_total+1;
554         Write_Log(l_module, ' ');
555         Write_Log(l_module, 'Error('||to_char(l_err_total)||
556         '): Default value is missing in profile ''OS: Default Opportunity Status''');
557         ELSE
558         Write_Log(l_module, ' ');
559         Write_Log(l_module, 'Success: profile '
560         ||'''OS: Default Opportunity Status'' has value <'
561         ||l_opp_status||'> at site level.');
562         END IF;
563         IF l_win_prob IS NULL THEN
564         l_err_num := l_err_num+1;
565         l_err_total := l_err_total+1;
566         Write_Log(l_module, ' ');
567         Write_Log(l_module, 'Error('||to_char(l_err_total)||
568         '): Default value is missing in profile '
569         ||'''OS: Default Opportunity Win Probability''');
570         ELSE
571         Write_Log(l_module, ' ');
572         Write_Log(l_module, 'Success: profile '
573         ||'''OS: Default Opportunity Win Probability'' has value <'
574         ||l_win_prob||'> at site level.');
575     END IF;
576         IF l_sales_stage_id IS NULL THEN
577         l_err_num := l_err_num+1;
578         l_err_total := l_err_total+1;
579         Write_Log(l_module, ' ');
580         Write_Log(l_module, 'Error('||to_char(l_err_total)||
581         '): Default value is missing in profile '
582         ||'''OS: Default Opportunity Sales Stage''');
583         ELSE
584         Write_Log(l_module, ' ');
585         Write_Log(l_module, 'Success: profile '||
586         '''OS: Default Opportunity Sales Stage'' has ID value <'
587         ||l_sales_stage_id||'> at site level.');
588             OPEN  C_Get_Stage_Info (l_SALES_STAGE_ID);
589             FETCH C_Get_Stage_Info into l_min_winprob, l_max_winprob;
590             IF C_Get_Stage_Info%NOTFOUND THEN
591             Write_Log(l_module, ' ');
592             Write_Log(l_module, 'Error('||to_char(l_err_total)||
593             '): Profile ''OS: Default Opportunity Sales Stage'' '||
594             'has an invalid value');
595                 l_err_num := l_err_num+1;
596             l_err_total := l_err_total+1;
597             ELSIF l_min_winprob > l_win_prob OR l_max_winprob < l_win_prob THEN
598                 IF l_prob_ss_link = 'WARNING' THEN
599                 l_warn_total := l_warn_total+1;
600             Write_log(l_module, ' ');
601                 Write_log(l_module, 'Warning('||to_char(l_warn_total)||
602              '): The value combination of profile ''OS: '||
603             'Default Opportunity Sales Stage'' and ''OS: '||
604             'Default Opportunity Win Probability'' is not valid');
605                 ELSIF l_prob_ss_link = 'ERROR' THEN
606                     l_err_num := l_err_num+1;
607             l_err_total := l_err_total+1;
608             Write_log(l_module, ' ');
609                 Write_log(l_module, 'Warning('||to_char(l_warn_total)||
610              '): The value combination of profile ''OS: '||
611             'Default Opportunity Sales Stage'' and ''OS: '||
612             'Default Opportunity Win Probability'' must be valid');
613                 END IF;
614         ELSE
615             Write_log(l_module, ' ');
616                 Write_log(l_module, 'Success: The value combination of profile ''OS: '||
617             'Default Opportunity Sales Stage'' and ''OS: '||
618             'Default Opportunity Win Probability'' is valid');
619             END IF;
620             CLOSE C_Get_Stage_Info;
621         END IF;
622         IF l_opp_closing IS NULL THEN
623         l_err_num := l_err_num+1;
624         l_err_total := l_err_total+1;
625         Write_log(l_module, ' ');
626         Write_log(l_module, 'Error('||to_char(l_err_total)||
627         '): Default value is missing in profile ''OS: Default Close Date Days''');
628         ELSE
629         Write_log(l_module, ' ');
630         Write_log(l_module, 'Success: profile '||
631         '''OS: Default Close Date Days'' has value <'
632         ||l_opp_closing||'> at site level.');
633         END IF;
634 
635         -- SOLIN, 06/12/2001
636         -- Make sure all opportunity currency_code are defined in
637         -- reporting currency.
638         l_count := 0;
639         OPEN C_GET_MISSING_OPP_CURR;
640         LOOP
641             FETCH C_GET_MISSING_OPP_CURR INTO l_curr_code;
642             EXIT WHEN C_GET_MISSING_OPP_CURR%NOTFOUND;
643 
644         Write_log(l_module, 'Error('||to_char(l_err_total)||
645                       '): currency ' || l_curr_code ||
646                       ' should be defined in FND lookup with lookup_type ' ||
647                       '''REPORTING_CURRENCY''');
648         l_err_num := l_err_num+1;
649         l_err_total := l_err_total+1;
650             l_count := l_count + 1;
651         END LOOP;
652         CLOSE C_GET_MISSING_OPP_CURR;
653         IF l_count = 0 THEN
654         Write_log(l_module, ' ');
655         Write_log(l_module, 'Success: All opportunity currencies are defined in FND lookup');
656         END IF;
657         -- end SOLIN, 06/12/2001
658 
659     END IF;
660     IF l_fst_credit_type IS NULL THEN
661     l_err_num := l_err_num+1;
662     l_err_total := l_err_total+1;
663         Write_log(l_module, ' ');
664     Write_log(l_module, 'Error('||to_char(l_err_total)||
665      '): Default value is missing in profile ''OS: Forecast Sales Credit Type''');
666     ELSE
667         Write_log(l_module, ' ');
668     Write_log(l_module, 'Success: profile '||
669         '''OS: Forecast Sales Credit Type'' has ID value <'
670         ||l_fst_credit_type||'> at site level.');
671     END IF;
672     IF l_cn_credit_type IS NULL THEN
673     l_err_num := l_err_num+1;
674     l_err_total := l_err_total+1;
675         Write_log(l_module, ' ');
676     Write_log(l_module, 'Error('||to_char(l_err_total)||
677             '): Default value is missing in profile '''||
678         'OS: Compensation Sales Credit Type''');
679     ELSE
680         Write_log(l_module, ' ');
681     Write_log(l_module, 'Success: profile '''||
682         'OS: Compensation Sales Credit Type'' has ID value <'
683         ||l_cn_credit_type||'> at site level.');
684     END IF;
685     IF p_upgrade = 'N' THEN
686         IF l_opp_channel IS NULL THEN
687         l_err_num := l_err_num+1;
688         l_err_total := l_err_total+1;
689         Write_log(l_module, ' ');
690         Write_log(l_module, 'Error('||to_char(l_err_total)||
691         '): Default value is missing in profile ''OS: Default Sales Channel''');
692         ELSE
693         Write_log(l_module, ' ');
694         Write_log(l_module, 'Success: profile '''||
695         'OS: Default Sales Channel'' has value <'
696         ||l_opp_channel||'> at site level.');
697         END IF;
698         IF l_mc_roll_days IS NULL THEN
699         l_err_num := l_err_num+1;
700         l_err_total := l_err_total+1;
701         Write_log(l_module, ' ');
702         Write_log(l_module, 'Error('||to_char(l_err_total)||
703         '): Default value is missing in profile '''||
704         'OS: Maximum Roll Days for Converting Amount''');
705         ELSE
706         Write_log(l_module, ' ');
707         Write_log(l_module, 'Success: profile '''||
708         'OS: Maximum Roll Days for Converting Amount'' has value <'
709         ||l_mc_roll_days||'> at site level.');
710         END IF;
711         IF l_mc_mapping_type IS NULL THEN
712         l_err_num := l_err_num+1;
713         l_err_total := l_err_total+1;
714         Write_log(l_module, ' ');
715         Write_log(l_module, 'Error('||to_char(l_err_total)||
716         '): Default value is missing in profile ''OS: Date Mapping Type''');
717         ELSE
718         Write_log(l_module, ' ');
719         Write_log(l_module, 'Success: profile '''||
720         'OS: Date Mapping Type'' has value <'||l_mc_mapping_type
721         ||'> at site level.');
722         END IF;
723         IF l_mc_conv_type IS NULL THEN
724         l_err_num := l_err_num+1;
725         l_err_total := l_err_total+1;
726         Write_log(l_module, ' ');
727         Write_log(l_module, 'Error('||to_char(l_err_total)||
728         '): Default value is missing in profile ''OS: Daily Conversion Type''');
729         ELSE
730         Write_log(l_module, ' ');
731         Write_log(l_module, 'Success: profile '''||
732         'OS: Daily Conversion Type'' has value <'
733         ||l_mc_conv_type||'> at site level.');
734         END IF;
735         IF l_fst_calendar IS NULL THEN
736         l_err_num := l_err_num+1;
737         l_err_total := l_err_total+1;
738         Write_log(l_module, ' ');
739         Write_log(l_module, 'Error('||to_char(l_err_total)||
740         '): Default value is missing in profile ''OS: Forecast Calendar''');
741         ELSE
742         Write_log(l_module, ' ');
743         Write_log(l_module, 'Success: profile '''||
744         'OS: Forecast Calendar'' has value <'||l_fst_calendar
745         ||'> at site level.');
746             BEGIN
747         SELECT count(*) INTO l_count
748         FROM AS_MC_TYPE_MAPPINGS
749         WHERE PERIOD_SET_NAME=l_fst_calendar;
750             EXCEPTION
751                 WHEN OTHERS THEN
752                     l_count := 0;
753             END;
754         IF l_count = 0 THEN
755             l_err_num := l_err_num+1;
756             l_err_total := l_err_total+1;
757             Write_log(l_module, ' ');
758             Write_log(l_module, 'Error('||to_char(l_err_total)
759             ||'): no type mapping found in AS_MC_TYPE_MAPPINGS');
760         ELSE
761             Write_log(l_module, ' ');
762             Write_log(l_module, 'Success: MC type mapping found in AS_MC_TYPE_MAPPINGS');
763         END IF;
764         END IF;
765         IF l_prefer_currency IS NULL THEN
766         l_err_num := l_err_num+1;
767         l_err_total := l_err_total+1;
768         Write_log(l_module, ' ');
769         Write_log(l_module, 'Error('||to_char(l_err_total)||
770         '): Default value is missing in profile '''||
771         'OS: Preferred Reporting Currency''');
772         ELSE
773         Write_log(l_module, ' ');
774         Write_log(l_module, 'Success: profile '''||
775         'OS: Preferred Reporting Currency'' has value <'
776         ||l_prefer_currency||'> at site level.');
777         END IF;
778         IF l_default_currency IS NULL THEN
779         l_err_num := l_err_num+1;
780         l_err_total := l_err_total+1;
781         Write_log(l_module, ' ');
782         Write_log(l_module, 'Error('||to_char(l_err_total)||
783         '): Default value is missing in profile ''JTF_PROFILE_DEFAULT_CURRENCY''');
784         ELSE
785         Write_log(l_module, ' ');
786         Write_log(l_module, 'Success: profile '''||
787         'JTF_PROFILE_DEFAULT_CURRENCY'' has value <'
788         ||l_default_currency||'> at site level.');
789         END IF;
790 -- fix for Bug#3256105
791 /*        IF l_prod_org IS NULL THEN
792         l_err_num := l_err_num+1;
793         l_err_total := l_err_total+1;
794         Write_log(l_module, ' ');
795         Write_log(l_module, 'Error('||to_char(l_err_total)||
796         '): Default value is missing in profile ''ASO : Product Organization''');
797         ELSE
798         Write_log(l_module, ' ');
799         Write_log(l_module, 'Success: profile '''||
800         'ASO : Product Organization'' has ID value <'
801         ||l_prod_org||'> at site level.');
802         END IF;*/
803         BEGIN
804     SELECT count(*) INTO l_count
805     FROM ASO_I_SALES_CHANNELS_V
806     WHERE ENABLED_FLAG='Y'
807       AND NVL(START_DATE_ACTIVE, sysdate) <= sysdate
808       AND NVL(END_DATE_ACTIVE, sysdate) >= sysdate;
809         EXCEPTION
810             WHEN OTHERS THEN
811                 l_count := 0;
812         END;
813     IF l_count = 0 THEN
814         l_err_num := l_err_num+1;
815         l_err_total := l_err_total+1;
816         Write_log(l_module, ' ');
817         Write_log(l_module, 'Error('||to_char(l_err_total)
818         ||'): no active Sales Channel in ASO_I_SALES_CHANNELS_V.');
819     ELSE
820         Write_log(l_module, ' ');
821         Write_log(l_module, 'Success: active Sales Channel'||
822         ' found in ASO_I_SALES_CHANNELS_V');
823     END IF;
824     END IF;
825     BEGIN
826         BEGIN
827     SELECT count(*) INTO l_count
828     FROM ASO_I_SALES_CREDIT_TYPES_V
829     WHERE ENABLED_FLAG='Y'
830       AND QUOTA_FLAG='N';
831         EXCEPTION
832             WHEN OTHERS THEN
833                 l_count := 0;
834         END;
835     IF l_count = 0 THEN
836             l_err_num := l_err_num+1;
837         l_err_total := l_err_total+1;
838         Write_log(l_module, ' ');
839         Write_log(l_module, 'Error('||to_char(l_err_total)
840         ||'): no active revenue credit type found in ASO_I_SALES_CREDIT_TYPES_V.');
841     ELSE
842         Write_log(l_module, ' ');
843         Write_log(l_module, 'Success: revenue credit type'||
844         ' found in ASO_I_SALES_CREDIT_TYPES_V');
845     END IF;
846         BEGIN
847     SELECT count(*) INTO l_count
848     FROM ASO_I_SALES_CREDIT_TYPES_V
849     WHERE ENABLED_FLAG='Y'
850       AND QUOTA_FLAG='Y';
851         EXCEPTION
852             WHEN OTHERS THEN
853                 l_count := 0;
854         END;
855     IF l_count = 0 THEN
856             l_err_num := l_err_num+1;
857         l_err_total := l_err_total+1;
858         Write_log(l_module, ' ');
859         Write_log(l_module, 'Error('||to_char(l_err_total)
860         ||'): no active non-revenue credit type found '||
861         'in ASO_I_SALES_CREDIT_TYPES_V.');
862     ELSE
863         Write_log(l_module, ' ');
864         Write_log(l_module, 'Success: non-revenue credit type'||
865         ' found in ASO_I_SALES_CREDIT_TYPES_V');
866     END IF;
867     END;
868     -- SOLIN, 06/12/2001
869     -- AS_MC_REPORTING_CURR will be obsolete and migrate to
870     -- FND_LOOKUP_VALUES with lookup_type='REPORTING_CURRENCY'
871     IF p_upgrade = 'N' THEN
872         BEGIN
873         SELECT count(*) INTO l_count
874         FROM FND_LOOKUP_VALUES
875         WHERE ENABLED_FLAG = 'Y'
876         AND LOOKUP_TYPE = 'REPORTING_CURRENCY';
877         EXCEPTION
878             WHEN OTHERS THEN
879                 l_count := 0;
880         END;
881 
882 --  SELECT count(*) INTO l_count
883 --  FROM AS_MC_REPORTING_CURR;
884     IF l_count=0 THEN
885         l_err_num := l_err_num+1;
886         l_err_total := l_err_total+1;
887         Write_log(l_module, ' ');
888 --      Write_Log('Error('||to_char(l_err_total)
889 --      ||'): no reporting currency found in AS_MC_REPORTING_CURR');
890         Write_Log(l_module, 'Error('||to_char(l_err_total)
891         ||'): no reporting currency found in FND lookup');
892     ELSE
893         Write_log(l_module, ' ');
894         Write_log(l_module, 'Success: reporting currency found in FND lookup');
895 --      Write_Log('Success: reporting currency found in AS_MC_REPORTING_CURR');
896     END IF;
897     END IF;
898     -- end SOLIN, 06/12/2001
899 
900     IF p_upgrade = 'Y' THEN
901         BEGIN
902     SELECT count(*) INTO l_count
903     FROM AS_SALES_CREDITS
904     WHERE (REVENUE_PERCENT IS NOT NULL AND REVENUE_AMOUNT IS NOT NULL)
905        OR (QUOTA_CREDIT_PERCENT IS NOT NULL AND QUOTA_CREDIT_AMOUNT IS NOT NULL)
906        OR (REVENUE_PERCENT IS NULL AND REVENUE_AMOUNT IS NULL AND
907         QUOTA_CREDIT_PERCENT IS NULL AND QUOTA_CREDIT_AMOUNT IS NULL);
908         EXCEPTION
909             WHEN OTHERS THEN
910                 l_count := 0;
911         END;
912     IF l_count > 0 THEN
913         l_err_num := l_err_num+1;
914         l_err_total := l_err_total+1;
915         Write_log(l_module, ' ');
916         Write_log(l_module, 'Error('||to_char(l_err_total)
917         ||'): bad data found in AS_SALES_CREDITS');
918         Write_log(l_module, 'Before 11i data migration, one and only one of the two fields, '||
919         'amount or percent, must be entered for either revenue or quota credtis.');
920     ELSE
921         Write_log(l_module, ' ');
922         Write_log(l_module, 'Success: no bad data found in AS_SALES_CREDITS');
923     END IF;
924 
925         BEGIN
926         SELECT count(*) INTO l_count
927     FROM as_sales_stages_all_b stg
928     WHERE not exists (Select 'E' From as_sales_stages_all_b istg
929                    Where istg.name = stg.name
930                    And istg.org_id = 0);
931         EXCEPTION
932             WHEN OTHERS THEN
933                 l_count := 0;
934         END;
935     IF l_count > 0 THEN
936         l_err_num := l_err_num+1;
937         l_err_total := l_err_total+1;
938         Write_Log(l_module, ' ');
939         Write_log(l_module, 'Error('||to_char(l_err_total)
940         ||'): found sales stage, which has no set up for org_id=0, '
941         ||'in AS_SALES_STAGES_ALL_B');
942     ELSE
943         Write_log(l_module, ' ');
944         Write_log(l_module, 'Success: no bad data found in AS_SALES_STAGES_ALL_B');
945     END IF;
946 
947         BEGIN
948         SELECT count(*) INTO l_count
949     FROM as_forecast_prob_all_b fp
950     WHERE not exists (Select 'E' From as_forecast_prob_all_b ifp
951                    Where ifp.probability_value = fp.probability_value
952                    And ifp.org_id = 0);
953         EXCEPTION
954             WHEN OTHERS THEN
955                 l_count := 0;
956         END;
957     IF l_count > 0 THEN
958         l_err_num := l_err_num+1;
959         l_err_total := l_err_total+1;
960         Write_log(l_module, ' ');
961         Write_log(l_module, 'Error('||to_char(l_err_total)
962         ||'): found sales stage, which has no set up for org_id=0, '
963         ||'in AS_FORECAST_PROB_ALL_B');
964     ELSE
965         Write_log(l_module, ' ');
966         Write_log(l_module, 'Success: no bad data found in AS_FORECAST_PROB_ALL_B');
967     END IF;
968 
969     ELSE
970         BEGIN
971     SELECT count(*) INTO l_count
972     FROM AS_LEADS_ALL
973     WHERE SALES_STAGE_ID IS NULL
974        OR DECISION_DATE IS NULL
975        OR WIN_PROBABILITY IS NULL
976        OR CHANNEL_CODE IS NULL;
977         EXCEPTION
978             WHEN OTHERS THEN
979                 l_count := 0;
980         END;
981     IF l_count > 0 THEN
982         l_err_num := l_err_num+1;
983         l_err_total := l_err_total+1;
984         Write_log(l_module, ' ');
985         Write_log(l_module, 'Error('||to_char(l_err_total)
986         ||'): bad data found in AS_LEADS_ALL');
987         Write_log(l_module, 'SALES_STAGE_ID, DECISION_DATE, '||
988         'WIN_PROBABILITY and CHANNEL_CODE in AS_LEADS_ALL must be NOT NULL.');
989     ELSE
990         Write_log(l_module, ' ');
991         Write_log(l_module, 'Success: no bad data found in AS_LEADS_ALL');
992     END IF;
993     END IF;
994     Write_log(l_module, ' ');
995     Write_log(l_module, '**** '||to_char(l_err_num)
996     ||' error(s) found in  Opportunity setup ****');
997     Write_log(l_module, '+----------------------------------'||
998     '-----------------------------------------+');
999     IF p_upgrade = 'N' THEN
1000         -- checking Forecast Setup
1001         l_err_num := 0;
1002         Write_log(l_module, ' ');
1003         Write_log(l_module, '**** Checking the setup for Forecast module ****');
1004         BEGIN
1005         SELECT count(*) INTO l_count
1006         FROM as_fst_sales_categories
1007         WHERE product_category_id is not null
1008         and ROWID NOT IN ( SELECT MIN(ROWID)
1009                             FROM as_fst_sales_categories
1010                             GROUP BY  product_category_id);
1011         EXCEPTION
1012             WHEN OTHERS THEN
1013                 l_count := 0;
1014         END;
1015         IF l_count > 0 THEN
1016         l_err_num := l_err_num+1;
1017         l_err_total := l_err_total+1;
1018         Write_log(l_module, ' ');
1019         Write_log(l_module, 'Error('||to_char(l_err_total)
1020         ||'): duplicate records found in AS_FST_SALES_CATEGORIES');
1021         ELSE
1022         Write_log(l_module, ' ');
1023         Write_log(l_module, 'Success: no duplicate records'||
1024         ' found in AS_FST_SALES_CATEGORIES');
1025         END IF;
1026         BEGIN
1027         SELECT count(*) INTO l_count
1028         FROM as_pe_int_categories
1029         WHERE product_category_id is not null
1030         and ROWID NOT IN ( SELECT MIN(ROWID)
1031                             FROM as_pe_int_categories
1032                             GROUP BY quota_id, product_category_id );
1033         EXCEPTION
1034             WHEN OTHERS THEN
1035                 l_count := 0;
1036         END;
1037         IF l_count > 0 THEN
1038         l_err_num := l_err_num+1;
1039         l_err_total := l_err_total+1;
1040         Write_log(l_module, ' ');
1041         Write_log(l_module, 'Error('||to_char(l_err_total)
1042         ||'): duplicate records found in AS_PE_INT_CATEGORIES');
1043         ELSE
1044         Write_log(l_module, ' ');
1045         Write_log(l_module, 'Success: no duplicate records'||
1046         ' found in AS_PE_INT_CATEGORIES');
1047         END IF;
1048         Write_log(l_module, ' ');
1049         Write_log(l_module, '**** '||to_char(l_err_num)
1050         ||' error(s) found in  Forecast setup ****');
1051         Write_log(l_module, '+---------------------------------------------'||
1052         '------------------------------+');
1053     END IF;
1054     -- checking Territory Setup
1055     IF p_upgrade = 'Y' THEN
1056         l_err_num := 0;
1057         Write_log(l_module, ' ');
1058         Write_log(l_module, '**** Checking the setup for Territory module ****');
1059         BEGIN
1060     SELECT count(*) INTO l_count
1061     FROM AS_TERR_TYPE_QUALIFIERS C, AS_TERRITORIES_ALL  A
1062     WHERE A.TERRITORY_TYPE_ID = C.TERRITORY_TYPE_ID
1063       AND C.seeded_qualifier_id not in (
1064         select B.seeded_qualifier_id
1065         from  AS_TERRITORY_VALUES_ALL B
1066         where A.TERRITORY_ID =B.TERRITORY_ID);
1067         EXCEPTION
1068             WHEN OTHERS THEN
1069                 l_count := 0;
1070         END;
1071     IF l_count > 0 THEN
1072         l_err_num := l_err_num+1;
1073         l_err_total := l_err_total+1;
1074         Write_log(l_module, ' ');
1075         Write_log(l_module, 'Error('||to_char(l_err_total)
1076         ||'): invalid records found in AS_TERRITORIES_ALL');
1077         Write_log(l_module, '(The record is invalid if the Qualifier has no'
1078             ||' Value defined in AS_TERRITORY_VALUES_ALL.)');
1079     ELSE
1080         Write_log(l_module, ' ');
1081         Write_log(l_module, 'Success: no invalid qualifier found in territory records');
1082     END IF;
1083     END IF;
1084     Write_log(l_module, ' ');
1085     Write_log(l_module, '**** '||to_char(l_err_num)
1086         ||' error(s) found in  Territory setup ****');
1087     Write_log(l_module, '+----------------------------------------------'||
1088         '-----------------------------+');
1089     Write_log(l_module, ' ');
1090     Write_log(l_module, '**** Total '||to_char(l_err_total)
1091         ||' error(s) found in Oracle Sales Application setup ****');
1092     Write_log(l_module, ' ');
1093     Write_log(l_module, '**** Total '||to_char(l_warn_total)
1094         ||' warning(s) found in Oracle Sales Application setup ****');
1095 END Validate_Setup;
1096 
1097 END AS_VALIDATE_SETUP;