DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_CM_STAGE_END_PKG

Source


1 PACKAGE BODY hr_cm_stage_end_pkg AS
2 /* $Header: hrcmstge.pkb 115.3 2002/01/04 07:05:42 pkm ship       $ */
3 
4 FUNCTION gl_du_dp_stage_end
5 return varchar2 IS
6 
7   l_success    BOOLEAN;
8   l_warning    BOOLEAN;
9   l_batch_name varchar2(240);
10   l_req_id     number;
11   submit_exception exception;
12 begin
13 
14   --
15   -- Get information from the completed stage....
16   --
17   for stage_data in fnd_request_set.stage_request_info
18   loop
19     if stage_data.exit_status = 'E'
20     then
21       --
22       -- The Datauploader stage failed so return error...
23       --
24       return 'E';
25     elsif stage_data.exit_status = 'W'
26     then
27        --
28        -- Note the warning and continue. We will return warning if we get
29        -- no further errors...
30        --
31        l_warning := TRUE;
32     end if;
33     --
34     -- Now get the request_data information
35     --
36     l_batch_name := stage_data.request_data;
37   end loop;
38   --
39   -- We've got no errors so we'll continue ...
40   --
41   -- ... and reset the link_value column for all our batch lines...
42   --
43   UPDATE hrdpv_create_company_cost_cent
44      set link_value = batch_line_id
45    where batch_id = to_number(l_batch_name);
46 
47   -- ....and submit the request set to call datapump etc
48   --
49   -- Set the context for the request set.
50   --
51   l_success := fnd_submit.set_request_set(application => 'PER'
52                                          ,request_set => 'HRDPEXC'
53 	 				 );
54   if (l_success)
55   then
56     l_success := fnd_submit.submit_program(
57                            application => 'PER'
58 			  ,program     => 'DATAPUMP'
59 			  ,stage       => 'STAGE10'
60 			  ,argument1   => l_batch_name
61 			  ,argument2   => 'Yes');
62     if not l_success
63     then
64       raise submit_exception;
65     end if;
66     l_success := fnd_submit.submit_program(
67                            application => 'PER'
68 			  ,program     => 'PERPMPXC'
69 			  ,stage       => 'STAGE20'
70 			  ,argument1   => l_batch_name);
71     if not l_success
72     then
73       raise submit_exception;
74     end if;
75     l_req_id := fnd_submit.submit_set(
76                            start_time  => null
77 			  ,sub_request => TRUE
78 			  );
79   else
80     raise submit_exception;
81   end if;
82   return 'S';
83 
84 exception
85   when submit_exception then
86      return 'E';
87 end gl_du_dp_stage_end;
88 
89 end hr_cm_stage_end_pkg;