[Home] [Help]
PACKAGE BODY: APPS.ARI_PRINT_REQUEST_NOTIFICATION
Source
4 /*=======================================================================+
1 PACKAGE BODY ARI_PRINT_REQUEST_NOTIFICATION as
2 /* $Header: ARIPRNTB.pls 120.2 2006/06/21 07:52:12 abathini noship $ */
3
5 | Package Global Constants
6 +=======================================================================*/
7 G_PKG_NAME CONSTANT VARCHAR2(30) := 'ARI_PRINT_REQUEST_NOTIFICATION';
8 PG_DEBUG VARCHAR2(1) := NVL(FND_PROFILE.value('AFLOG_ENABLED'), 'N');
9
10 /*============================================================
11 | PUBLIC notify
12 |
13 | DESCRIPTION
14 | PL/SQL Concurrent Program to send a single workflow notification
15 | on submission of multiple print requests in iReceivables
16 |
17 | PSEUDO CODE/LOGIC
18 |
19 | PARAMETERS
20 | p_requests IN NUMBER
21 | p_max_wait_time IN NUMBER DEFAULT 21600
22 | p_requests_list IN VARCHAR2
23 | p_user_name IN VARCHAR2
24 | p_customer_name IN VARCHAR2
25 |
26 | KNOWN ISSUES
27 |
28 |
29 |
30 | NOTES
31 |
32 |
33 |
34 | MODIFICATION HISTORY
35 | Date Author Description of Changes
36 | 19-OCT-2004 vnb Created
37 +============================================================*/
38
39 PROCEDURE notify(
40 errbuf OUT NOCOPY VARCHAR2,
41 retcode OUT NOCOPY NUMBER,
42 p_requests IN NUMBER,
43 p_max_wait_time IN NUMBER DEFAULT 21600,
44 p_requests_list IN VARCHAR2,
45 p_user_name IN VARCHAR2,
46 p_customer_name IN VARCHAR2
47
48 ) IS
49
50 l_request_id NUMBER(30);
51 l_requests_number NUMBER;
52 l_request_status BOOLEAN;
53
54 l_rphase VARCHAR2(255);
55 l_dphase VARCHAR2(255);
56 l_rstatus VARCHAR2(255);
57 l_dstatus VARCHAR2(255);
58 l_message VARCHAR2(32000);
59
60 l_procedure_name VARCHAR2(50);
61 l_debug_info VARCHAR2(200);
62
63 BEGIN
64 l_procedure_name := '.notify';
65 -- Initialize FND Global
66 FND_MSG_PUB.INITIALIZE;
67
68 ----------------------------------------------------------------------------------------
69 l_debug_info := 'Get the first Request Id to be polled for';
70 -----------------------------------------------------------------------------------------
71 IF (PG_DEBUG = 'Y') THEN
72 arp_standard.debug('Max Wait Time : '||p_max_wait_time);
73 arp_standard.debug('No of requests: '||p_requests);
74 arp_standard.debug('User Name : '||p_user_name);
75 arp_standard.debug(l_debug_info);
76 END IF;
77
78 IF (p_requests = 1) THEN
79 l_request_id := p_requests_list;
80 ELSE
81 l_request_id := SUBSTR(p_requests_list, 1, INSTR(p_requests_list,',',1,1)-1);
82 END IF;
83
84
85 FOR l_requests_number IN 1..p_requests LOOP
86
87 IF (PG_DEBUG = 'Y') THEN
88 arp_standard.debug('Polling Request Id: '||l_request_id);
89 END IF;
90
91 l_request_status := FND_CONCURRENT.wait_for_request(
92 request_id => l_request_id,
93 max_wait => p_max_wait_time,
94 phase => l_rphase,
95 status => l_rstatus,
96 dev_phase => l_dphase,
97 dev_status => l_dstatus,
98 message => l_message);
99
100 IF (p_requests > 1) THEN
101
102 ----------------------------------------------------------------------------------------
103 l_debug_info := 'Get the next Request Id to be polled for';
104 -----------------------------------------------------------------------------------------
105 IF (PG_DEBUG = 'Y') THEN
106 arp_standard.debug(l_debug_info);
107 END IF;
108
109 IF (l_requests_number = p_requests-1) THEN
113 l_request_id := SUBSTR(p_requests_list, INSTR(p_requests_list,',',1,l_requests_number-1),
110 l_request_id := SUBSTR(p_requests_list, INSTR(p_requests_list,',',1,p_requests-1)+1,
111 length(p_requests_list)- INSTR(p_requests_list,',',1,p_requests-1));
112 ELSE
114 INSTR(p_requests_list,',',1,l_requests_number));
115 END IF;
116
117 END IF;
118
119 END LOOP;
120
121 ----------------------------------------------------------------------------------------
122 l_debug_info := 'Send Workflow notification';
123 -----------------------------------------------------------------------------------------
124 IF (PG_DEBUG = 'Y') THEN
125 arp_standard.debug(l_debug_info);
126 END IF;
127
128 ARI_UTILITIES.send_notification(
129 p_user_name => p_user_name,
130 p_customer_name => p_customer_name,
131 p_request_id => fnd_global.conc_request_id,
132 p_requests => p_requests,
133 p_parameter => p_requests_list,
134 p_subject_msg_name => 'ARI_PRINT_NOTIFICATION_SUBJ',
135 p_subject_msg_appl => 'AR');
136
137 EXCEPTION
138 WHEN OTHERS THEN
139 IF (PG_DEBUG = 'Y') THEN
140 arp_standard.debug('Unexpected Exception in ' || G_PKG_NAME || l_procedure_name);
141 arp_standard.debug(' - Max Wait Time : '||p_max_wait_time);
142 arp_standard.debug(' - No of requests: '||p_requests);
143 arp_standard.debug(' - User Name : '||p_user_name);
144 arp_standard.debug(' - Customer Name : '||p_customer_name);
145 arp_standard.debug(' - Requests List : '||p_requests_list);
146 arp_standard.debug('ERROR =>'|| SQLERRM);
147 END IF;
148
149 FND_MESSAGE.SET_NAME ('AR','ARI_REG_DISPLAY_UNEXP_ERROR');
150 FND_MESSAGE.SET_TOKEN('PROCEDURE', G_PKG_NAME || l_procedure_name);
151 FND_MESSAGE.SET_TOKEN('ERROR',SQLERRM);
152 FND_MESSAGE.SET_TOKEN('DEBUG_INFO', l_debug_info);
153 FND_MSG_PUB.ADD;
154
155 END notify;
156
157 /*============================================================
158 | PUBLIC submit_notification_request
159 |
160 | DESCRIPTION
161 | Wrapper to submit the Concurrent Program to send a single workflow notification
162 | on submission of multiple print requests in iReceivables
163 |
164 | PSEUDO CODE/LOGIC
165 |
166 | PARAMETERS
167 | p_requests IN NUMBER
168 | p_max_wait_time IN NUMBER DEFAULT 21600
169 | p_requests_list IN VARCHAR2
170 | p_user_name IN VARCHAR2
171 | p_customer_name IN VARCHAR2
172 |
173 | KNOWN ISSUES
174 |
175 |
176 |
177 | NOTES
178 |
179 |
180 |
181 | MODIFICATION HISTORY
182 | Date Author Description of Changes
183 | 19-OCT-2004 vnb Created
184 +============================================================*/
185 PROCEDURE submit_notification_request(p_requests IN NUMBER,
186 p_max_wait_time IN NUMBER DEFAULT 21600,
187 p_requests_list IN VARCHAR2,
188 p_user_name IN VARCHAR2,
189 p_customer_name IN VARCHAR2) IS
190
191 m_request_id NUMBER;
192
193 l_procedure_name VARCHAR2(50);
194 l_debug_info VARCHAR2(200);
195
196 BEGIN
197 l_procedure_name := '.notify';
198
199 savepoint start_notify;
200
201 ----------------------------------------------------------------------------------------
202 l_debug_info := 'Submit the iReceivables Print Notification Concurrent Program';
203 -----------------------------------------------------------------------------------------
204 IF (PG_DEBUG = 'Y') THEN
205 arp_standard.debug(l_debug_info);
206 END IF;
207
208 m_request_id := FND_REQUEST.SUBMIT_REQUEST(
209 application => 'AR'
210 , program => 'ARI_PRINT_NOTIFY'
211 , description => ''
212 , start_time => ''
213 , sub_request => FALSE
214 , argument1 => p_requests
215 , argument2 => p_max_wait_time
216 , argument3 => p_requests_list
217 , argument4 => p_user_name
218 , argument5 => p_customer_name
219 );
220
221 IF m_request_id <> 0 THEN
222 COMMIT;
223 END IF;
224
225 EXCEPTION
226 WHEN OTHERS THEN
227 IF (PG_DEBUG = 'Y') THEN
228 arp_standard.debug('Unexpected Exception in ' || G_PKG_NAME || l_procedure_name);
229 arp_standard.debug(' - Max Wait Time : '||p_max_wait_time);
230 arp_standard.debug(' - No of requests: '||p_requests);
231 arp_standard.debug(' - User Name : '||p_user_name);
232 arp_standard.debug(' - Customer Name : '||p_customer_name);
233 arp_standard.debug(' - Requests List : '||p_requests_list);
234 arp_standard.debug('ERROR =>'|| SQLERRM);
235 END IF;
236
237 FND_MESSAGE.SET_NAME ('AR','ARI_REG_DISPLAY_UNEXP_ERROR');
238 FND_MESSAGE.SET_TOKEN('PROCEDURE', G_PKG_NAME || l_procedure_name);
239 FND_MESSAGE.SET_TOKEN('ERROR',SQLERRM);
240 FND_MESSAGE.SET_TOKEN('DEBUG_INFO', l_debug_info);
241 FND_MSG_PUB.ADD;
242
243 ROLLBACK TO SAVEPOINT start_notify;
244
245 END submit_notification_request;
246
247 END;
248