DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_ACTUAL_TERMINATION_EMP_A

Source


1 package body hrdpp_actual_termination_emp_a as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2007/01/04 02:01:26
4  * Generated for API: hr_assignment_api.actual_termination_emp_asg
5  */
6 --
7 dh constant date := hr_api.g_date;
8 nh constant number := hr_api.g_number;
9 vh constant varchar2(64) := hr_api.g_varchar2;
10 c_sot constant date := to_date('01010001','DDMMYYYY');
11 cn constant varchar2(32) := '<NULL>';
12 dn constant date := null;
13 nn constant number := null;
14 vn constant varchar2(1) := null;
15 --
16 function dc(p in date) return varchar2 is
17 begin
18 if p<c_sot then
19  if p<>trunc(p) then
20   return to_char(p,'SYYYY/MM/DD HH24:MI:SS');
21  end if;
22  return to_char(p,'SYYYY/MM/DD');
23 elsif p<>trunc(p) then
24  return to_char(p,'YYYY/MM/DD HH24:MI:SS');
25 end if;
26 return to_char(p,'YYYY/MM/DD');
27 end dc;
28 function d(p in varchar2) return date is
29 begin
30 if length(p)=10 then
31 return to_date(p,'YYYY/MM/DD');
32 elsif length(p)=19 then
33 return to_date(p,'YYYY/MM/DD HH24:MI:SS');
34 elsif length(p)=11 then
35 return to_date(p,'SYYYY/MM/DD');
36 elsif length(p)=20 then
37 return to_date(p,'SYYYY/MM/DD HH24:MI:SS');
38 end if;
39 -- Try default format as last resort.
40 return to_date(p,'YYYY/MM/DD');
41 end d;
42 function n(p in varchar2) return number is
43 begin
44 return to_number(p);
45 end n;
46 function dd(p in date,i in varchar2)
47 return varchar2 is
48 begin
49 if upper(i) = 'N' then return dc(p);
50 else return cn; end if;
51 end dd;
52 function nd(p in number,i in varchar2)
53 return varchar2 is
54 begin
55 if upper(i) = 'N' then return to_char(p);
56 else return cn; end if;
57 end nd;
58 --
59 procedure iuk
60 (p_batch_line_id  in number,
61 p_user_key_value in varchar2,
62 p_unique_key_id  in number)
63 is
64 begin
65 hr_data_pump.entry('ins_user_key');
66 insert into hr_pump_batch_line_user_keys
67 (user_key_id, batch_line_id,user_key_value,unique_key_id)
68 values
69 (hr_pump_batch_line_user_keys_s.nextval,
70 p_batch_line_id,
71 p_user_key_value,
72 p_unique_key_id);
73 hr_data_pump.exit('ins_user_key');
74 end iuk;
75 --
76 procedure insert_batch_lines
77 (p_batch_id      in number
78 ,p_data_pump_batch_line_id in number default null
79 ,p_data_pump_business_grp_name in varchar2 default null
80 ,p_user_sequence in number default null
81 ,p_link_value    in number default null
82 ,P_ACTUAL_TERMINATION_DATE in date
83 ,P_ASSIGNMENT_USER_KEY in varchar2
84 ,P_USER_STATUS in varchar2 default null
85 ,P_LANGUAGE_CODE in varchar2 default null) is
86 blid number := p_data_pump_batch_line_id;
87 begin
88 if blid is not null then
89 delete from hr_pump_batch_lines where batch_line_id = blid;
90 delete from hr_pump_batch_exceptions
91 where source_type = 'BATCH_LINE' and source_id = blid;
92 end if;
93 insert into hr_pump_batch_lines
94 (batch_id
95 ,batch_line_id
96 ,business_group_name
97 ,api_module_id
98 ,line_status
99 ,user_sequence
100 ,link_value
101 ,pval001
102 ,pval007
103 ,pval008
104 ,pval009)
105 values
106 (p_batch_id
107 ,nvl(blid,hr_pump_batch_lines_s.nextval)
108 ,p_data_pump_business_grp_name
109 ,1187
110 ,'U'
111 ,p_user_sequence
112 ,p_link_value
113 ,dc(P_ACTUAL_TERMINATION_DATE)
114 ,P_ASSIGNMENT_USER_KEY
115 ,P_USER_STATUS
116 ,P_LANGUAGE_CODE);
117 end insert_batch_lines;
118 --
119 procedure call
120 (p_business_group_id in number,
121 p_batch_line_id     in number) is
122 cursor cr is
123 select l.rowid myrowid,
124 decode(l.pval001,cn,dn,d(l.pval001)) p1,
125 decode(l.pval002,cn,dn,d(l.pval002)) p2,
126 decode(l.pval003,cn,dn,d(l.pval003)) p3,
127 l.pval004 p4,
128 l.pval005 p5,
129 l.pval006 p6,
130 decode(l.pval007,cn,vn,l.pval007) p7,
131 decode(l.pval008,cn,vn,vn,vh,l.pval008) p8,
132 l.pval008 d8,
133 decode(l.pval009,cn,vn,vn,vh,l.pval009) p9,
134 l.pval009 d9
135 from hr_pump_batch_lines l
136 where l.batch_line_id = p_batch_line_id;
137 --
138 c cr%rowtype;
139 l_validate boolean := false;
140 L_ASG_FUTURE_CHANGES_WARNING boolean;
141 L_PAY_PROPOSAL_WARNING boolean;
142 L_ASSIGNMENT_ID number;
143 L_OBJECT_VERSION_NUMBER number;
144 L_ASSIGNMENT_STATUS_TYPE_ID number;
145 --
146 begin
147 hr_data_pump.entry('call');
148 open cr;
149 fetch cr into c;
150 if cr%notfound then
151 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
152 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
153 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
154 hr_utility.set_message_token('VALUE',p_batch_line_id);
155 hr_utility.raise_error;
156 end if;
157 --
158 if c.p7 is null then
159 L_ASSIGNMENT_ID:=nn;
160 else
161 L_ASSIGNMENT_ID := 
162 hr_pump_get.get_assignment_id
163 (P_ASSIGNMENT_USER_KEY => c.p7);
164 end if;
165 --
166 if c.p7 is null or
167 c.p1 is null then
168 L_OBJECT_VERSION_NUMBER:=nn;
169 else
170 L_OBJECT_VERSION_NUMBER := 
171 hr_pump_get.GET_ASG_OVN
172 (P_ASSIGNMENT_USER_KEY => c.p7
173 ,P_EFFECTIVE_DATE => c.p1);
174 end if;
175 --
176 if c.d8=cn or
177 c.d9=cn then
178 L_ASSIGNMENT_STATUS_TYPE_ID:=nn;
179 elsif c.d8 is null or
180 c.d9 is null then 
181 L_ASSIGNMENT_STATUS_TYPE_ID:=nh;
182 else
183 L_ASSIGNMENT_STATUS_TYPE_ID := 
184 hr_pump_get.get_assignment_status_type_id
185 (P_USER_STATUS => c.p8
186 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID
187 ,P_LANGUAGE_CODE => c.p9);
188 end if;
189 --
190 hr_data_pump.api_trc_on;
191 hr_assignment_api.actual_termination_emp_asg
192 (p_validate => l_validate
193 ,P_ASSIGNMENT_ID => L_ASSIGNMENT_ID
194 ,P_OBJECT_VERSION_NUMBER => L_OBJECT_VERSION_NUMBER
195 ,P_ACTUAL_TERMINATION_DATE => c.p1
196 ,P_ASSIGNMENT_STATUS_TYPE_ID => L_ASSIGNMENT_STATUS_TYPE_ID
197 ,P_EFFECTIVE_START_DATE => c.p2
198 ,P_EFFECTIVE_END_DATE => c.p3
199 ,P_ASG_FUTURE_CHANGES_WARNING => L_ASG_FUTURE_CHANGES_WARNING
200 ,P_ENTRIES_CHANGED_WARNING => c.p5
201 ,P_PAY_PROPOSAL_WARNING => L_PAY_PROPOSAL_WARNING);
202 hr_data_pump.api_trc_off;
203 --
204 if L_ASG_FUTURE_CHANGES_WARNING then
205 c.p4 := 'TRUE';
206 else
207 c.p4 := 'FALSE';
208 end if;
209 --
210 if L_PAY_PROPOSAL_WARNING then
211 c.p6 := 'TRUE';
212 else
213 c.p6 := 'FALSE';
214 end if;
215 --
216 update hr_pump_batch_lines l set
217 l.pval002 = decode(c.p2,null,cn,dc(c.p2)),
218 l.pval003 = decode(c.p3,null,cn,dc(c.p3)),
219 l.pval004 = decode(c.p4,null,cn,c.p4),
220 l.pval005 = decode(c.p5,null,cn,c.p5),
221 l.pval006 = decode(c.p6,null,cn,c.p6)
222 where l.rowid = c.myrowid;
223 --
224 close cr;
225 --
226 hr_data_pump.exit('call');
227 exception
228  when hr_multi_message.error_message_exist then
229    if cr%isopen then
230     close cr;
231    end if;
232    hr_pump_utils.set_multi_msg_error_flag(true);
233  when others then
234  if cr%isopen then
235   close cr;
236  end if;
237  raise;
238 end call;
239 end hrdpp_actual_termination_emp_a;