DBA Data[Home] [Help]

PACKAGE BODY: APPS.HRDPP_CREATE_COMPANY_COST_CENT

Source


1 package body hrdpp_CREATE_COMPANY_COST_CENT as
2 /*
3  * Generated by hr_pump_meta_mapper at: 2009/03/30 04:03:58
4  * Generated for API: HR_ORGANIZATION_API.CREATE_COMPANY_COST_CENTER
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_EFFECTIVE_DATE in date
83 ,P_COMPANY in varchar2 default null
84 ,P_COSTCENTER in varchar2 default null
85 ,P_ORGANIZATION_NAME in varchar2
86 ,P_LANGUAGE_CODE in varchar2
87 ,P_COMPANY_VALUESET_NAME in varchar2 default null
88 ,P_COSTCENTER_VALUESET_NAME in varchar2 default null) is
89 blid number := p_data_pump_batch_line_id;
90 begin
91 if blid is not null then
92 delete from hr_pump_batch_lines where batch_line_id = blid;
93 delete from hr_pump_batch_exceptions
94 where source_type = 'BATCH_LINE' and source_id = blid;
95 end if;
96 insert into hr_pump_batch_lines
97 (batch_id
98 ,batch_line_id
99 ,business_group_name
100 ,api_module_id
101 ,line_status
102 ,user_sequence
103 ,link_value
104 ,pval001
105 ,pval002
106 ,pval003
107 ,pval008
108 ,pval009
109 ,pval010
110 ,pval011)
111 values
112 (p_batch_id
113 ,nvl(blid,hr_pump_batch_lines_s.nextval)
114 ,p_data_pump_business_grp_name
115 ,2209
116 ,'U'
117 ,p_user_sequence
118 ,p_link_value
119 ,dc(P_EFFECTIVE_DATE)
120 ,P_COMPANY
121 ,P_COSTCENTER
122 ,P_ORGANIZATION_NAME
123 ,P_LANGUAGE_CODE
124 ,P_COMPANY_VALUESET_NAME
125 ,P_COSTCENTER_VALUESET_NAME);
126 end insert_batch_lines;
127 --
128 procedure call
129 (p_business_group_id in number,
130 p_batch_line_id     in number) is
131 cursor cr is
132 select l.rowid myrowid,
133 decode(l.pval001,cn,dn,d(l.pval001)) p1,
134 decode(l.pval002,cn,vn,vn,vn,l.pval002) p2,
135 l.pval002 d2,
136 decode(l.pval003,cn,vn,vn,vn,l.pval003) p3,
137 l.pval003 d3,
138 l.pval004 p4,
139 l.pval005 p5,
140 l.pval006 p6,
141 l.pval007 p7,
142 decode(l.pval008,cn,vn,l.pval008) p8,
143 decode(l.pval009,cn,vn,l.pval009) p9,
144 decode(l.pval010,cn,vn,vn,vn,l.pval010) p10,
145 l.pval010 d10,
146 decode(l.pval011,cn,vn,vn,vn,l.pval011) p11,
147 l.pval011 d11
148 from hr_pump_batch_lines l
149 where l.batch_line_id = p_batch_line_id;
150 --
151 c cr%rowtype;
152 l_validate boolean := false;
153 L_ORGANIZATION_ID number;
154 L_COMPANY_VALUESET_ID number;
155 L_COSTCENTER_VALUESET_ID number;
156 --
157 begin
158 hr_data_pump.entry('call');
159 open cr;
160 fetch cr into c;
161 if cr%notfound then
162 hr_utility.set_message(800,'HR_50326_DP_NO_ROW');
163 hr_utility.set_message_token('TABLE','HR_PUMP_BATCH_LINES');
164 hr_utility.set_message_token('COLUMN','P_BATCH_LINE_ID');
165 hr_utility.set_message_token('VALUE',p_batch_line_id);
166 hr_utility.raise_error;
167 end if;
168 --
169 if c.p8 is null or
170 c.p1 is null or
171 c.p9 is null then
172 L_ORGANIZATION_ID:=nn;
173 else
174 L_ORGANIZATION_ID := 
175 hr_pump_get.get_organization_id
176 (P_ORGANIZATION_NAME => c.p8
177 ,P_BUSINESS_GROUP_ID => P_BUSINESS_GROUP_ID
178 ,P_EFFECTIVE_DATE => c.p1
179 ,P_LANGUAGE_CODE => c.p9);
180 end if;
181 --
182 if c.p10 is null then
183 L_COMPANY_VALUESET_ID:=nn;
184 else
185 L_COMPANY_VALUESET_ID := 
186 PER_ORG_DATA_PUMP.GET_COMPANY_VALUESET_ID
187 (P_COMPANY_VALUESET_NAME => c.p10);
188 end if;
189 --
190 if c.p11 is null then
191 L_COSTCENTER_VALUESET_ID:=nn;
192 else
193 L_COSTCENTER_VALUESET_ID := 
194 PER_ORG_DATA_PUMP.GET_COSTCENTER_VALUESET_ID
195 (P_COSTCENTER_VALUESET_NAME => c.p11);
196 end if;
197 --
198 hr_data_pump.api_trc_on;
199 HR_ORGANIZATION_API.CREATE_COMPANY_COST_CENTER
200 (p_validate => l_validate
201 ,P_EFFECTIVE_DATE => c.p1
202 ,P_ORGANIZATION_ID => L_ORGANIZATION_ID
203 ,P_COMPANY_VALUESET_ID => L_COMPANY_VALUESET_ID
204 ,P_COMPANY => c.p2
205 ,P_COSTCENTER_VALUESET_ID => L_COSTCENTER_VALUESET_ID
206 ,P_COSTCENTER => c.p3
207 ,P_ORI_ORG_INFORMATION_ID => c.p4
208 ,P_ORI_OBJECT_VERSION_NUMBER => c.p5
209 ,P_ORG_INFORMATION_ID => c.p6
210 ,P_OBJECT_VERSION_NUMBER => c.p7);
211 hr_data_pump.api_trc_off;
212 
213 --
214 update hr_pump_batch_lines l set
215 l.pval004 = decode(c.p4,null,cn,c.p4),
216 l.pval005 = decode(c.p5,null,cn,c.p5),
217 l.pval006 = decode(c.p6,null,cn,c.p6),
218 l.pval007 = decode(c.p7,null,cn,c.p7)
219 where l.rowid = c.myrowid;
220 --
221 close cr;
222 --
223 hr_data_pump.exit('call');
224 exception
225  when hr_multi_message.error_message_exist then
226    if cr%isopen then
227     close cr;
228    end if;
229    hr_pump_utils.set_multi_msg_error_flag(true);
230  when others then
231  if cr%isopen then
232   close cr;
233  end if;
234  raise;
235 end call;
236 end hrdpp_CREATE_COMPANY_COST_CENT;