DBA Data[Home] [Help]

PACKAGE BODY: APPS.IEX_STRY_CUWF_PUB

Source


1 PACKAGE BODY  IEX_STRY_CUWF_PUB  as
2 /* $Header: iexpscwb.pls 120.4.12010000.2 2009/11/18 08:55:55 pnaveenk ship $ */
3 -- Start of Comments
4 -- Package name     : IEX_STRY_CUWF_PUB
5 -- Purpose          :
6 -- History          :
7 -- NOTE             :
8 -- End of Comments
9 
10 G_PKG_NAME      CONSTANT    VARCHAR2(100):=  'IEX_STRY_CUWF_PUB ';
11 G_FILE_NAME     CONSTANT    VARCHAR2(50) := 'iexpscwb.pls';
12 
13 /**Name   AddInvalidArgMsg
14   **Appends to a message  the api name, parameter name and parameter Value
15  */
16 
17 --PG_DEBUG NUMBER(2) := TO_NUMBER(NVL(FND_PROFILE.value('IEX_DEBUG_LEVEL'), '20'));
18 PG_DEBUG NUMBER;
19 
20 --begin schekuri Bug#4506922 Date:02-Dec-2005
21 wf_yes 		varchar2(1) ;
22 wf_no 		varchar2(1) ;
23 --end schekuri Bug#4506922 Date:02-Dec-2005
24 
25 PROCEDURE AddInvalidArgMsg
26   ( p_api_name	    IN	VARCHAR2,
27     p_param_value	IN	VARCHAR2,
28     p_param_name	IN	VARCHAR2 ) IS
29 BEGIN
30    IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
31       fnd_message.set_name('IEX', 'IEX_API_ALL_INVALID_ARGUMENT');
32       fnd_message.set_token('API_NAME', p_api_name);
33       fnd_message.set_token('VALUE', p_param_value);
34       fnd_message.set_token('PARAMETER', p_param_name);
35       fnd_msg_pub.add;
36    END IF;
37 
38 
39 END AddInvalidArgMsg;
40 
41 /**Name   AddMissingArgMsg
42   **Appends to a message  the api name, parameter name and parameter Value
43  */
44 
45 PROCEDURE AddMissingArgMsg
46   ( p_api_name	    IN	VARCHAR2,
47     p_param_name	IN	VARCHAR2 )IS
48 BEGIN
49         IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
50             fnd_message.set_name('IEX', 'IEX_API_ALL_MISSING_PARAM');
51             fnd_message.set_token('API_NAME', p_api_name);
52             fnd_message.set_token('MISSING_PARAM', p_param_name);
53             fnd_msg_pub.add;
54         END IF;
55 END AddMissingArgMsg;
56 
57 /**Name   AddNullArgMsg
58 **Appends to a message  the api name, parameter name and parameter Value
59 */
60 
61 PROCEDURE AddNullArgMsg
62   ( p_api_name	    IN	VARCHAR2,
63     p_param_name	IN	VARCHAR2 )IS
64 BEGIN
65    IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_error) THEN
66       fnd_message.set_name('IEX', 'IEX_API_ALL_NULL_PARAMETER');
67       fnd_message.set_token('API_NAME', p_api_name);
68       fnd_message.set_token('NULL_PARAM', p_param_name);
69       fnd_msg_pub.add;
70    END IF;
71 
72 
73 END AddNullArgMsg;
74 
75 /**Name   AddFailMsg
76   **Appends to a message  the name of the object anf the operation (insert, update ,delete)
77 */
78 PROCEDURE AddfailMsg
79   ( p_object	    IN	VARCHAR2,
80     p_operation 	IN	VARCHAR2 ) IS
81 
82 BEGIN
83       fnd_message.set_name('IEX', 'IEX_FAILED_OPERATION');
84       fnd_message.set_token('OBJECT',    p_object);
85       fnd_message.set_token('OPERATION', p_operation);
86       fnd_msg_pub.add;
87 
88 END    AddfailMsg;
89 
90 
91 /** get user name
92  * this will used to send the notification
93 **/
94 
95 procedure get_username
96                        ( p_resource_id IN NUMBER,
97                          x_username    OUT NOCOPY VARCHAR2 ) IS
98 cursor c_getname(p_resource_id NUMBER) is
99 Select user_name
100 from jtf_rs_resource_extns
101 where resource_id =p_resource_id;
102 
103 BEGIN
104      OPEN c_getname(p_resource_id);
105      FETCH c_getname INTO x_username;
106      CLOSE c_getname;
107 
108 END;
109 -----populate set_notification_resources---------------------------------
110 procedure set_notification_resources(
111             p_resource_id       in number,
112             itemtype            in varchar2,
113             itemkey             in varchar2
114            ) IS
115 l_username VARCHAR2(100);
116 l_mgrname  VARCHAR2(100);
117 l_mgr_resource_id NUMBER ;
118 BEGIN
119 
120      -- get user name from  jtf_rs_resource_extns
121                      get_username
122                          ( p_resource_id =>p_resource_id,
123                            x_username    =>l_username);
124 
125       wf_engine.SetItemAttrText(itemtype  => itemtype,
126                                  itemkey   => itemkey,
127                                  aname     => 'NOTIFICATION_USERNAME',
128                                  avalue    =>  l_username);
129 
130   exception
131   when others then
132        null;
133 
134 END  set_notification_resources;
135 
136 
137 
138 /**
139 * populate the attributes which will send in the notification
140 **/
141 
142 procedure populate_attributes(
143    p_strategy_id    IN NUMBER,
144    itemtype         IN   varchar2,
145    itemkey          IN   varchar2) IS
146 
147  l_resource_id  NUMBER ;
148 
149  cursor c_get_delinquency(p_strategy_id number) is
150    select a.party_id, a.party_type, a.party_name,
151           b.cust_account_id,
152           b.status, b.payment_schedule_id,
153           b.aging_bucket_line_id,c.delinquency_id
154     from iex_delinquencies_all b, hz_parties a,iex_strategies c
155     where a.party_id(+)  = b.party_cust_id
156     and c.strategy_id    = p_strategy_id
157     and c.delinquency_id = b.delinquency_id;
158 
159 --Begin bug#4930374 schekuri 12-Jan-2006
160 --Removed the outer join to ar_payment_schedules to avoid FTS and NMV.
161 cursor c_get_payment(p_delinquency_id number) is
162   select a.amount_due_remaining
163    from ar_payment_schedules a, iex_delinquencies b
164   where a.payment_schedule_id = b.payment_schedule_id
165   and b.delinquency_id = p_delinquency_id;
166 
167 /*cursor c_get_payment(p_delinquency_id number) is
168   select a.amount_due_remaining
169    from ar_payment_schedules a, iex_delinquencies b
170   where a.payment_schedule_id(+) = b.payment_schedule_id
171   and b.delinquency_id = p_delinquency_id;*/
172 --End bug#4930374 schekuri 12-Jan-2006
173 
174 BEGIN
175 -- right now populating only these many atributes
176 -- strategy_id,workitem_id and notification_username
177 -- has been already populated
178     FOR d_rec in c_get_delinquency(p_strategy_id)
179     LOOP
180 
181         wf_engine.SetItemAttrNumber(itemtype  => itemtype,
182                                     itemkey   => itemkey,
183                                     aname     => 'DELINQUENCY_ID',
184                                     avalue    => d_rec.delinquency_id);
185 
186         wf_engine.SetItemAttrNumber(itemtype  => itemtype,
187                                     itemkey   => itemkey,
188                                     aname     => 'PARTY_ID',
189                                     avalue    => d_rec.party_id);
190         wf_engine.SetItemAttrText(itemtype  => itemtype,
191                                   itemkey   => itemkey,
192                                   aname     => 'PARTY_TYPE',
193                                   avalue    => d_rec.party_type);
194 
195         wf_engine.SetItemAttrText(itemtype  => itemtype,
196                                   itemkey   => itemkey,
197                                   aname     => 'PARTY_NAME',
198                                   avalue    => d_rec.party_name);
199 
200         wf_engine.SetItemAttrNumber(itemtype  => itemtype,
201                              itemkey   => itemkey,
202                              aname     => 'CUST_ACCOUNT_ID',
203                              avalue    => d_rec.cust_account_id);
204 
205         wf_engine.SetItemAttrText(itemtype  => itemtype,
206                              itemkey   => itemkey,
207                              aname     => 'DELINQUENCY_STATUS',
208                              avalue    => d_rec.status);
209 
210          wf_engine.SetItemAttrNumber(itemtype  => itemtype,
211                              itemkey   => itemkey,
212                              aname     => 'AGING_BUCKET_LINE_ID',
213                              avalue    => d_rec.aging_bucket_LINE_id);
214 
215          wf_engine.SetItemAttrNumber(itemtype  => itemtype,
216                              itemkey   => itemkey,
217                              aname     => 'PAYMENT_SCHEDULE_ID',
218                              avalue    => d_rec.payment_schedule_id);
219 
220          FOR p_rec in c_get_payment(d_rec.delinquency_id)
221          LOOP
222              wf_engine.SetItemAttrNumber(itemtype  => itemtype,
223                                         itemkey   => itemkey,
224                                         aname     => 'OVERDUE_AMOUNT',
225                                         avalue    => p_rec.amount_due_remaining);
226          END LOOP;
227 
228     END LOOP;
229 
230 
231 
232 
233 
234 End populate_attributes;
235 
236 
237 -----PUBLIC Procedures---------------------------------
238 
239 /*
240 **The standard API for the selector/callback function is as follows
241 */
242 
243 
244 procedure start_process (item_type   in varchar2,
245                          item_key    in varchar2,
246                          activity_id in number,
247                          command     in varchar2,
248                          result      in out NOCOPY varchar2) IS
249 BEGIN
250        null;
251 
252 
253 END start_process;
254 
255 procedure Start_CustomWF(
256     p_api_version             IN  NUMBER := 1.0,
257     p_init_msg_list           IN  VARCHAR2 ,
258     p_commit                  IN  VARCHAR2 ,
259     p_Custom_WF_rec           IN  CUSTOM_WF_REC_TYPE,
260     x_return_status           OUT NOCOPY VARCHAR2,
261     x_msg_count               OUT NOCOPY NUMBER,
262     x_msg_data                OUT NOCOPY VARCHAR2) IS
263 
264 
265   l_api_name                VARCHAR2(100) ;
266   l_api_name_full           CONSTANT VARCHAR2(100) := g_pkg_name || '.' || l_api_name;
267   l_init_msg_list           VARCHAR2(1)  ;
268   l_return_status           VARCHAR2(1);
269   l_msg_count               NUMBER;
270   l_msg_data                VARCHAR2(32767);
271   l_api_version             CONSTANT NUMBER   := 1.0;
272 
273   l_Custom_WF_rec        CUSTOM_WF_REC_TYPE;
274   l_itemtype VARCHAR2 (100);
275   l_itemkey  VARCHAR2 (100);
276   l_result   VARCHAR2(100);
277   l_ret_status   VARCHAR2(8);
278   l_resource_id  NUMBER ;
279   p_wait_date  DATE;
280   l_commit varchar2(1);
281 BEGIN
282 
283     l_api_name                := 'START_CUSTOMWF';
284     l_init_msg_list := p_init_msg_list;
285     if (p_init_msg_list is null ) then
286       l_init_msg_list           := FND_API.G_FALSE;
287     end if;
288     l_commit := p_commit;
289     if (p_commit is null ) then
290        l_commit                  := FND_API.G_FALSE;
291     end if;
292     l_resource_id             := nvl(fnd_profile.value('IEX_STRY_DEFAULT_RESOURCE'),0);
293 
294   SAVEPOINT	START_CUSTOMWF_PUB;
295 
296   -- Standard call to check for call compatibility.
297   IF NOT FND_API.Compatible_API_Call (l_api_version,
298                                       p_api_version,
299                                       l_api_name,
300                                       G_PKG_NAME)    THEN
301 	RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
302   END IF;
303 
304   -- Check p_init_msg_list
305   IF FND_API.to_Boolean( l_init_msg_list ) THEN
306     FND_MSG_PUB.initialize;
307   END IF;
308 -- IF PG_DEBUG < 10  THEN
309  IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
310     IEX_DEBUG_PUB.LogMessage('populate_attributes: ' || 'after init');
311  END IF;
312 
313   x_return_status := FND_API.G_RET_STS_SUCCESS;
314 
315     -- Check for required parameter p_strategy_id
316        IF (p_Custom_WF_rec.strategy_id IS NULL) OR
317         (p_Custom_WF_rec.strategy_id = FND_API.G_MISS_NUM) THEN
318 --           IF PG_DEBUG < 10  THEN
319            IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
320               IEX_DEBUG_PUB.LogMessage('populate_attributes: ' || 'Required Parameter p_Custom_WF_rec.strategy_id is invalid');
321            END IF;
322             AddMissingArgMsg(
323                    p_api_name    =>  l_api_name_full,
324                    p_param_name  =>  'p_Custom_WF_rec.strategy_id' );
325             RAISE FND_API.G_EXC_ERROR;
326        END IF;
327 --     IF PG_DEBUG < 10  THEN
328      IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
329         IEX_DEBUG_PUB.LogMessage('populate_attributes: ' || 'after p_Custom_WF_rec.strategy_id check');
330      END IF;
331 
332       -- Check for required parameter p_workitem_id
333        IF (p_Custom_WF_rec.workitem_id IS NULL) OR
334                 (p_Custom_WF_rec.workitem_id = FND_API.G_MISS_NUM) THEN
335 --           IF PG_DEBUG < 10  THEN
336            IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
337               IEX_DEBUG_PUB.LogMessage('populate_attributes: ' || 'Required Parameter p_Custom_WF_rec.workitem_id is invalid');
338            END IF;
339             AddMissingArgMsg(
340                    p_api_name    =>  l_api_name_full,
341                    p_param_name  =>  'p_Custom_WF_rec.workitem_id' );
342             RAISE FND_API.G_EXC_ERROR;
343        END IF;
344 --     IF PG_DEBUG < 10  THEN
345      IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
346         IEX_DEBUG_PUB.LogMessage('populate_attributes: ' || 'after p_Custom_WF_rec.workitem_id check');
347      END IF;
348 
349       -- Check for required parameter p_custom_itemtype
350       -- this is the work flow to be launched
351        IF (p_Custom_WF_rec.custom_itemtype IS NULL) OR
352                (p_Custom_WF_rec.custom_itemtype = FND_API.G_MISS_CHAR) THEN
353 --           IF PG_DEBUG < 10  THEN
354            IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
355               IEX_DEBUG_PUB.LogMessage('populate_attributes: ' || 'Required Parameter p_Custom_WF_rec.custom_itemtype is invalid');
356            END IF;
357             AddMissingArgMsg(
358                    p_api_name    =>  l_api_name_full,
359                    p_param_name  =>  'p_Custom_WF_rec.custom_itemtype' );
360             RAISE FND_API.G_EXC_ERROR;
361        END IF;
362 --     IF PG_DEBUG < 10  THEN
363      IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
364         IEX_DEBUG_PUB.LogMessage('populate_attributes: ' || 'after p_Custom_WF_rec.custom_itemtype check');
365      END IF;
366 
367 
368      x_return_status := FND_API.G_RET_STS_SUCCESS;
369 
370      l_itemtype := p_Custom_WF_rec.custom_itemtype;
371      l_itemkey  := p_Custom_WF_rec.workitem_id;
372 
373 --     IF PG_DEBUG < 10  THEN
374      IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
375         iex_debug_pub.logmessage('populate_attributes: ' ||  'itemtype =>' ||l_itemtype);
376      END IF;
377 --     IF PG_DEBUG < 10  THEN
378      IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
379         iex_debug_pub.logmessage('populate_attributes: ' ||  'itemkey =>' ||l_itemkey);
380      END IF;
381 
382     --create the custom process
383     --process is An optional argument that allows the selection of
384     --a particular process.for that item. Provide the process internal name.
385     --If process is null, the item type's selector function is used to determine the
386     --top level process to run. If you do not
387     --specify a selector function and this argument is null, an error will be raised.
388     -- but inthe selector function we have to pass the process name if it is 'RUN' mode
389     -- so we are passing the process name.
390 
391 
392      wf_engine.createprocess(itemtype => l_itemtype,
393                              itemkey  => l_itemkey,
394                              process  =>'IEX_STRATEGY_CUSTOM_WORKFLOW');
395 
396 --    IF PG_DEBUG < 10  THEN
397     IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
398        iex_debug_pub.logmessage ('populate_attributes: ' || ' after create workflow process');
399     END IF;
400 
401      wf_engine.SetItemAttrNumber(itemtype => l_itemtype,
402                                  itemkey  => l_itemkey,
403                                  aname     => 'STRATEGY_ID',
404                                  avalue    => p_Custom_WF_rec.strategy_id);
405 
406      wf_engine.SetItemAttrNumber(itemtype  => l_itemtype,
407                                   itemkey   => l_itemkey,
408                                   aname     => 'WORK_ITEMID',
409                                   avalue    => p_Custom_WF_rec.workitem_id);
410 
411 
412 
413       wf_engine.SetItemAttrNumber(itemtype  => l_itemtype,
414                              itemkey   => l_itemkey,
415                              aname     => 'USER_ID',
416                              avalue    => p_Custom_WF_rec.user_id);
417 
418 
419      wf_engine.SetItemAttrNumber(itemtype  => l_itemtype,
420                              itemkey   => l_itemkey,
421                              aname     => 'RESP_ID',
422                              avalue    => p_Custom_WF_rec.resp_id);
423 
424 
425      wf_engine.SetItemAttrNumber(itemtype  => l_itemtype,
426                              itemkey   => l_itemkey,
427                              aname     => 'RESP_APPL_ID',
428                              avalue    => p_Custom_WF_rec.resp_appl_id);
429 
430 
431 
432 
433     --wait 10 mts before sending the response
434     p_wait_date := IEX_STRY_UTL_PUB.get_Date
435                             (p_date =>SYSDATE,
436                              l_UOM  =>'MIN',  -- changed for bug 7631756 PNAVEENK
437                              l_UNIT =>10);
438 
439      wf_engine.SetItemAttrDate(itemtype  => l_itemtype,
440                                 itemkey   => l_itemkey,
441                                  aname     => 'WAIT_PERIOD',
442                                  avalue    => p_wait_date);
443 
444 --    IF PG_DEBUG < 10  THEN
445     IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
446        iex_debug_pub.logmessage ('populate_attributes: ' || ' before caling populate attributes');
447     END IF;
448     --populate the remaining attributes
449     --set the resource to whim the notification will be send
450      populate_attributes(
451                          p_strategy_id  =>p_Custom_WF_rec.strategy_id,
452                          itemtype       => l_itemtype,
453                          itemkey        => l_itemkey);
454 
455 
456 
457     --populate notification_resource
458     --sets the username to whom thenotification will be send
459     BEGIN
460           select resource_id into l_resource_id
461           from iex_strategy_work_items
462           where work_item_id =p_Custom_WF_rec.workitem_id;
463     EXCEPTION WHEN NO_DATA_FOUND THEN
464        l_resource_id   := nvl(fnd_profile.value('IEX_STRY_DEFAULT_RESOURCE'),0);
465     END;
466 
467      set_notification_resources(
468                    p_resource_id    =>l_resource_id,
469                    itemtype         =>l_itemtype,
470                    itemkey          =>l_itemkey);
471 IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
472     iex_debug_pub.logmessage (' before start workflow process');
473 END IF;
474 
475 
476     wf_engine.startprocess(itemtype => l_itemtype,
477                            itemkey  => l_itemkey);
478 IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
479     iex_debug_pub.logmessage (' after start workflow process');
480 END IF;
481 
482     wf_engine.ItemStatus(
483           itemtype =>   l_itemType,
484           itemkey  =>   l_itemKey,
485           status   =>   l_ret_status,
486           result   =>   l_result);
487 
488     if (l_ret_status in (wf_engine.eng_completed, wf_engine.eng_active )) THEN
489          x_return_status := FND_API.G_RET_STS_SUCCESS;
490     else
491         x_return_status := FND_API.G_RET_STS_ERROR;
492     end if;
493 IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
494    iex_debug_pub.logmessage (' workflow return status = ' || l_return_status);
495 END IF;
496 
497 
498 
499   -- Standard check of p_commit
500   IF FND_API.To_Boolean(l_commit) THEN
501    COMMIT WORK;
502   END IF;
503 
504   -- Standard call to get message count and if count is 1, get message info
505   FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
506 
507 
508   EXCEPTION
509 	WHEN FND_API.G_EXC_ERROR THEN
510         ROLLBACK TO START_CUSTOMWF_PUB;
511 		x_return_status := FND_API.G_RET_STS_ERROR;
512 		FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
513 
514 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
515         ROLLBACK TO START_CUSTOMWF_PUB;
516 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
517 		FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
518 
519 	WHEN OTHERS THEN
520         ROLLBACK TO START_CUSTOMWF_PUB;
521 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
522 		IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
523 			FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
524 		END IF;
525 		FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
526 
527 
528 END  Start_CustomWF;
529 
530 
531 /** send signal to the main work flow that the custom work flow is over and
532  * also updates the work item
533  **/
534 
535 procedure wf_send_signal(
536   itemtype    in   varchar2,
537   itemkey     in   varchar2,
538   actid       in   number,
539   funcmode    in   varchar2,
540   result      out NOCOPY  varchar2)
541 IS
542 
543 l_work_item_id number;
544 l_strategy_id number;
545 l_return_status     VARCHAR2(20);
546 l_msg_count         NUMBER;
547 l_msg_data          VARCHAR2(2000);
548  exc                 EXCEPTION;
549  l_error VARCHAR2(32767);
550 
551  l_user_id             NUMBER;
552  l_resp_id             NUMBER;
553  l_resp_appl_id        NUMBER;
554 
555 Begin
556   if funcmode <> 'RUN' then
557     result := wf_engine.eng_null;
558     return;
559   end if;
560 
561   l_work_item_id := wf_engine.GetItemAttrNumber(
562                                            itemtype  => itemtype,
563                                            itemkey   => itemkey,
564                                            aname     => 'WORK_ITEMID');
565 
566   l_strategy_id := wf_engine.GetItemAttrNumber(
567                                            itemtype  => itemtype,
568                                            itemkey   => itemkey,
569                                            aname     => 'STRATEGY_ID');
570 
571    l_user_id := wf_engine.GetItemAttrNumber(
572                                            itemtype  => itemtype,
573                                            itemkey   => itemkey,
574                                            aname     => 'USER_ID');
575 
576    l_resp_id := wf_engine.GetItemAttrNumber(
577                                            itemtype  => itemtype,
578                                            itemkey   => itemkey,
579                                            aname     => 'RESP_ID');
580 
581    l_resp_appl_id := wf_engine.GetItemAttrNumber(
582                                            itemtype  => itemtype,
583                                            itemkey   => itemkey,
584                                            aname     => 'RESP_APPL_ID');
585 
586 --  IF PG_DEBUG < 10  THEN
587   IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
588      iex_debug_pub.logmessage ('wf_send_signal: ' || 'USER_ID' ||  l_user_id || ' RESP_ID ' ||  l_resp_id);
589   END IF;
590 --  IF PG_DEBUG < 10  THEN
591   IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
592      iex_debug_pub.logmessage ('wf_send_signal: ' || 'RESP_APPL_ID' ||l_resp_appl_id);
593   END IF;
594   --set the session
595   FND_GLOBAL.Apps_Initialize(l_user_id, l_resp_id, l_resp_appl_id);
596 
597   if (l_work_item_id is not null) then
598 
599     iex_stry_utl_pub.update_work_item(
600                            p_api_version   => 1.0,
601                            p_commit        => FND_API.G_TRUE,
602                            p_init_msg_list => FND_API.G_TRUE,
603                            p_work_item_id  => l_work_item_id,
604                            p_status        => 'COMPLETE',
605                            x_return_status => l_return_status,
606                            x_msg_count     => l_msg_count,
607                            x_msg_data      => l_msg_data
608                            );
609 
610      if l_return_status =FND_API.G_RET_STS_SUCCESS THEN
611        iex_strategy_wf.send_signal(
612                          process    => 'IEXSTRY' ,
613                          strategy_id => l_strategy_id,
614                          status      => 'COMPLETE',
615                          work_item_id => l_work_item_id,
616                          signal_source =>'CUSTOM');
617 
618 
619    end if; -- if update is succcessful;
620  end if;
621 
622  result := wf_engine.eng_completed;
623 
624 exception
625 WHEN EXC THEN
626      --pass the error message
627       -- get error message and pass
628       iex_strategy_wf.Get_Messages(l_msg_count,l_error);
629 --      IF PG_DEBUG < 10  THEN
630       IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
631          iex_debug_pub.logmessage('wf_send_signal: ' || 'error message is ' || l_error);
632       END IF;
633   wf_core.context('IEX_STRY_CUWF_PUB','wf_send_signal',itemtype,
634                    itemkey,to_char(actid),funcmode,l_error);
635      raise;
636 
637 when others then
638 
639   wf_core.context('IEX_STRY_CUWF_PUB','wf_send_signal',itemtype,
640                    itemkey,to_char(actid),funcmode);
641   raise;
642 end wf_send_signal;
643 
644 
645 --Begin schekuri Bug#4506922 Date:02-Dec-2005
646 --added for the function WAIT_ON_HOLD_SIGNAL in workflow IEXSTRCM
647 procedure wait_on_hold_signal(
648                          itemtype    in   varchar2,
649                          itemkey     in   varchar2,
650                          actid       in   number,
651                          funcmode    in   varchar2,
652                          result      out nocopy  varchar2) IS
653 
654 l_work_item_temp_id NUMBER;
655 l_result VARCHAR2(1);
656 l_value VARCHAR2(300);
657 
658 BEGIN
659 IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
660     iex_debug_pub.logmessage ('**** START wait_on_hold_signal ************');
661 END IF;
662     if funcmode <> wf_engine.eng_run then
663 IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
664        iex_debug_pub.logmessage('SECOND TIME FUNCMODE' ||funcmode);
665 END IF;
666         result := wf_engine.eng_null;
667         return;
668     end if;
669 
670 
671 
672 IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
673      iex_debug_pub.logmessage('FUNCMODE' ||funcmode);
674 END IF;
675 /*      l_value :=wf_engine.GetActivityLabel(actid);
676       wf_engine.SetItemAttrText(itemtype  => itemtype,
677                            itemkey   => itemkey,
678                            aname     => 'ACTIVITY_NAME',
679                            avalue    => l_value);
680 IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
681       iex_debug_pub.logMessage('ACTIVITYNAME' ||l_value);
682 END IF;*/
683 
684 
685    result := wf_engine.eng_notified||':'||wf_engine.eng_null||
686                  ':'||wf_engine.eng_null;
687 IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
688   iex_debug_pub.logmessage ('**** END wait_on_hold_signal ************');
689 END IF;
690  exception
691 when others then
692        result := wf_engine.eng_completed ||':'||wf_no;
693   wf_core.context('IEX_STRY_CUWF_PUB','wait_on_hold_signal',itemtype,
694                    itemkey,to_char(actid),funcmode);
695   raise;
696 
697 END  wait_on_hold_signal;
698 --end schekuri Bug#4506922 Date:02-Dec-2005
699 
700 
701 BEGIN
702   -- initialize values
703   PG_DEBUG := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
704 
705   --begin schekuri Bug#4506922 Date:02-Dec-2005
706   wf_yes      := 'Y';
707   wf_no       := 'N';
708   --end schekuri Bug#4506922 Date:02-Dec-2005
709 
710 END IEX_STRY_CUWF_PUB ;
711 
712