[Home] [Help]
PACKAGE BODY: APPS.FND_ADPATCH
Source
1 PACKAGE BODY fnd_adpatch AS
2 /* $Header: AFADPATB.pls 120.5 2006/07/26 21:59:40 mfisher noship $ */
3
4
5 FUNCTION Post_Patch(
6 Session_ID in Number, -- Autopatch Session ID
7 Message out nocopy Varchar2) -- "Executed Successfully" or error.
8 RETURN VARCHAR2 is -- "TRUE" or "FALSE"
9
10 appl_id number;
11 resp_id number;
12 user_id number;
13 user_name varchar2(80);
14 resp_name varchar2(80);
15 resp_key varchar2(50);
16 retcode number := null;
17 num_pend number;
18
19 BEGIN
20 -- if requests exist short circuit return
21 select count(*)
22 into num_pend
23 from fnd_application a,
24 fnd_concurrent_programs p,
25 fnd_concurrent_requests r
26 where a.application_short_name = 'FND'
27 and a.application_id = p.application_id
28 and p.concurrent_program_name = 'FNDIRLOAD'
29 and r.concurrent_program_id = p.concurrent_program_id
30 and a.application_id = r.program_application_id
31 and r.argument1 = to_char(Session_ID)
32 and r.phase_code = 'P'
33 and r.hold_flag='N'
34 and r.requested_start_date <= sysdate + 0.01;
35
36 if (num_pend > 0) then
37 Message := 'Executed successfully - Pending iRep requests exist.';
38 RETURN( 'TRUE' );
39 end if;
40
41 -- looks like a new request is needed, let's set context
42 select application_id, responsibility_id, responsibility_key
43 into appl_id, resp_id, resp_key
44 from fnd_responsibility
45 where responsibility_key = 'SYSTEM_ADMINISTRATOR';
46
47 select user_id, user_name
48 into user_id, user_name
49 from fnd_user
50 where user_name = 'SYSADMIN';
51
52 -- Now initialize the environment for SYSADMIN
53 fnd_global.apps_initialize(user_id, resp_id, appl_id);
54
55 retcode := fnd_request.submit_request(
56 application=>'FND',
57 program=>'FNDIRLOAD',
58 argument1 => Session_ID
59 );
60
61 if ((retcode is null) or (retcode <= 0)) then
62 Message := fnd_message.get;
63 RETURN ( 'FALSE' );
64 else
65 Message := 'Executed successfully - iRep Loader request = ' ||
66 to_char(retcode);
67 RETURN( 'TRUE' );
68 end if;
69
70 end;
71
72 end;