1 PACKAGE GL_WF_JE_APPROVAL_PKG AUTHID CURRENT_USER AS
2 /* $Header: glwfjeas.pls 120.5 2005/08/25 23:32:39 ticheng ship $ */
3
4 --
5 -- Package
6 -- GL_WF_JE_APPROVAL_PKG
7 -- Purpose
8 -- Functions for JE approval workflow
9 -- History
10 -- 06/30/97 R Goyal Created
11 --
12 -- Public variables
13 diagn_msg_flag BOOLEAN := FALSE; -- whether to display diagnostic messages
14
15 --
16 -- Procedure
17 -- start_approval_workflow
18 -- Purpose
19 -- Start approval workflow for a process.
20 -- History
21 -- 06/30/97 R Goyal Created
22 -- Arguments
23 -- p_je_batch_id ID of batch (GL_JE_BATCHES.JE_BATCH_ID)
24 -- p_preparer_fnd_user_id FND UserID of preparer
25 -- (GL_JE_BATCHES.CREATED_BY)
26 -- p_preparer_resp_id ID of responsibility while JE was entered
27 -- or created
28 -- Example
29 -- GL_WF_JE_APPROVAL_PKG.Start_Approval_Workflow(42789,1045,1003,'abc');
30 --
31 -- Notes
32 -- Called from Enter Journals form or from separate process.
33 -- Must be called after a JE batch and all it's headers and lines have
34 -- been inserted into the DB.
35 --
36 PROCEDURE start_approval_workflow(p_je_batch_id IN NUMBER,
37 p_preparer_fnd_user_id IN NUMBER,
38 p_preparer_resp_id IN NUMBER,
39 p_je_batch_name IN VARCHAR2);
40
41 --
42 -- Procedure
43 -- is_employee_set
44 -- Purpose
45 -- Checks whether the employee is set
46 -- History
47 -- 08/11/99 R Goyal Created.
48 -- Arguments
49 -- itemtype Workflow item type (JE Batch)
50 -- itemkey ID of JE batch
51 -- actid ID of activity, provided by workflow engine
52 -- (not used in this procedure)
53 -- funcmode Function mode (RUN or CANCEL)
54 -- Example
55 -- N/A (not user-callable)
56 --
57 -- Notes
58 -- This procedure is called from the Oracle Workflow engine
59 -- It checks whether an employee is associated with the user.
60 --
61 PROCEDURE is_employee_set(itemtype IN VARCHAR2,
62 itemkey IN VARCHAR2,
63 actid IN NUMBER,
64 funcmode IN VARCHAR2,
65 result OUT NOCOPY VARCHAR2);
66
67 --
68 -- Procedure
69 -- get_sob_attributes (DO NOT CHANGE THIS NAME FOR UPGRADE CONSIDERATIONS)
70 -- Purpose
71 -- Copy information about a ledger in the batch to worklow tables
72 -- History
73 -- 06/30/97 R Goyal Created.
74 -- Arguments
75 -- itemtype Workflow item type (JE Batch)
76 -- itemkey ID of JE batch
77 -- actid ID of activity, provided by workflow engine
78 -- (not used in this procedure)
79 -- funcmode Function mode (RUN or CANCEL)
80 -- Example
81 -- N/A (not user-callable)
82 --
83 -- Notes
84 -- This procedure is called from the Oracle Workflow engine
85 -- It retrieves data elements about the Ledgers in the batch, one ledger
86 -- at a time, and stores them in the workflow tables to make them
87 -- available for messages and subsequent procedures.
88 --
89 PROCEDURE get_sob_attributes(itemtype IN VARCHAR2,
90 itemkey IN VARCHAR2,
91 actid IN NUMBER,
92 funcmode IN VARCHAR2,
93 result OUT NOCOPY VARCHAR2);
94
95 --
96 -- Procedure
97 -- get_jeb_attributes
98 -- Purpose
99 -- Copy information about JE to worklow tables
100 -- History
101 -- 06/30/97 R Goyal Created.
102 -- Arguments
103 -- itemtype Workflow item type (JE Batch)
104 -- itemkey ID of JE batch
105 -- actid ID of activity, provided by workflow engine
106 -- (not used in this procedure)
107 -- funcmode Function mode (RUN or CANCEL)
108 -- result Result code
109 -- Example
110 -- N/A (not user-callable)
111 --
112 -- Notes
113 -- This procedure is called from the Oracle Workflow engine
114 -- It retrieves data elements about the JE batch (identified by the itemkey
115 -- argument) and stores them in the workflow tables to make them available
116 -- for messages and subsequent procedures.
117 --
118 PROCEDURE get_jeb_attributes(itemtype IN VARCHAR2,
119 itemkey IN VARCHAR2,
120 actid IN NUMBER,
121 funcmode IN VARCHAR2,
122 result OUT NOCOPY VARCHAR2);
123
124 --
125 -- Procedure
126 -- is_je_valid
127 -- Purpose
128 -- Check whether the JE is valid
129 -- History
130 -- 06/30/97 R Goyal Created.
131 -- Arguments
132 -- itemtype Workflow item type (JE Batch)
133 -- itemkey ID of JE batch
134 -- actid ID of activity, provided by workflow engine
135 -- (not used in this procedure)
136 -- funcmode Function mode (RUN or CANCEL)
137 -- result Result of activity (not used in this procedure)
138 -- Example
139 -- N/A (not user-callable)
140 --
141 -- Notes
142 -- This procedure is called from the Oracle Workflow engine
143 -- It determines whether the je is valid.
144 --
145 PROCEDURE is_je_valid(itemtype IN VARCHAR2,
146 itemkey IN VARCHAR2,
147 actid IN NUMBER,
148 funcmode IN VARCHAR2,
149 result OUT NOCOPY VARCHAR2);
150
151 --
152 -- Procedure
153 -- set_je_invalid
154 -- Purpose
155 -- Set the batch's approval status to Validation Failed
156 -- History
157 -- 06/30/97 R Goyal Created
158 -- Arguments
159 -- itemtype Workflow item type (JE Batch)
160 -- itemkey ID of JE batch
161 -- actid ID of activity, provided by workflow engine
162 -- funcmode Function mode (RUN or CANCEL)
163 -- result Result code
164 -- Example
165 -- N/A (not user-callable)
166 --
167 -- Notes
168 -- This procedure is called from the Oracle Workflow engine.
169 -- It sets the batch's approval status to 'Invalid' by updating the
170 -- corresponding record in GL_JE_BATCHES.
171 --
172 PROCEDURE set_je_invalid(itemtype IN VARCHAR2,
173 itemkey IN VARCHAR2,
174 actid IN NUMBER,
175 funcmode IN VARCHAR2,
176 result OUT NOCOPY VARCHAR2);
177
178 --
179 -- Procedure
180 -- does_je_need_approval
181 -- Purpose
182 -- Determines if the JE needs approval.
183 -- History
184 -- 06/30/97 R Goyal Created.
185 -- Arguments
186 -- itemtype Workflow item type (JE Batch)
187 -- itemkey ID of JE batch
188 -- actid ID of activity, provided by workflow engine
189 -- (not used in this procedure)
190 -- funcmode Function mode (RUN or CANCEL)
191 -- result Result of activity (PASS or FAIL)
192 -- Example
193 -- N/A (not user-callable)
194 --
195 -- Notes
196 -- This procedure is called from the Oracle Workflow engine.
197 -- It determines whether the je needs approval.
198 --
199 PROCEDURE does_je_need_approval(itemtype IN VARCHAR2,
200 itemkey IN VARCHAR2,
201 actid IN NUMBER,
202 funcmode IN VARCHAR2,
203 result OUT NOCOPY VARCHAR2);
204
205 --
206 -- Procedure
207 -- set_approval_not_required
208 -- Purpose
209 -- Set the batch's approval status to approval not required.
210 -- History
211 -- 06/30/97 R Goyal Created
212 -- Arguments
213 -- itemtype Workflow item type (JE Batch)
214 -- itemkey ID of JE batch
215 -- actid ID of activity, provided by workflow engine
216 -- (not used in this procedure)
217 -- funcmode Function mode (RUN or CANCEL)
218 -- Example
219 -- N/A (not user-callable)
220 --
221 -- Notes
222 -- This procedure is called from the Oracle Workflow engine.
223 -- It sets the batch's approval status to 'Not applicable' by updating the
224 -- corresponding record in GL_JE_BATCHES.
225 --
226 PROCEDURE set_approval_not_required(itemtype IN VARCHAR2,
227 itemkey IN VARCHAR2,
228 actid IN NUMBER,
229 funcmode IN VARCHAR2,
230 result OUT NOCOPY VARCHAR2);
231
232 --
233 -- Procedure
234 -- can_preparer_approve
235 -- Purpose
236 -- Check whether the JE is valid
237 -- History
238 -- 06/30/97 R Goyal Created.
239 -- Arguments
240 -- itemtype Workflow item type (JE Batch)
241 -- itemkey ID of JE batch
242 -- actid ID of activity, provided by workflow engine
243 -- (not used in this procedure)
244 -- funcmode Function mode (RUN or CANCEL)
245 -- result Result of activity (not used in this procedure)
246 -- Example
247 -- N/A (not user-callable)
248 --
249 -- Notes
250 -- This procedure is called from the Oracle Workflow engine
251 -- It determines whether the preparer can auto-approve.
252 --
253 PROCEDURE can_preparer_approve(itemtype IN VARCHAR2,
254 itemkey IN VARCHAR2,
255 actid IN NUMBER,
256 funcmode IN VARCHAR2,
257 result OUT NOCOPY VARCHAR2);
258
259 --
260 -- Procedure
261 -- set_approver_name
262 -- Purpose
263 -- Set the Approver name to the Preparer Name
264 -- History
265 -- 07/10/97 R Goyal Created
266 -- Arguments
267 -- itemtype Workflow item type (JE Batch)
268 -- itemkey ID of JE batch
269 -- actid ID of activity, provided by workflow engine
270 -- (not used in this procedure)
271 -- funcmode Function mode (RUN or CANCEL)
272 -- Example
273 -- N/A (not user-callable)
274 --
275 -- Notes
276 -- This procedure is called from the Oracle Workflow engine.
277 -- It sets the approver name equal to the preparer name
278 -- when the batch is auto-approved.
279 --
280 PROCEDURE set_approver_name(itemtype IN VARCHAR2,
281 itemkey IN VARCHAR2,
282 actid IN NUMBER,
283 funcmode IN VARCHAR2,
284 result OUT NOCOPY VARCHAR2);
285
286 --
287 -- Procedure
288 -- set_je_approver
289 -- Purpose
290 -- Set the current or final approver of the batch.
291 -- History
292 -- 11/19/03 T Cheng Created
293 -- Arguments
294 -- itemtype Workflow item type (JE Batch)
295 -- itemkey ID of JE batch
296 -- actid ID of activity, provided by workflow engine
297 -- (not used in this procedure)
298 -- funcmode Function mode (RUN or CANCEL)
299 -- result Result of activity (not used in this procedure)
300 -- Example
301 -- N/A (not user-callable)
302 --
303 -- Notes
304 -- This procedure is called from the Oracle Workflow engine.
305 -- It updates the batch approver.
306 --
307 PROCEDURE set_je_approver(itemtype IN VARCHAR2,
308 itemkey IN VARCHAR2,
309 actid IN NUMBER,
310 funcmode IN VARCHAR2,
311 result OUT NOCOPY VARCHAR2);
312
313 --
314 -- Procedure
315 -- approve_je
316 -- Purpose
317 -- Approve journal entry batch.
318 -- History
319 -- 06/23/97 R Goyal Created
320 -- Arguments
321 -- itemtype Workflow item type (JE Batch)
322 -- itemkey ID of JE batch
323 -- actid ID of activity, provided by workflow engine
324 -- (not used in this procedure)
325 -- funcmode Function mode (RUN or CANCEL)
326 -- result Result of activity (not used in this procedure)
327 -- Example
328 -- N/A (not user-callable)
329 --
330 -- Notes
331 -- This procedure is called from the Oracle Workflow engine.
332 -- It updates the batch status to 'Approved'.
333 --
334 PROCEDURE approve_je(itemtype IN VARCHAR2,
335 itemkey IN VARCHAR2,
336 actid IN NUMBER,
337 funcmode IN VARCHAR2,
338 result OUT NOCOPY VARCHAR2);
339
340 --
341 -- Procedure
342 -- reject_je
343 -- Purpose
344 -- Reject journal entry batch.
345 -- History
346 -- 06/30/97 R Goyal Created
347 -- Arguments
348 -- itemtype Workflow item type (JE Batch)
349 -- itemkey ID of JE batch
350 -- actid ID of activity, provided by workflow engine
351 -- (not used in this procedure)
352 -- funcmode Function mode (RUN or CANCEL)
353 -- Example
354 -- N/A (not user-callable)
355 --
356 -- Notes
357 -- This procedure is called from the Oracle Workflow engine.
358 -- It sets the batch status to 'Rejected' by updating the
359 -- corresponding record in GL_JE_BATCHES.
360 --
361 PROCEDURE reject_je(itemtype IN VARCHAR2,
362 itemkey IN VARCHAR2,
363 actid IN NUMBER,
364 funcmode IN VARCHAR2,
365 result OUT NOCOPY VARCHAR2);
366
367 --
368 -- Procedure
369 -- find_approver
370 -- Purpose
371 -- Find the approver for the preparer of the journal entry
372 -- History
373 -- 07/10/97 R Goyal Created
374 -- Arguments
375 -- itemtype Workflow item type (JE Batch)
376 -- itemkey ID of JE batch
377 -- actid ID of activity, provided by workflow engine
378 -- (not used in this procedure)
379 -- funcmode Function mode (RUN or CANCEL)
380 -- Example
381 -- N/A (not user-callable)
382 --
383 -- Notes
384 -- This procedure is called from the Oracle Workflow engine.
385 -- It finds the approver for the preparer of the journal entry.
386 --
387 PROCEDURE find_approver(item_type IN VARCHAR2,
388 item_key IN VARCHAR2,
389 actid IN NUMBER,
390 funcmode IN VARCHAR2,
391 result OUT NOCOPY VARCHAR2);
392
393 --
394 -- Procedure
395 -- first_approver
396 -- Purpose
397 -- Finds out whether the current approver is the first approver for
398 -- the preparer's batch.
399 -- History
400 -- 07/10/97 R Goyal Created
401 -- Arguments
402 -- itemtype Workflow item type (JE Batch)
403 -- itemkey ID of JE batch
404 -- actid ID of activity, provided by workflow engine
405 -- (not used in this procedure)
406 -- funcmode Function mode (RUN or CANCEL)
407 -- Example
408 -- N/A (not user-callable)
409 --
410 -- Notes
411 -- This procedure is called from the Oracle Workflow engine.
412 -- It finds out whether the current approver is the first approver
413 -- for the preparer's batch.
414 --
415 PROCEDURE first_approver(item_type IN VARCHAR2,
416 item_key IN VARCHAR2,
417 actid IN NUMBER,
418 funcmode IN VARCHAR2,
419 result OUT NOCOPY VARCHAR2);
420
421 --
422 -- Procedure
423 -- set_curr_approver
424 -- Purpose
425 -- When approver is reassigned, update the approver's name
426 -- History
427 -- 01/26/05 T Cheng Created.
428 -- Arguments
429 -- itemtype Workflow item type (JE Batch)
430 -- itemkey ID of JE batch
431 -- actid ID of activity, provided by workflow engine
432 -- (not used in this procedure)
436 -- N/A (not user-callable)
433 -- funcmode Function mode (RUN or RESPOND or CANCEL)
434 -- result Result of activity (not used in this procedure)
435 -- Example
437 --
438 -- Notes
439 -- This procedure is called from the Oracle Workflow engine
440 -- It updates approver name in this post-notification function.
441 --
442 PROCEDURE set_curr_approver(itemtype IN VARCHAR2,
443 itemkey IN VARCHAR2,
444 actid IN NUMBER,
445 funcmode IN VARCHAR2,
446 result OUT NOCOPY VARCHAR2);
447
448 --
449 -- Procedure
450 -- mgr_equalto_aprv
451 -- Purpose
452 -- Find out whether the manager is equal to the approver
453 -- History
454 -- 07/10/97 R Goyal Created
455 -- Arguments
456 -- itemtype Workflow item type (JE Batch)
457 -- itemkey ID of JE batch
458 -- actid ID of activity, provided by workflow engine
459 -- (not used in this procedure)
460 -- funcmode Function mode (RUN or CANCEL)
461 -- Example
462 -- N/A (not user-callable)
463 --
464 -- Notes
465 -- This procedure is called from the Oracle Workflow engine.
466 -- It finds out whether the manager is equal to the
467 -- approver.
468 --
469 PROCEDURE mgr_equalto_aprv(item_type IN VARCHAR2,
470 item_key IN VARCHAR2,
471 actid IN NUMBER,
472 funcmode IN VARCHAR2,
473 result OUT NOCOPY VARCHAR2);
474
475 --
476 -- Procedure
477 -- notifyprep_noaprvresp
478 -- Purpose
479 -- Finds out whether the preparer should be notified about the
480 -- approver not responding
481 -- History
482 -- 07/10/97 R Goyal Created
483 -- Arguments
484 -- itemtype Workflow item type (JE Batch)
485 -- itemkey ID of JE batch
486 -- actid ID of activity, provided by workflow engine
487 -- (not used in this procedure)
488 -- funcmode Function mode (RUN or CANCEL)
489 -- Example
490 -- N/A (not user-callable)
491 --
492 -- Notes
493 -- This procedure is called from the Oracle Workflow engine.
494 -- It finds out whether the preparer should be notified about the
495 -- manager not responding.
496 --
497 PROCEDURE notifyprep_noaprvresp(item_type IN VARCHAR2,
498 item_key IN VARCHAR2,
499 actid IN NUMBER,
500 funcmode IN VARCHAR2,
501 result OUT NOCOPY VARCHAR2);
502
503 --
504 -- Procedure
505 -- get_approver_manager
506 -- Purpose
507 -- Get the manager of the approver
508 -- History
509 -- 07/10/97 R Goyal Created
510 -- Arguments
511 -- itemtype Workflow item type (JE Batch)
512 -- itemkey ID of JE batch
513 -- actid ID of activity, provided by workflow engine
514 -- (not used in this procedure)
515 -- funcmode Function mode (RUN or CANCEL)
516 -- Example
517 -- N/A (not user-callable)
518 --
519 -- Notes
520 -- This procedure is called from the Oracle Workflow engine.
521 -- It gets the approver's manager.
522 --
523 PROCEDURE get_approver_manager(item_type IN VARCHAR2,
524 item_key IN VARCHAR2,
525 actid IN NUMBER,
526 funcmode IN VARCHAR2,
527 result OUT NOCOPY VARCHAR2);
528
529 --
530 -- Procedure
531 -- record_forward_from_info
532 -- Purpose
533 -- Record the forward from info i.e. the approver from whom the entry
534 -- is being forwarded from.
535 -- History
536 -- 07/10/97 R Goyal Created
537 -- Arguments
538 -- itemtype Workflow item type (JE Batch)
539 -- itemkey ID of JE batch
540 -- actid ID of activity, provided by workflow engine
541 -- (not used in this procedure)
542 -- funcmode Function mode (RUN or CANCEL)
543 -- Example
544 -- N/A (not user-callable)
545 --
546 -- Notes
547 -- This procedure is called from the Oracle Workflow engine.
548 -- It records the forward from info.
549 --
550 PROCEDURE record_forward_from_info(item_type IN VARCHAR2,
551 item_key IN VARCHAR2,
552 actid IN NUMBER,
553 funcmode IN VARCHAR2,
554 result OUT NOCOPY VARCHAR2);
555
556 --
557 -- Procedure
558 -- verify_authority
559 -- Purpose
560 -- Hook to perform additional authoritization checks.
561 -- History
562 -- 06/30/97 R Goyal Created
563 -- Arguments
564 -- itemtype Workflow item type (JE Batch)
565 -- itemkey ID of JE batch
566 -- actid ID of activity, provided by workflow engine
567 -- (not used in this procedure)
568 -- funcmode Function mode (RUN or CANCEL)
569 -- result Result of activity (PASS or FAIL)
570 -- N/A (not user-callable)
571 --
572 -- Notes
573 -- This procedure is called from the Oracle Workflow engine.
574 -- It performs additional checks to determine if the approver has
575 -- sufficient authority.
576 --
580 funcmode IN VARCHAR2,
577 PROCEDURE verify_authority(itemtype IN VARCHAR2,
578 itemkey IN VARCHAR2,
579 actid IN NUMBER,
581 result OUT NOCOPY VARCHAR2);
582
583 --
584 -- Procedure
585 -- abort_process
586 -- Purpose
587 -- Abort the request process.
588 -- History
589 -- 08/23/05 T Cheng Created.
590 -- Arguments
591 -- itemtype Workflow item type (JE Batch)
592 -- itemkey ID of JE batch
593 -- actid ID of activity, provided by workflow engine
594 -- (not used in this procedure)
595 -- funcmode Function mode (RUN or RESPOND or CANCEL)
596 -- result Result of activity (not used in this procedure)
597 -- Example
598 -- N/A (not user-callable)
599 --
600 -- Notes
601 -- This procedure is called from the Oracle Workflow engine.
602 --
603 PROCEDURE abort_process(itemtype IN VARCHAR2,
604 itemkey IN VARCHAR2,
605 actid IN NUMBER,
606 funcmode IN VARCHAR2,
607 result OUT NOCOPY VARCHAR2);
608
609
610 /********** The following four procedures are changed to private. **********
611
612 --
613 -- Procedure
614 -- setpersonas
615 -- Purpose
616 -- Set the given manager_id as either tha manager or the approver
617 -- based upon the manager_target
618 -- History
619 -- 07/10/97 R Goyal Created
620 -- Arguments
621 -- manager_id manager_id
622 -- item_type Workflow item type (JE Batch)
623 -- itemkey ID of JE batch
624 -- manager_target value it should be set to i.e. either a MANAGER
625 -- or APPROVER.
626 -- Example
627 -- N/A (not user-callable)
628 --
629 PROCEDURE setpersonas( manager_id IN NUMBER,
630 item_type IN VARCHAR2,
631 item_key IN VARCHAR2,
632 manager_target IN VARCHAR2 );
633
634 --
635 -- Procedure
636 -- getfinalapprover
637 -- Purpose
638 -- Get the final approver for a given employee id
639 -- History
640 -- 07/10/97 R Goyal Created
641 -- Arguments
642 -- p_employee_id Employee ID
643 -- p_approval_amount Amount that needs to be approved
644 -- p_item_type Workflow Item Type
645 -- p_final_approver_id Approver's ID
646 -- Example
647 -- N/A (not user-callable)
648 --
649 PROCEDURE getfinalapprover( p_employee_id IN NUMBER,
650 p_set_of_books_id IN NUMBER,
651 -- p_approval_amount IN NUMBER,
652 -- p_item_type IN VARCHAR2,
653 p_final_approver_id OUT NOCOPY NUMBER );
654
655 --
656 -- Procedure
657 -- getapprover
658 -- Purpose
659 -- Get the approver for a given employee id based upon the
660 -- find_approver_method
661 -- History
662 -- 07/10/97 R Goyal Created
663 -- Arguments
664 -- employee_id Employee ID
665 -- approval_amount Approval Amount
666 -- item_type Workflow item type
667 -- curr_approver_id Current Approver ID
668 -- find_approver_method Find Approver Method
669 -- next_approver_id Next approver ID that the procedure computes.
670 --
671 PROCEDURE getapprover( employee_id IN NUMBER,
672 -- approval_amount IN NUMBER,
673 item_type IN VARCHAR2,
674 item_key IN VARCHAR2,
675 curr_approver_id IN NUMBER,
676 find_approver_method IN VARCHAR2,
677 next_approver_id IN OUT NOCOPY NUMBER );
678
679 --
680 -- Procedure
681 -- GetManager
682 -- Purpose
683 -- Gets the manager of the given employee id
684 -- History
685 -- 07/10/97 R Goyal Created
686 -- Arguments
687 -- employee_id employee_id whose manager is to be retrieved
688 -- manager_id manager_id of the given employee_id
689 -- Example
690 -- N/A (not user-callable)
691 --
692 --
693 PROCEDURE getmanager( employee_id IN NUMBER,
694 manager_id OUT NOCOPY NUMBER );
695
696 ***************************************************************************/
697
698
699 END GL_WF_JE_APPROVAL_PKG;