DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_H2PI_ERROR

Source


1 PACKAGE BODY hr_h2pi_error AS
2 /* $Header: hrh2pier.pkb 120.0 2005/05/31 00:39:11 appldev noship $ */
3 --
4 --
5 -- ----------------------------------------------------------------------------
6 -- |--< Date_Error >-----------------------------------------------------------|
7 -- ----------------------------------------------------------------------------
8 -- Description:  Enters the error details into HR_H2PI_MESSAGE_LINES
9 -- ----------------------------------------------------------------------------
10 PROCEDURE data_error(p_from_id       number,
11                      p_table_name    varchar2,
12                      p_message_level varchar2,
13                      p_message_name  varchar2 default null,
14                      p_message_text  varchar2 default null,
15                      p_api_module_id number default null) IS
16 
17 l_mesg                 VARCHAR2(100);
18 l_message_name_encoded VARCHAR2(2000);
19 INVALID_PARAM EXCEPTION;
20 PRAGMA Exception_Init(Invalid_Param, -20001);
21    --
22 BEGIN
23   IF p_table_name IS NULL THEN
24     l_mesg := 'The Parameter value for TABLE_NAME cannot be null';
25     fnd_file.put_line(FND_FILE.LOG, l_mesg);
26     RAISE INVALID_PARAM;
27   ELSIF p_message_level IS NULL THEN
28     l_mesg := 'The Parameter value for Message Level cannot be null';
29     fnd_file.put_line(FND_FILE.LOG, l_mesg);
30     RAISE INVALID_PARAM;
31   ELSIF p_message_name IS NULL AND p_message_text IS NULL THEN
32     l_mesg := 'The Parameter value for Message Name and Message Text '||
33               'cannot be null';
34     fnd_file.put_line(FND_FILE.LOG, l_mesg);
35     RAISE INVALID_PARAM;
36   END IF;
37 
38   IF UPPER(p_message_level) = 'FATAL' OR
39      UPPER(p_message_level) = 'INFORMATION' OR
40      UPPER(p_message_level) = 'WARNING' THEN
41 
42     IF p_message_name IS NOT NULL AND
43        ( UPPER(p_message_name) = 'HR_289235_ED_DATA_REMOVED' OR
44          UPPER(p_message_name) = 'HR_289236_UD_DATA_REMOVED' OR
45          UPPER(p_message_name) = 'HR_289237_DATA_MISMATCH' OR
46          UPPER(p_message_name) = 'HR_289238_GEOCODE_OUT_OF_SYNC' OR
47          UPPER(p_message_name) = 'HR_289239_GEOCODE_DATA_CHANGED' OR
48          UPPER(p_message_name) = 'HR_289240_MAPPING_ID_INVALID' OR
49          UPPER(p_message_name) = 'HR_289241_MAPPING_ID_MISSING' OR
50          UPPER(p_message_name) = 'HR_289259_ED_DATA_ADDED' OR
51          UPPER(p_message_name) = 'HR_289260_UD_DATA_ADDED' OR
52          UPPER(p_message_name) = 'HR_289269_USER_CITY_CODE' OR
53          UPPER(p_message_name) = 'HR_289292_EMP_NUM_GEN_MANUAL' ) THEN
54 
55       fnd_message.set_name('PER',p_message_name);
56       fnd_message.set_token('TABLE_NAME', p_table_name);
57       fnd_message.set_token('FROM_ID', NVL(TO_CHAR(p_from_id), 'NULL'));
58       l_message_name_encoded := fnd_message.get_encoded;
59     ELSIF p_message_text IS NOT NULL THEN
60       l_message_name_encoded := p_message_text;
61     END IF;
62     --
63     INSERT INTO hr_h2pi_message_lines
64        ( to_business_group_id, request_id, from_id, table_name,
65          message_level, message_name_encoded, api_module_id)
66     VALUES ( hr_h2pi_upload.g_to_business_group_id, hr_h2pi_upload.g_request_id,
67          NVL(p_from_id, 0), p_table_name, UPPER(p_message_level),
68          nvl(l_message_name_encoded,p_message_text), p_api_module_id );
69   ELSE
70     l_mesg := 'Invalid Message Level ' || p_message_level;
71     RAISE INVALID_PARAM;
72   END IF;
73 
74 EXCEPTION
75   WHEN INVALID_PARAM THEN
76     fnd_file.put_line(FND_FILE.LOG, l_mesg);
77     RAISE;
78   WHEN OTHERS THEN
79     fnd_file.put_line(FND_FILE.LOG, SQLERRM );
80     RAISE;
81 END data_error;
82 --
83 --
84 -- ----------------------------------------------------------------------------
85 -- |--< Check_for_Errors >-----------------------------------------------------|
86 -- ----------------------------------------------------------------------------
87 -- Description:  This function checks for any errors written in the table
88 -- HR_H2PI_MESSAGE_LINES for the passed parameter
89 -- P_REQUEST_ID (Concurrent Request Id) and error type Fatal
90 -- ----------------------------------------------------------------------------
91 FUNCTION check_for_errors RETURN BOOLEAN IS
92 
93 l_count NUMBER(15);
94 
95 BEGIN
96   SELECT count(*)
97     INTO l_count
98     FROM hr_h2pi_message_lines
99    WHERE request_id = hr_h2pi_upload.g_request_id
100      AND message_level = 'FATAL';
101 
102   IF l_count > 0 THEN
103     RETURN TRUE;
104   ELSE
105     RETURN FALSE;
106   END IF;
107 
108 EXCEPTION
109   WHEN OTHERS THEN
110     RETURN FALSE;
111 END check_for_errors;
112 --
113 --
114 -- ----------------------------------------------------------------------------
115 -- ----------------------------------------------------------------------------
116 -- Description: This procedure is to generate the Error report by Business Group
117 -- ----------------------------------------------------------------------------
118 --
119 PROCEDURE generate_error_report IS
120 
121 l_person_name          per_all_people_f.full_name%type;
122 l_location_name        hr_locations_all.location_code%type;
123 l_assignment_number    per_all_assignments_f.assignment_number%type;
124 l_pay_method_name      pay_org_payment_methods_f.org_payment_method_name%type;
125 l_org_name             hr_all_organization_units.name%type;
126 l_context              hr_organization_information.org_information_context%type;
127 l_org_classification   hr_organization_information.org_information1%type;
128 l_element_name         pay_element_types_f.element_name%type;
129 TYPE ErrorRecTable is TABLE of hr_h2pi_message_lines%ROWTYPE
130      INDEX BY binary_integer;
131 ErrorRec ErrorRecTable;
132 
133 CURSOR csr_err_mesg IS
134   SELECT message_name_encoded,
135          message_level,
136          api_module_id,
137          to_business_group_id,
138          request_id,
139          from_id,
140          table_name
141     FROM hr_h2pi_message_lines
142    WHERE to_business_group_id = hr_h2pi_upload.g_to_business_group_id
143      AND request_id           = hr_h2pi_upload.g_request_id
144 GROUP BY to_business_group_id,
145          request_id,
146          table_name,
147          message_level,
148          message_name_encoded,
149          from_id,
150          api_module_id;
151 
152 l_row_count   NUMBER(15) := 0;
153 l_to_business_group_name per_business_groups.name%type;
154 l_text VARCHAR2(2000);
155 l_table_name hr_h2pi_message_lines.table_name%type := ' ';
156 --l_from_business_group_id hr_h2pi_message_lines.to_business_group_id%type;
157 l_from_client_id         hr_h2pi_message_lines.to_business_group_id%type;
158 
159 BEGIN
160   BEGIN
161     SELECT name
162       INTO l_to_business_group_name
163       FROM per_business_groups
164      WHERE business_group_id = hr_h2pi_upload.g_to_business_group_id;
165   EXCEPTION
166     WHEN NO_DATA_FOUND THEN
167       fnd_file.put_line(FND_FILE.LOG,
168                         'FATAL - HR_H2PI_ERROR.GENERATE_ERROR_REPORT: ' ||
169                          'Invalid Business Group Id');
170       RAISE;
171   END;
172 
173   fnd_file.new_line(FND_FILE.LOG);
174   fnd_file.put_line(FND_FILE.LOG, 'Business Group: ' || l_to_business_group_name);
175   fnd_file.new_line(FND_FILE.LOG);
176   fnd_file.put_line(FND_FILE.LOG, 'Request Id: ' ||  hr_h2pi_upload.g_request_id);
177     --
178   l_from_client_id := hr_h2pi_upload.get_from_client_id;
179   FOR csr_rec IN csr_err_mesg LOOP
180     IF csr_rec.table_name <> l_table_name then
181       l_table_name := csr_rec.table_name;
182       fnd_file.new_line(FND_FILE.LOG);
183       fnd_file.put_line(FND_FILE.LOG, 'Table_name: ' || csr_rec.table_name);
184       fnd_file.new_line(FND_FILE.LOG);
185     END IF;
186     -- Included the IF clause to check for encoded characters as set_encoded
187     -- returns null if the data is not encoded.
188     IF INSTR(csr_rec.message_name_encoded,fnd_global.local_chr(0)) > 0 THEN
189       fnd_message.set_encoded(csr_rec.message_name_encoded);
190       --l_text := RPAD(csr_rec.message_level,13,' ') || '- ' ||
191       --            fnd_message.get;
192       --
193       l_text := fnd_message.get;
194     ELSE
195       l_text := RPAD(csr_rec.message_level,13,' ') || '- ' ||
196                   csr_rec.message_name_encoded;
197     END IF;
198     -- code begins
199     --l_from_business_group_id := hr_h2pi_main_upload.get_from_business_group_id;
200     if upper(csr_rec.table_name) = 'HR_H2PI_EMPLOYEES' then
201        BEGIN
202          SELECT last_name || ', ' || first_name
203            INTO l_person_name
204            FROM hr_h2pi_employees
205           WHERE person_id = csr_rec.from_id
206             --AND business_group_id = l_from_business_group_id
207             AND client_id = l_from_client_id
208             AND rownum < 2;
209          l_text := 'Person Name: ' || l_person_name || ' - ' || l_text;
210          EXCEPTION
211            WHEN NO_DATA_FOUND THEN
212              null;
213            WHEN OTHERS THEN
214              fnd_file.put_line(FND_FILE.LOG, SQLERRM);
215          END;
216     elsif upper(csr_rec.table_name) = 'HR_H2PI_LOCATIONS' then
217       BEGIN
218         SELECT location_code
219           INTO l_location_name
220           FROM hr_h2pi_locations
221          WHERE location_id = csr_rec.from_id
222            --AND business_group_id = l_from_business_group_id;
223              AND client_id = l_from_client_id;
224         l_text := 'Location Name: ' || l_location_name || ' - ' || l_text ;
225       EXCEPTION
226         WHEN NO_DATA_FOUND THEN
227           null;
228         WHEN OTHERS THEN
229           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
230       END;
231     elsif upper(csr_rec.table_name) = 'HR_H2PI_HR_ORGANIZATIONS' then
232       BEGIN
233         SELECT name
234           INTO l_org_name
235           FROM hr_h2pi_hr_organizations
236          WHERE organization_id = csr_rec.from_id
237            --AND business_group_id = l_from_business_group_id;
238             AND client_id = l_from_client_id;
239 
240         l_text := 'Organization Name: ' || l_org_name || ' - ' || l_text;
241       EXCEPTION
242         WHEN NO_DATA_FOUND THEN
243           null;
244         WHEN OTHERS THEN
245           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
246       END;
247     elsif upper(csr_rec.table_name) = 'HR_H2PI_ASSIGNMENTS' then
248       BEGIN
249         SELECT assignment_number
250           INTO l_assignment_number
251           FROM hr_h2pi_assignments
252          WHERE assignment_id = csr_rec.from_id
253         --   AND business_group_id = l_from_business_group_id
254             AND client_id = l_from_client_id
255            AND rownum < 2;
256 
257         l_text := 'Assignment No: ' || l_assignment_number || ' - ' || l_text;
258       EXCEPTION
259         WHEN NO_DATA_FOUND THEN
260           null;
261         WHEN OTHERS THEN
262           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
263       END;
264     elsif upper(csr_rec.table_name) = 'HR_H2PI_ELEMENT_ENTRIES' then
265       BEGIN
266         SELECT asg.assignment_number,
267                et.element_name
268           INTO l_assignment_number,
269                l_element_name
270           FROM hr_h2pi_element_entries ee,
271                hr_h2pi_id_mapping      map,
272                hr_h2pi_id_mapping      map2,
273                pay_element_links_f el,
274                pay_element_types_f et,
275                hr_h2pi_assignments_v   asg
276          WHERE ee.element_entry_id = csr_rec.from_id
277            --AND ee.business_group_id = l_from_business_group_id
278            AND ee.client_id = l_from_client_id
279            AND ee.element_link_id = map.from_id
280            AND map.table_name = 'PAY_ELEMENT_LINKS_F'
281            AND map.to_business_group_id = csr_rec.to_business_group_id
282            AND map.to_id = el.element_link_id
283            AND el.element_type_id = et.element_type_id
284            AND ee.assignment_id = map2.from_id
285            AND map2.table_name = 'PER_ALL_ASSIGNMENTS_F'
286            AND map2.to_business_group_id = csr_rec.to_business_group_id
287            AND map2.to_id = asg.assignment_id
288            AND ee.effective_start_date between el.effective_start_date
289                                            and el.effective_end_date
290            AND el.effective_start_date between et.effective_start_date
291                                            and et.effective_end_date
292            AND ee.effective_start_date between asg.effective_start_date
293                                            and asg.effective_end_date
294            AND rownum < 2;
295         l_text := 'Assignment No: ' || l_assignment_number ||
296                   ' Element Name: ' || l_element_name || ' - ' || l_text;
297       EXCEPTION
298         WHEN NO_DATA_FOUND THEN
299           null;
300         WHEN OTHERS THEN
301           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
302       END;
303     elsif upper(csr_rec.table_name) = 'HR_H2PI_SALARIES' then
304       BEGIN
305         SELECT assignment_number
306           INTO l_assignment_number
307           FROM hr_h2pi_salaries sal,
308                hr_h2pi_assignments_v asg,
309                hr_h2pi_id_mapping map
310          WHERE sal.pay_proposal_id = csr_rec.from_id
311            --AND sal.business_group_id = l_from_business_group_id
312            AND sal.client_id = l_from_client_id
313            AND sal.assignment_id = map.from_id
314            AND map.table_name = 'PER_ALL_ASSIGNMENTS_F'
315            AND map.to_business_group_id = csr_rec.to_business_group_id
316            AND map.to_id = asg.assignment_id
317            AND asg.business_group_id = csr_rec.to_business_group_id
318            AND sal.change_date between asg.effective_start_date
319                                    and asg.effective_end_date
320            AND rownum < 2;
321 
322         l_text := 'Assignment No: ' || l_assignment_number || ' - ' || l_text;
323       EXCEPTION
324         WHEN NO_DATA_FOUND THEN
325           null;
326         WHEN OTHERS THEN
327           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
328       END;
329     elsif upper(csr_rec.table_name) = 'HR_H2PI_PAYMENT_METHODS' then
330       BEGIN
331         SELECT asg.assignment_number,
332                opm.org_payment_method_name
333           INTO l_assignment_number,
334                l_pay_method_name
335           FROM hr_h2pi_payment_methods ppm,
336                hr_h2pi_org_payment_methods opm,
337                hr_h2pi_assignments_v asg,
338                hr_h2pi_id_mapping map
339          WHERE personal_payment_method_id = csr_rec.from_id
340            --AND ppm.business_group_id = l_from_business_group_id
341            AND ppm.client_id = l_from_client_id
342            AND ppm.business_group_id = opm.business_group_id
343            AND ppm.org_payment_method_id = opm.org_payment_method_id
344            AND asg.business_group_id = csr_rec.to_business_group_id
345            AND ppm.assignment_id = map.from_id
346            AND map.table_name = 'PER_ALL_ASSIGNMENTS_F'
347            AND map.to_id = asg.assignment_id
348            AND ppm.effective_start_date between opm.effective_start_date
349                                             and opm.effective_end_date
350            AND ppm.effective_start_date between asg.effective_start_date
351                                             and asg.effective_end_date
352            AND rownum < 2;
353 
354          l_text := 'Assignment No: ' || l_assignment_number ||
355                    ' Payment Method Name: ' || l_pay_method_name
356                    || ' - ' || l_text;
357       EXCEPTION
358         WHEN NO_DATA_FOUND THEN
359           null;
360         WHEN OTHERS THEN
361           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
362       END;
363     elsif upper(csr_rec.table_name) = 'HR_H2PI_ORGANIZATION_CLASS' then
364       BEGIN
365         SELECT ogs.name,
366                ogc.org_information1
367           INTO l_org_name,
368                l_org_classification
369           FROM hr_h2pi_organization_class ogc,
370                hr_h2pi_hr_organizations_v ogs,
371                hr_h2pi_id_mapping map
372          WHERE ogc.org_information_id = csr_rec.from_id
373            --AND ogc.business_group_id = l_from_business_group_id
374            AND ogc.client_id = l_from_client_id
375            AND ogc.organization_id = map.from_id
376            AND map.table_name = 'HR_ALL_ORGANIZATION_UNITS'
377            AND ogs.business_group_id = csr_rec.to_business_group_id
378            AND map.to_id = ogs.organization_id
379            AND rownum < 2;
380 
381          l_text := 'Organization Name: ' || l_org_name ||
382                    ' Org Classification: ' || l_org_classification
383                    || ' - ' || l_text;
384       EXCEPTION
385         WHEN NO_DATA_FOUND THEN
386           null;
387         WHEN OTHERS THEN
388           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
389       END;
390     elsif upper(csr_rec.table_name) = 'HR_H2PI_ORGANIZATION_INFO' then
391       BEGIN
392         SELECT name,
393                org_information_context
394           INTO l_org_name,
395                l_context
396           FROM hr_h2pi_organization_info   ogi,
397                hr_h2pi_hr_organizations_v  ogs,
398                hr_h2pi_id_mapping map
399          WHERE org_information_id = csr_rec.from_id
400            --AND ogi.business_group_id = l_from_business_group_id
401            AND ogi.client_id = l_from_client_id
402            AND ogi.organization_id = map.from_id
403            AND map.table_name = 'HR_ALL_ORGANIZATION_UNITS'
404            AND ogs.business_group_id = csr_rec.to_business_group_id
405            AND map.to_id = ogs.organization_id
406            AND rownum < 2;
407 
408         l_text := 'Organization Name: ' || l_org_name ||
409                   ' Organization Context: ' || l_context
410                   || ' - ' || l_text;
411       EXCEPTION
412         WHEN NO_DATA_FOUND THEN
413           BEGIN
414             SELECT bg.name,
415                    ogi.org_information_context
416               INTO l_org_name,
417                    l_context
418               FROM hr_h2pi_organization_info ogi,
419                    hr_h2pi_bg_and_gre        bg
420              WHERE ogi.org_information_id = csr_rec.from_id
421                --AND ogi.business_group_id = l_from_business_group_id
422                AND ogi.client_id = l_from_client_id
423                AND ogi.business_group_id = bg.business_group_id
424                AND ogi.organization_id = bg.organization_id
425                AND rownum < 2;
426 
427             l_text := 'Organization Name: ' || l_org_name
428                       || ' Organization Context: ' || l_context ||
429                       ' - ' || l_text;
430           EXCEPTION
431             WHEN NO_DATA_FOUND THEN
432               null;
433             WHEN OTHERS THEN
434               fnd_file.put_line(FND_FILE.LOG, SQLERRM );
435           END;
436         WHEN OTHERS THEN
437           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
438       END;
439     elsif upper(csr_rec.table_name) = 'HR_H2PI_ADDRESSES' then
440       BEGIN
441         SELECT em.last_name || ', ' || em.first_name
442           INTO l_person_name
443           FROM hr_h2pi_addresses   ad,
444                hr_h2pi_employees_v em,
445                hr_h2pi_id_mapping  map
446          WHERE ad.address_id = csr_rec.from_id
447            --AND ad.business_group_id = l_from_business_group_id
448            AND ad.client_id = l_from_client_id
449            AND em.business_group_id = csr_rec.to_business_group_id
450            AND ad.person_id = map.from_id
451            AND map.table_name = 'PER_ALL_PEOPLE_F'
452            AND map.to_id = em.person_id
453            AND rownum < 2;
454 
455         l_text := 'Person Name: ' || l_person_name || ' - ' || l_text ;
456       EXCEPTION
457         WHEN NO_DATA_FOUND THEN
458           null;
459         WHEN OTHERS THEN
460           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
461       END;
462     elsif upper(csr_rec.table_name) = 'HR_H2PI_FEDERAL_TAX_RULES' then
463       BEGIN
464         SELECT asg.assignment_number
465           INTO l_assignment_number
466           FROM hr_h2pi_federal_tax_rules ftr,
467                hr_h2pi_assignments_v asg,
468                hr_h2pi_id_mapping map
469          WHERE ftr.emp_fed_tax_rule_id = csr_rec.from_id
470            --AND ftr.business_group_id = l_from_business_group_id
471            AND ftr.client_id = l_from_client_id
472            AND asg.business_group_id = csr_rec.to_business_group_id
473            AND ftr.assignment_id = map.from_id
474            AND map.table_name = 'PER_ALL_ASSIGNMENTS_F'
475            AND map.to_id = asg.assignment_id
476            AND rownum < 2;
477 
478         l_text := 'Assignment No: ' || l_assignment_number || ' - ' || l_text ;
479       EXCEPTION
480         WHEN NO_DATA_FOUND THEN
481           null;
482         WHEN OTHERS THEN
483           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
484       END;
485     elsif upper(csr_rec.table_name) = 'HR_H2PI_STATE_TAX_RULES' then
486       BEGIN
487         SELECT asg.assignment_number
488           INTO l_assignment_number
489           FROM hr_h2pi_state_tax_rules str,
490                hr_h2pi_assignments_v asg,
491                hr_h2pi_id_mapping map
492          WHERE str.emp_state_tax_rule_id = csr_rec.from_id
493            --AND str.business_group_id = l_from_business_group_id
494            AND str.client_id = l_from_client_id
495            AND str.assignment_id = map.from_id
496            AND map.table_name = 'PER_ALL_ASSIGNMENTS_F'
497            AND map.to_id = asg.assignment_id
498            AND asg.business_group_id = csr_rec.to_business_group_id
499            AND rownum < 2;
500 
501         l_text := 'Assignment No: ' || l_assignment_number || ' - ' || l_text ;
502       EXCEPTION
503         WHEN NO_DATA_FOUND THEN
504           null;
505         WHEN OTHERS THEN
506           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
507       END;
508 --
509     elsif upper(csr_rec.table_name) = 'HR_H2PI_COUNTY_TAX_RULES' then
510       BEGIN
511         SELECT asg.assignment_number
512           INTO l_assignment_number
513           FROM hr_h2pi_county_tax_rules ctr,
514                hr_h2pi_assignments_v asg,
515                hr_h2pi_id_mapping map
516          WHERE ctr.emp_county_tax_rule_id = csr_rec.from_id
517            --AND ctr.business_group_id = l_from_business_group_id
518            AND ctr.client_id = l_from_client_id
519            AND ctr.assignment_id = csr_rec.from_id
520            AND map.table_name = 'PER_ALL_ASSIGNMENTS_F'
521            AND map.to_id = asg.assignment_id
522            AND asg.business_group_id = csr_rec.to_business_group_id
523            AND rownum < 2;
524 
525         l_text := 'Assignment No: ' || l_assignment_number || ' - ' || l_text ;
526       EXCEPTION
527         WHEN NO_DATA_FOUND THEN
528           null;
529         WHEN OTHERS THEN
530           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
531       END;
532 --
533     elsif upper(csr_rec.table_name) = 'HR_H2PI_CITY_TAX_RULES' then
534       BEGIN
535         SELECT asg.assignment_number
536           INTO l_assignment_number
537           FROM hr_h2pi_city_tax_rules ctr,
538                hr_h2pi_assignments_v asg,
539                hr_h2pi_id_mapping map
540          WHERE ctr.emp_city_tax_rule_id = csr_rec.from_id
541            --AND ctr.business_group_id = l_from_business_group_id
542            AND ctr.client_id = l_from_client_id
543            AND ctr.assignment_id = map.from_id
544            AND map.table_name = 'PER_ALL_ASSIGNMENTS_F'
545            AND map.to_id = asg.assignment_id
546            AND asg.business_group_id = csr_rec.to_business_group_id
547            AND rownum < 2;
548 
549         l_text := 'Assignment No: ' || l_assignment_number || ' - ' || l_text ;
550       EXCEPTION
551         WHEN NO_DATA_FOUND THEN
552           null;
553         WHEN OTHERS THEN
554           fnd_file.put_line(FND_FILE.LOG, SQLERRM);
555       END;
556 --
557     end if;
558      -- code ends
559     fnd_file.put_line(FND_FILE.LOG, l_text);
560     fnd_message.clear;
561   END LOOP;
562 EXCEPTION
563   WHEN OTHERS THEN
564     fnd_message.clear;
565     fnd_file.put_line(FND_FILE.LOG, SQLERRM );
566     RAISE;
567 END generate_error_report;
568 END hr_h2pi_error;