DBA Data[Home] [Help]

PACKAGE BODY: APPS.MSC_WS_PROCESS

Source


1 PACKAGE BODY MSC_WS_PROCESS AS
2 /* $Header: MSCWPROB.pls 120.4 2007/10/25 19:40:31 rolar noship $ */
3 
4 
5 
6   FUNCTION CHECK_PROC_STATUS( processId          IN         NUMBER) RETURN VARCHAR2 IS
7                               status  VARCHAR2(30);
8 
9     /*
10 
11 
12     function return values are:
13 
14     concurrent prog phase_status          function return value
15 
16      Running_<any status code>              RUNNING
17      Pending_<any status code>              PENDING
18      Inactive_no_manager                    INACTIVE_NO_MANAGER
19      Inactive_<any other status codes>      INACTIVE
20      Completed_Normal                       COMPLETED_NORMAL
21      Completed_Error                        COMPLETED_ERROR
22      Completed_Warning                      COMPLETED_WARNING
23      Completed_Terminated                   COMPLETED_TERMINATED
24      Completed_<any other status codes>     COMPLETED
25 
26 
27       Concurrent phase codes
28     I			       Inactive
29     P			       Pending
30     R			       Running
31     C			       Completed
32       Status Codes
33     A			       Waiting
34     B			       Resuming
35     C			       Normal
36     D			       Cancelled
37     E			       Error
38     G			       Warning
39     H			       On Hold
40     I				Normal
41     M			       No Manager
42     P			       Scheduled
43     Q			       Standby
44     R				 Normal
45     S			       Suspended
46     T			       Terminating
47     U			       Disabled
48     W			       Paused
49     X			       Terminated
50     Z				Waiting
51     */
52 
53 
54 l_phase varchar2(80);
55 l_status varchar2(80);
56 l_child_request_id number;
57 l_request_id number ;
58 temp_status VARCHAR2(20);
59 
60 cursor c_child_req (l_request_id number) is
61        select  request_id, phase_code, status_code
62        from fnd_concurrent_requests
63        connect by prior request_id = parent_request_id
64        start with request_id = processId;
65 
66 
67 begin
68   status := 'INVALID_PROCESS_ID';
69    open c_child_req(processId);
70    loop
71     fetch c_child_req into l_child_request_id , l_phase, l_status;
72 
73     exit when c_child_req%NOTFOUND;
74 
75 
76      if (l_phase = 'R' ) then
77             close c_child_req;
78             return 'RUNNING';
79        elsif (l_phase ='P')  then
80         close c_child_req;
81              return 'PENDING';
82        elsif (l_phase = 'I' ) then
83         close c_child_req;
84             return 'INACTIVE';
85        elsif (l_phase='C')   then
86               status := 'COMPLETED';
87              if (l_status ='E')  then
88               close c_child_req;
89                 return 'COMPLETED_ERROR';
90              elsif (l_status='X') then
91                return 'COMPLETED_TERMINATED';
92              elsif (l_status ='N') then
93                if ( temp_status = 'COMPLETED_WARNING') then
94                      status :='COMPLETED_WARNING';
95               else
96                      status :='COMPLETED_NORMAL';
97              end if;
98              elsif (l_status='G') then
99                status :='COMPLETED_WARNING';
100 
101              end if;
102        end if;
103   end loop;
104   close c_child_req;
105     return(status) ;
106 
107      EXCEPTION
108       WHEN others THEN
109       close c_child_req;
110          status := 'ERROR_UNEXPECTED_1000';
111          return(status);
112   END CHECK_PROC_STATUS;
113 
114 END MSC_WS_PROCESS;