44: l_proc CONSTANT VARCHAR2 (72) := g_package
45: || 'upload_tax_ben';
46: p_legislation_code per_business_groups.legislation_code%TYPE;
47: -- File Handling variables
48: l_file_handle UTL_FILE.file_type;
49: l_filename VARCHAR2 (240);
50: l_location VARCHAR2 (4000);
51: l_line_read VARCHAR2 (4000) := NULL;
52: l_batch_line g_batch_line;
87: END IF;
88:
89: -- Open flat file
90: l_file_handle :=
91: UTL_FILE.fopen (l_location, l_filename, c_read_file, c_max_linesize);
92: -- Create the Batch header
93: create_tax_ben_batch_header (
94: p_effective_date=> fnd_date.canonical_to_date (p_effective_date),
95: p_name=> NVL (
112: -- exit condition for the loop
113: <
114: LOOP
115: BEGIN
116: UTL_FILE.get_line (l_file_handle, l_line_read);
117: l_batch_seq := l_batch_seq
118: + 1;
119: EXCEPTION
120: WHEN VALUE_ERROR
117: l_batch_seq := l_batch_seq
118: + 1;
119: EXCEPTION
120: WHEN VALUE_ERROR
121: -- Input line too large for buffer specified in UTL_FILE.fopen
122: THEN
123: IF UTL_FILE.is_open (l_file_handle)
124: THEN
125: UTL_FILE.fclose (l_file_handle);
119: EXCEPTION
120: WHEN VALUE_ERROR
121: -- Input line too large for buffer specified in UTL_FILE.fopen
122: THEN
123: IF UTL_FILE.is_open (l_file_handle)
124: THEN
125: UTL_FILE.fclose (l_file_handle);
126: END IF;
127:
121: -- Input line too large for buffer specified in UTL_FILE.fopen
122: THEN
123: IF UTL_FILE.is_open (l_file_handle)
124: THEN
125: UTL_FILE.fclose (l_file_handle);
126: END IF;
127:
128: hr_utility.set_location (l_proc, 180);
129: retcode := c_error;
264: END LOOP read_lines_in_file;
265:
266: -- Commit the outstanding records
267: COMMIT;
268: UTL_FILE.fclose (l_file_handle);
269: hr_utility.set_location ( 'Leaving:'
270: || l_proc, 50);
271: -- hr_utility.trace_off;
272: -- Most off these exceptions are not translated as they should not happen normally
275: WHEN e_fatal_error
276: -- No directory specified
277: THEN
278: -- Close the file in case off error
279: IF UTL_FILE.is_open (l_file_handle)
280: THEN
281: UTL_FILE.fclose (l_file_handle);
282: END IF;
283:
277: THEN
278: -- Close the file in case off error
279: IF UTL_FILE.is_open (l_file_handle)
280: THEN
281: UTL_FILE.fclose (l_file_handle);
282: END IF;
283:
284: hr_utility.set_location (l_proc, 100);
285: -- Set retcode to 2, indicating an ERROR to the ConcMgr
287: -- Set the application error
288: hr_utility.set_message (800, 'HR_78040_DATA_EXCHANGE_DIR_MIS');
289: -- Return the message to the ConcMgr (This msg will appear in the log file)
290: errbuf := hr_utility.get_message;
291: WHEN UTL_FILE.invalid_operation
292: -- File could not be opened as requested, perhaps because of operating system permissions
293: -- Also raised when attempting a write operation on a file opened for read, or a read operation
294: -- on a file opened for write.
295: THEN
292: -- File could not be opened as requested, perhaps because of operating system permissions
293: -- Also raised when attempting a write operation on a file opened for read, or a read operation
294: -- on a file opened for write.
295: THEN
296: IF UTL_FILE.is_open (l_file_handle)
297: THEN
298: UTL_FILE.fclose (l_file_handle);
299: END IF;
300:
294: -- on a file opened for write.
295: THEN
296: IF UTL_FILE.is_open (l_file_handle)
297: THEN
298: UTL_FILE.fclose (l_file_handle);
299: END IF;
300:
301: hr_utility.set_location (l_proc, 110);
302: retcode := c_error;
304: || l_location
305: || ' -> '
306: || l_filename
307: || ') - Invalid Operation.';
308: WHEN UTL_FILE.internal_error
309: -- Unspecified internal error
310: THEN
311: IF UTL_FILE.is_open (l_file_handle)
312: THEN
307: || ') - Invalid Operation.';
308: WHEN UTL_FILE.internal_error
309: -- Unspecified internal error
310: THEN
311: IF UTL_FILE.is_open (l_file_handle)
312: THEN
313: UTL_FILE.fclose (l_file_handle);
314: END IF;
315:
309: -- Unspecified internal error
310: THEN
311: IF UTL_FILE.is_open (l_file_handle)
312: THEN
313: UTL_FILE.fclose (l_file_handle);
314: END IF;
315:
316: hr_utility.set_location (l_proc, 120);
317: retcode := c_error;
319: || l_location
320: || ' -> '
321: || l_filename
322: || ') - Internal Error.';
323: WHEN UTL_FILE.invalid_mode
324: -- Invalid string specified for file mode
325: THEN
326: IF UTL_FILE.is_open (l_file_handle)
327: THEN
322: || ') - Internal Error.';
323: WHEN UTL_FILE.invalid_mode
324: -- Invalid string specified for file mode
325: THEN
326: IF UTL_FILE.is_open (l_file_handle)
327: THEN
328: UTL_FILE.fclose (l_file_handle);
329: END IF;
330:
324: -- Invalid string specified for file mode
325: THEN
326: IF UTL_FILE.is_open (l_file_handle)
327: THEN
328: UTL_FILE.fclose (l_file_handle);
329: END IF;
330:
331: hr_utility.set_location (l_proc, 130);
332: retcode := c_error;
334: || l_location
335: || ' -> '
336: || l_filename
337: || ') - Invalid Mode.';
338: WHEN UTL_FILE.invalid_path
339: -- Directory or filename is invalid or not accessible
340: THEN
341: IF UTL_FILE.is_open (l_file_handle)
342: THEN
337: || ') - Invalid Mode.';
338: WHEN UTL_FILE.invalid_path
339: -- Directory or filename is invalid or not accessible
340: THEN
341: IF UTL_FILE.is_open (l_file_handle)
342: THEN
343: UTL_FILE.fclose (l_file_handle);
344: END IF;
345:
339: -- Directory or filename is invalid or not accessible
340: THEN
341: IF UTL_FILE.is_open (l_file_handle)
342: THEN
343: UTL_FILE.fclose (l_file_handle);
344: END IF;
345:
346: retcode := c_error;
347: errbuf := 'Reading Taxable Benefits File ('
349: || ' -> '
350: || l_filename
351: || ') - Invalid Path or Filename.';
352: hr_utility.set_location (l_proc, 140);
353: WHEN UTL_FILE.invalid_filehandle
354: -- File handle does not specify an open file
355: THEN
356: IF UTL_FILE.is_open (l_file_handle)
357: THEN
352: hr_utility.set_location (l_proc, 140);
353: WHEN UTL_FILE.invalid_filehandle
354: -- File handle does not specify an open file
355: THEN
356: IF UTL_FILE.is_open (l_file_handle)
357: THEN
358: UTL_FILE.fclose (l_file_handle);
359: END IF;
360:
354: -- File handle does not specify an open file
355: THEN
356: IF UTL_FILE.is_open (l_file_handle)
357: THEN
358: UTL_FILE.fclose (l_file_handle);
359: END IF;
360:
361: hr_utility.set_location (l_proc, 150);
362: retcode := c_error;
364: || l_location
365: || ' -> '
366: || l_filename
367: || ') - Invalid File Handle.';
368: WHEN UTL_FILE.read_error
369: -- Operating system error occurred during a read operation
370: THEN
371: IF UTL_FILE.is_open (l_file_handle)
372: THEN
367: || ') - Invalid File Handle.';
368: WHEN UTL_FILE.read_error
369: -- Operating system error occurred during a read operation
370: THEN
371: IF UTL_FILE.is_open (l_file_handle)
372: THEN
373: UTL_FILE.fclose (l_file_handle);
374: END IF;
375:
369: -- Operating system error occurred during a read operation
370: THEN
371: IF UTL_FILE.is_open (l_file_handle)
372: THEN
373: UTL_FILE.fclose (l_file_handle);
374: END IF;
375:
376: hr_utility.set_location (l_proc, 160);
377: retcode := c_error;