[Home] [Help]
Skip to content
PACKAGE BODY: APPS.WRITE_AUDIT
Source
1 PACKAGE BODY write_audit as
2 /* $Header: payustextio.pkb 120.1 2010/10/07 09:15:34 sjawid noship $ */
3
4 g_file_type utl_file.file_type;
5 g_IL_fein varchar2(10);
6 g_file_name varchar2(30);
7 TEMP_DIR varchar2(255);
8 TEMP_UTL v$parameter.value%type;
9
10 procedure open(p_reportname in varchar2) is
11 l_applcsf varchar2(2000);
12 l_per_top varchar2(2000);
13 l_applout varchar2(2000);
14 l_path varchar2(2000);
15 l_file_name varchar2(100);
16 l_name varchar2(60) := 'utl_file.fopen';
17
18 CURSOR c_concurrent_id is
19 select max(fcr.request_id)
20 from fnd_concurrent_requests fcr
21 ,fnd_concurrent_programs fcp
22 where fcp.application_id = 800
23 and fcp.concurrent_program_name = p_reportname
24 and fcr.concurrent_program_id = fcp.concurrent_program_id
25 and fcr.program_application_id = fcp.application_id;
26
27 l_request_id number;
28
29 begin
30
31 select translate(ltrim(value),',',' ')
32 into TEMP_UTL
33 from v$parameter
34 where name = 'utl_file_dir';
35
36 if (instr(TEMP_UTL,' ') > 0 and TEMP_UTL is not null) then
37 select substrb(TEMP_UTL, 1, instr(TEMP_UTL,' ') - 1)
38 into TEMP_DIR
39 from dual ;
40 elsif (TEMP_UTL is not null) then
41 TEMP_DIR := TEMP_UTL;
42 end if;
43
44 if (TEMP_UTL is null or TEMP_DIR is null ) then
45 raise no_data_found;
46 end if;
47
48
49 open c_concurrent_id;
50 fetch c_concurrent_id into l_request_id;
51 close c_concurrent_id;
52
53 g_file_name := 'o' || to_char(l_request_id);
54 l_file_name := g_file_name || '.a03';
55
56 g_file_type := utl_file.fopen(TEMP_DIR,l_file_name,'w');
57
58 hr_utility.trace('utl_file.fopen :' || l_path);
59 exception when others then
60 hr_utility.set_location('Leaving....' || l_name,999);
61 fnd_message.raise_error;
62 end open;
63
64 procedure put(p_char in varchar2) is
65
66 l_name varchar2(60) := 'utl_file.put';
67 begin
68
69 --utl_file.put(g_file_type,convert(p_char,'US7ASCII',c_source_cset));
70
71 /*utl_file.put(g_file_type,p_char);*/
72 utl_file.put_line(g_file_type,p_char,true);
73 hr_utility.trace('utl_file.put :' || p_char);
74
75 exception when others then
76 hr_utility.set_location('Leaving....' || l_name,999);
77 fnd_message.raise_error;
78 end put;
79
80 procedure close is
81 l_name varchar2(60) := ' utl_file.fclose';
82 begin
83
84 -- Close file.
85
86
87 utl_file.fclose(g_file_type);
88
89 hr_utility.trace('utl_file.fclose state mag file closed ');
90 exception when others then
91 hr_utility.set_location('Leaving....' || l_name,999);
92 fnd_message.raise_error;
93 end close;
94
95 END write_audit;