[Home] [Help]
PACKAGE BODY: APPS.WSH_UTILITIES
Source
1 package body Wsh_Utilities AS
2 /* $Header: WSHUTILB.pls 115.5 2004/04/27 21:46:15 anviswan ship $ */
3 /* This Function return the output log directory to create any kind of output file */
4
5 --
6 G_PKG_NAME CONSTANT VARCHAR2(50) := 'WSH_UTILITIES';
7 C_MAX_MESSAGE_SIZE CONSTANT NUMBER := 1000; --3509004:public api change
8 --
9 Function Get_Output_file_dir return varchar2
10 IS
11
12 v_db_name VARCHAR2(100);
13 v_log_name VARCHAR2(100);
14 v_db_name VARCHAR2(100);
15 v_st_position number(3);
16 v_end_position number(3);
17 v_w_position number(3);
18 --
19 l_debug_on BOOLEAN;
20 --
21 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'GET_OUTPUT_FILE_DIR';
22 --
23 BEGIN
24 --
25 -- Debug Statements
26 --
27 --
28 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
29 --
30 IF l_debug_on IS NULL
31 THEN
32 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
33 END IF;
34 --
35 IF l_debug_on THEN
36 WSH_DEBUG_SV.push(l_module_name);
37 END IF;
38 --
39 select INSTR(value,',',1,2),INSTR(value,',',1,3)
40 into v_st_position,v_end_position from v$parameter
41 where upper(name) = 'UTL_FILE_DIR';
42 v_w_position := v_end_position - v_st_position - 1;
43 select substr(value,v_st_position+1,v_w_position)
44 into v_log_name from v$parameter
45 where upper(name) = 'UTL_FILE_DIR';
46 v_log_name := ltrim(v_log_name);
47 FND_FILE.PUT_NAMES(v_log_name,v_log_name,v_log_name);
48 --
49 -- Debug Statements
50 --
51 IF l_debug_on THEN
52 WSH_DEBUG_SV.pop(l_module_name);
53 END IF;
54 --
55 return v_log_name;
56 EXCEPTION
57 WHEN OTHERS then
58 --
59 -- Debug Statements
60 --
61 IF l_debug_on THEN
62 WSH_DEBUG_SV.logmsg(l_module_name,'Unexpected error has occured. Oracle error message is '|| SQLERRM,WSH_DEBUG_SV.C_UNEXPEC_ERR_LEVEL);
63 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
64 END IF;
65 --
66 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
67 END Get_Output_file_dir;
68
69 --3509004:public api change
70 PROCEDURE process_message(
71 p_entity IN VARCHAR2,
72 p_entity_name IN VARCHAR2,
73 p_attributes IN VARCHAR2,
74 x_return_status OUT NOCOPY VARCHAR2
75 ) IS
76
77 l_attributes VARCHAR2(32767) DEFAULT '';
78 l_sub_string VARCHAR2(32767);
79 l_end_index NUMBER;
80 l_temp VARCHAR2(2000);
81 l_token_string VARCHAR2(32767);
82 --
83 l_debug_on BOOLEAN;
84 --
85 l_module_name CONSTANT VARCHAR2(100) := 'wsh.plsql.' || G_PKG_NAME || '.' || 'process_message';
86 --
87 BEGIN
88 --
89 --
90 l_debug_on := WSH_DEBUG_INTERFACE.g_debug;
91 --
92 IF l_debug_on IS NULL
93 THEN
94 l_debug_on := WSH_DEBUG_SV.is_debug_enabled;
95 END IF;
96 --
97 IF l_debug_on THEN
98 WSH_DEBUG_SV.push(l_module_name);
99 --
100 WSH_DEBUG_SV.log(l_module_name,'p_entity',p_entity);
101 WSH_DEBUG_SV.log(l_module_name,'p_attributes',p_attributes);
102 END IF;
103 --
104 x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;
105
106 l_token_string := p_attributes;
107
108 --for testing
109 /*
110 FOR K in 1..400 LOOP
111 l_token_string := l_token_string || 'Test, ';
112 END LOOP;
113 */
114 -- end for testing
115
116 l_sub_string := substrb(l_token_string,1,C_MAX_MESSAGE_SIZE);
117 l_end_index := INSTRB(l_sub_string,', ', -1) - 2;
118
119 IF l_debug_on THEN
120 WSH_DEBUG_SV.log(l_module_name,'l_token_string',l_token_string);
121 WSH_DEBUG_SV.log(l_module_name,'length(l_token_string)',length(l_token_string));
122 WSH_DEBUG_SV.log(l_module_name,'l_end_index',l_end_index);
123 END IF;
124
125 while l_end_index > 0
126 LOOP
127 --set the message
128 FND_MESSAGE.SET_NAME('WSH','WSH_DISABLED_COLUMNS_' || p_entity);
129 FND_MESSAGE.SET_TOKEN('ENTITY_NAME',p_entity_name);
130 FND_MESSAGE.SET_TOKEN('LIST_ATTRIBUTES',substrb(l_token_string,1,l_end_index+1));
131 WSH_UTIL_CORE.ADD_MESSAGE(WSH_UTIL_CORE.G_RET_STS_WARNING,l_module_name);
132 l_token_string := substrb(l_token_string , l_end_index + 4);
133
134 IF l_debug_on THEN
135 WSH_DEBUG_SV.log(l_module_name,'l_token_string',l_token_string);
136 WSH_DEBUG_SV.log(l_module_name,'length(l_token_string)',length(l_token_string));
137 WSH_DEBUG_SV.log(l_module_name,'l_end_index',l_end_index);
138 END IF;
139
140 IF length(l_token_string) <= C_MAX_MESSAGE_SIZE THEN
141 l_token_string := substr(l_token_string,1, length(l_token_string) -2);
142 IF l_debug_on THEN
143 WSH_DEBUG_SV.log(l_module_name,'last msg l_token_string',l_token_string);
144 END IF;
145 IF l_token_string is NOT NULL THEN
146 FND_MESSAGE.SET_NAME('WSH','WSH_DISABLED_COLUMNS_' || p_entity);
147 FND_MESSAGE.SET_TOKEN('ENTITY_NAME',p_entity_name);
148 FND_MESSAGE.SET_TOKEN('LIST_ATTRIBUTES',l_token_string);
149 WSH_UTIL_CORE.ADD_MESSAGE(WSH_UTIL_CORE.G_RET_STS_WARNING,l_module_name);
150 END IF;
151 l_end_index := 0;
152 ELSE
153 l_sub_string := substrb(l_token_string,1,C_MAX_MESSAGE_SIZE);
154 l_end_index := INSTRB(l_sub_string,', ', -1) - 2;
155 END IF;
156 END LOOP;
157
158 IF l_debug_on THEN
159 WSH_DEBUG_SV.pop(l_module_name);
160 END IF;
161 --
162 EXCEPTION
163 WHEN OTHERS THEN
164 x_return_status := WSH_UTIL_CORE.G_RET_STS_UNEXP_ERROR ;
165 --
166 IF l_debug_on THEN
167 WSH_DEBUG_SV.pop(l_module_name,'EXCEPTION:OTHERS');
168 END IF;
169 --
170
171 END process_message;
172
173 END Wsh_Utilities;