DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_RIW_COURSE_WRAPPER

Source


1 PACKAGE BODY pqp_riw_course_wrapper  as
2 /* $Header: pqpriwcowr.pkb 120.0.12010000.5 2009/04/24 08:38:00 psengupt noship $ */
3 
4 -- =============================================================================
5 -- ~ Package Body Global variables:
6 -- =============================================================================
7 g_package  varchar2(33) := 'pqp_riw_course_wrapper.';
8 g_course_rec                     OTA_ACTIVITY_VERSIONS_VL%rowtype;
9 g_interface_code              varchar2(150);
10 --
11 
12 -- =============================================================================
13 -- Default_Record_Values:
14 -- =============================================================================
15 function Default_Course_Rec
16          return OTA_ACTIVITY_VERSIONS_VL%rowtype is
17   l_proc_name    constant varchar2(150) := g_package||'Default_Course_Rec';
18   l_course_rec     OTA_ACTIVITY_VERSIONS_VL%rowtype;
19 begin
20 
21   Hr_Utility.set_location(' Entering: '||l_proc_name, 5);
22   /*
23    ==========================================================================
24    g_varchar2  constant varchar2(9) := '$Sys_Def$';
25    g_number  constant number        := -987123654;
26    g_date  constant date            := to_date('01-01-4712', 'DD-MM-SYYYY');
27    ==========================================================================
28   */
29   Hr_Utility.set_location(' Before : ', 5);
30   l_course_rec.activity_id                   :=  hr_api.g_number;
31   l_course_rec.superseded_by_act_version_id  :=  hr_api.g_number;
32   l_course_rec.developer_organization_id     :=  hr_api.g_number;
33   l_course_rec.controlling_person_id         :=  hr_api.g_number;
34 
35   l_course_rec.version_name                  :=  hr_api.g_varchar2;
36   Hr_Utility.set_location(' l_course_rec.version_name: '||l_course_rec.version_name, 5);
37   l_course_rec.comments                      :=  hr_api.g_varchar2;
38   Hr_Utility.set_location(' l_course_rec.comments: '||l_course_rec.comments, 5);
39   l_course_rec.description                   :=  hr_api.g_varchar2;
40   Hr_Utility.set_location(' l_course_rec.description: '||l_course_rec.description, 5);
41   l_course_rec.duration_units                :=  hr_api.g_varchar2;
42   Hr_Utility.set_location(' l_course_rec.duration_units: '||l_course_rec.expenses_allowed, 5);
43 --  l_course_rec.duration                      :=  hr_api.g_number;
44   Hr_Utility.set_location(' l_course_rec.duration: '||l_course_rec.duration, 5);
45   l_course_rec.end_date                      :=  hr_api.g_date;
46   l_course_rec.intended_audience             :=  hr_api.g_varchar2;
47   l_course_rec.language_id                   :=  hr_api.g_number;
48   l_course_rec.maximum_attendees             :=  hr_api.g_number;
49   l_course_rec.minimum_attendees             :=  hr_api.g_number;
50   l_course_rec.objectives                    :=  hr_api.g_varchar2;
51   Hr_Utility.set_location(' l_course_rec.objectives: '||l_course_rec.expenses_allowed, 5);
52   l_course_rec.start_date                    :=  hr_api.g_date;
53   l_course_rec.success_criteria              :=  hr_api.g_varchar2;
54   l_course_rec.user_status                   :=  hr_api.g_varchar2;
55   l_course_rec.vendor_id                     :=  hr_api.g_number;
56   l_course_rec.actual_cost                   :=  hr_api.g_number;
57   l_course_rec.budget_cost                   :=  hr_api.g_number;
58   l_course_rec.budget_currency_code          :=  hr_api.g_varchar2;
59   l_course_rec.expenses_allowed              :=  hr_api.g_varchar2;
60 
61   l_course_rec.professional_credit_type      :=  hr_api.g_varchar2;
62   l_course_rec.professional_credits          :=  hr_api.g_number;
63   l_course_rec.maximum_internal_attendees    :=  hr_api.g_number;
64   l_course_rec.tav_information_category      :=  hr_api.g_varchar2;
65   l_course_rec.tav_information1              :=  hr_api.g_varchar2;
66   l_course_rec.tav_information2              :=  hr_api.g_varchar2;
67   l_course_rec.tav_information3              :=  hr_api.g_varchar2;
68   l_course_rec.tav_information4              :=  hr_api.g_varchar2;
69   l_course_rec.tav_information5              :=  hr_api.g_varchar2;
70   l_course_rec.tav_information6              :=  hr_api.g_varchar2;
71   l_course_rec.tav_information7              :=  hr_api.g_varchar2;
72   l_course_rec.tav_information8              :=  hr_api.g_varchar2;
73   l_course_rec.tav_information9              :=  hr_api.g_varchar2;
74   l_course_rec.tav_information10             :=  hr_api.g_varchar2;
75   l_course_rec.tav_information11             :=  hr_api.g_varchar2;
76   l_course_rec.tav_information12             :=  hr_api.g_varchar2;
77   l_course_rec.tav_information13             :=  hr_api.g_varchar2;
78   l_course_rec.tav_information14             :=  hr_api.g_varchar2;
79   l_course_rec.tav_information15             :=  hr_api.g_varchar2;
80   l_course_rec.tav_information16             :=  hr_api.g_varchar2;
81   l_course_rec.tav_information17             :=  hr_api.g_varchar2;
82   l_course_rec.tav_information18             :=  hr_api.g_varchar2;
83   l_course_rec.tav_information19             :=  hr_api.g_varchar2;
84   l_course_rec.tav_information20             :=  hr_api.g_varchar2;
85   l_course_rec.inventory_item_id 	       :=  hr_api.g_number;
86   l_course_rec.organization_id	       :=  hr_api.g_number;
87   l_course_rec.rco_id			       :=  hr_api.g_number;
88   l_course_rec.version_code                  :=  hr_api.g_varchar2;
89   l_course_rec.keywords                      :=  hr_api.g_varchar2;
90   l_course_rec.business_group_id	       :=  hr_api.g_number;
91   l_course_rec.data_source                   :=  hr_api.g_varchar2;
92   l_course_rec.competency_update_level       :=  hr_api.g_varchar2;
93 
94   Hr_Utility.set_location('Leaving: '||l_proc_name, 80);
95   return l_course_rec;
96 exception
97   when others then
98   Hr_Utility.set_location('Leaving: '||l_proc_name, 90);
99   raise;
100 
101 end Default_Course_Rec;
102 
103 
104 -- =============================================================================
105 -- Get_Record_Values:
106 -- =============================================================================
107 function Get_Record_Values
108         (p_interface_code in varchar2 default null)
109          return OTA_ACTIVITY_VERSIONS_VL%rowtype is
110 
111   cursor bne_cols(c_interface_code in varchar2) is
112   select lower(bic.interface_col_name) interface_col_name
113     from bne_interface_cols_b  bic
114    where bic.interface_code = c_interface_code
115      and bic.display_flag ='Y';
116   --and bic.interface_col_type <> 2;
117 
118   -- To query cols which are not displayed (DFF segments)
119    cursor bne_cols_no_disp(c_interface_code in varchar2) is
120   select lower(bic.interface_col_name) interface_col_name
121     from bne_interface_cols_b  bic
122    where bic.interface_code = c_interface_code
123      and bic.display_flag ='N';
124 
125   l_course_rec            OTA_ACTIVITY_VERSIONS_VL%rowtype;
126   col_name             varchar2(150);
127   l_proc_name constant varchar2(150) := g_package||'Get_Record_Values';
128 begin
129 
130   Hr_Utility.set_location(' Entering: '||l_proc_name, 5);
131  hr_utility.set_location('p_interface_code'||p_interface_code, 10);
132   l_course_rec := Default_Course_Rec;
133  hr_utility.set_location('p_interface_code'||p_interface_code, 20);
134  hr_utility.set_location('g_interface_code'||g_interface_code, 5);
135 
136 
137   for col_rec in bne_cols (g_interface_code)
138   loop
139  hr_utility.set_location(' in loop col_rec.interface_col_name'||col_rec.interface_col_name, 15);
140    case col_rec.interface_col_name
141 
142     when 'p_activity_id' then
143           l_course_rec.activity_id := g_course_rec.activity_id;
144     when 'p_superseded_by_act_version_id' then
145           l_course_rec.superseded_by_act_version_id := g_course_rec.superseded_by_act_version_id;
146     when 'p_developer_organization_id' then
147           l_course_rec.developer_organization_id := g_course_rec.developer_organization_id;
148     when 'p_controlling_person_id' then
149           l_course_rec.controlling_person_id := g_course_rec.controlling_person_id;
150     when 'p_version_name' then
151           l_course_rec.version_name := g_course_rec.version_name;
152     when 'p_comments' then
153           l_course_rec.comments := g_course_rec.comments;
154     when 'p_description' then
155           l_course_rec.description := g_course_rec.description;
156     when 'p_duration' then
157           l_course_rec.duration := g_course_rec.duration;
158     when 'p_duration_units' then
159           l_course_rec.duration_units := g_course_rec.duration_units;
160     when 'p_end_date' then
161           l_course_rec.end_date := g_course_rec.end_date;
162     when 'p_intended_audience' then
163           l_course_rec.intended_audience := g_course_rec.intended_audience;
164     when 'p_language_id' then
165           l_course_rec.language_id := g_course_rec.language_id;
166     when 'p_maximum_attendees' then
167           l_course_rec.maximum_attendees := g_course_rec.maximum_attendees;
168     when 'p_minimum_attendees' then
169           l_course_rec.minimum_attendees := g_course_rec.minimum_attendees;
170     when 'p_objectives' then
171           l_course_rec.objectives := g_course_rec.objectives;
172     when 'p_start_date' then
173           l_course_rec.start_date := g_course_rec.start_date;
174     when 'p_success_criteria' then
175           l_course_rec.success_criteria := g_course_rec.success_criteria;
176     when 'p_user_status' then
177           l_course_rec.user_status := g_course_rec.user_status;
178     when 'p_vendor_id' then
179           l_course_rec.vendor_id := g_course_rec.vendor_id;
180     when 'p_actual_cost' then
181           l_course_rec.actual_cost := g_course_rec.actual_cost;
182     when 'p_budget_cost' then
183           l_course_rec.budget_cost := g_course_rec.budget_cost;
184     when 'p_budget_currency_code' then
185           l_course_rec.budget_currency_code := g_course_rec.budget_currency_code;
186     when 'p_expenses_allowed' then
187           l_course_rec.expenses_allowed := g_course_rec.expenses_allowed;
188     when 'p_professional_credit_type' then
189           l_course_rec.professional_credit_type := g_course_rec.professional_credit_type;
190     when 'p_professional_credits' then
191           l_course_rec.professional_credits := g_course_rec.professional_credits;
192     when 'p_maximum_internal_attendees' then
193           l_course_rec.maximum_internal_attendees := g_course_rec.maximum_internal_attendees;
194     when 'p_inventory_item_id' then
195           l_course_rec.inventory_item_id := g_course_rec.inventory_item_id;
196     when 'p_organization_id' then
197           l_course_rec.organization_id := g_course_rec.organization_id;
198     when 'p_rco_id' then
199           l_course_rec.rco_id := g_course_rec.rco_id;
200     when 'p_version_code' then
201           l_course_rec.version_code := g_course_rec.version_code;
202     when 'p_keywords' then
203           l_course_rec.keywords := g_course_rec.keywords;
204     when 'p_business_group_id' then
205           l_course_rec.business_group_id := g_course_rec.business_group_id;
206     when 'p_data_source' then
207           l_course_rec.data_source := g_course_rec.data_source;
208     when 'p_competency_update_level' then
209           l_course_rec.competency_update_level := g_course_rec.competency_update_level;
210 
211     -- DFF
212     when 'p_tav_information_category' then
213           l_course_rec.tav_information_category := g_course_rec.tav_information_category;
214           if l_course_rec.tav_information_category is not null then
215           for col_rec1 in bne_cols_no_disp(g_interface_code) loop
216 
217              case col_rec1.interface_col_name
218              when 'p_tav_information1' then
219                    l_course_rec.tav_information1 := g_course_rec.tav_information1;
220              when 'p_tav_information2' then
221                    l_course_rec.tav_information2 := g_course_rec.tav_information2;
222              when 'p_tav_information3' then
223                    l_course_rec.tav_information3 := g_course_rec.tav_information3;
224              when 'p_tav_information4' then
225                    l_course_rec.tav_information4 := g_course_rec.tav_information4;
226              when 'p_tav_information5' then
227                    l_course_rec.tav_information5 := g_course_rec.tav_information5;
228              when 'p_tav_information6' then
229                    l_course_rec.tav_information6 := g_course_rec.tav_information6;
230              when 'p_tav_information7' then
231                    l_course_rec.tav_information7 := g_course_rec.tav_information7;
232              when 'p_tav_information8' then
233                    l_course_rec.tav_information8 := g_course_rec.tav_information8;
234              when 'p_tav_information9' then
235                    l_course_rec.tav_information9 := g_course_rec.tav_information9;
236              when 'p_tav_information10' then
237                    l_course_rec.tav_information10 := g_course_rec.tav_information10;
238              when 'p_tav_information11' then
239                    l_course_rec.tav_information11 := g_course_rec.tav_information11;
240              when 'p_tav_information12' then
241                    l_course_rec.tav_information12 := g_course_rec.tav_information12;
242              when 'p_tav_information13' then
243                    l_course_rec.tav_information13 := g_course_rec.tav_information13;
244              when 'p_tav_information14' then
245                    l_course_rec.tav_information14 := g_course_rec.tav_information14;
246              when 'p_tav_information15' then
247                    l_course_rec.tav_information15 := g_course_rec.tav_information15;
248              when 'p_tav_information16' then
249                    l_course_rec.tav_information16 := g_course_rec.tav_information16;
250              when 'p_tav_information17' then
251                    l_course_rec.tav_information17 := g_course_rec.tav_information17;
252              when 'p_tav_information18' then
253                    l_course_rec.tav_information18 := g_course_rec.tav_information18;
254              when 'p_tav_information19' then
255                    l_course_rec.tav_information19 := g_course_rec.tav_information19;
256              when 'p_tav_information20' then
257                    l_course_rec.tav_information20 := g_course_rec.tav_information20;
258              else
259                   null;
260              end case;
261             end loop;
262            end if;
263    else
264       null;
265    end case;
266   end loop;
267   Hr_Utility.set_location(' Leaving: '||l_proc_name, 80);
268   return l_course_rec;
269 
270 end Get_Record_Values;
271 -- ----------------------------------------------------------------------------
272 -- |------------------------< InsUpd_Course >-----------------------|
273 -- ----------------------------------------------------------------------------
274 PROCEDURE InsUpd_Course
275   (p_effective_date               in     date
279   ,p_developer_organization_id    in     number
276   ,p_validate                     in     number    default hr_api.g_false_num
277   ,p_activity_id                  in     number
278   ,p_superseded_by_act_version_id in     number    default null
280   ,p_controlling_person_id        in     number    default null
281   ,p_version_name                 in     varchar2
282   ,p_comments                     in     varchar2  default null
283   ,p_description                  in     varchar2  default null
284   ,p_duration                     in     number    default null
285   ,p_duration_units               in     varchar2  default null
286   ,p_end_date                     in     date      default null
287   ,p_intended_audience            in     varchar2  default null
288   ,p_language_id                  in     number    default null
289   ,p_maximum_attendees            in     number    default null
290   ,p_minimum_attendees            in     number    default null
291   ,p_objectives                   in     varchar2  default null
292   ,p_start_date                   in     date      default null
293   ,p_success_criteria             in     varchar2  default null
294   ,p_user_status                  in     varchar2  default null
295   ,p_vendor_id                    in     number    default null
296   ,p_actual_cost                  in     number    default null
297   ,p_budget_cost                  in     number    default null
298   ,p_budget_currency_code         in     varchar2  default null
299   ,p_expenses_allowed             in     varchar2  default null
300   ,p_professional_credit_type     in     varchar2  default null
301   ,p_professional_credits         in     number    default null
302   ,p_maximum_internal_attendees   in     number    default null
303   ,p_tav_information_category     in     varchar2  default null
304   ,p_tav_information1             in     varchar2  default null
305   ,p_tav_information2             in     varchar2  default null
306   ,p_tav_information3             in     varchar2  default null
307   ,p_tav_information4             in     varchar2  default null
308   ,p_tav_information5             in     varchar2  default null
309   ,p_tav_information6             in     varchar2  default null
310   ,p_tav_information7             in     varchar2  default null
311   ,p_tav_information8             in     varchar2  default null
312   ,p_tav_information9             in     varchar2  default null
313   ,p_tav_information10            in     varchar2  default null
314   ,p_tav_information11            in     varchar2  default null
315   ,p_tav_information12            in     varchar2  default null
316   ,p_tav_information13            in     varchar2  default null
317   ,p_tav_information14            in     varchar2  default null
318   ,p_tav_information15            in     varchar2  default null
319   ,p_tav_information16            in     varchar2  default null
320   ,p_tav_information17            in     varchar2  default null
321   ,p_tav_information18            in     varchar2  default null
322   ,p_tav_information19            in     varchar2  default null
323   ,p_tav_information20            in     varchar2  default null
324   ,p_inventory_item_id            in     number    default null
325   ,p_organization_id              in     number    default null
326   ,p_rco_id                       in     number    default null
327   ,p_version_code                 in     varchar2  default null
328   ,p_keywords                     in     varchar2  default null
329   ,p_business_group_id            in     number    default null
330   ,p_activity_version_id          in     number    default null
331   ,p_object_version_number        in     number    default null
332   ,p_return_status                   out nocopy varchar2
333   ,p_data_source                  in     varchar2  default null
334   ,p_competency_update_level      in     varchar2  default null
335   ,P_CRT_UPD			  in 	 varchar2   default null
336   ) is
337   -- =============================================================================
338   -- Variables for API Boolean parameters
339   -- =============================================================================
340 
341   l_validate                      boolean;
342 
343   -- =============================================================================
344   -- Other variables
345   -- =============================================================================
346 
347   l_activity_version_id          number;
348   l_activity_category		 varchar2(72);
349   l_primary_flag		 varchar2(72):='Y';
350   l_aci_information_category     varchar2(72);
351   l_category_usage_id		 number(9,0);
352   p_aci_information1             varchar2(72);
353   p_aci_information2             varchar2(72);
354   p_aci_information3             varchar2(72);
355   p_aci_information4             varchar2(72);
356   p_aci_information5             varchar2(72);
357   p_aci_information6             varchar2(72);
358   p_aci_information7             varchar2(72);
359   p_aci_information8             varchar2(72);
360   p_aci_information9             varchar2(72);
361   p_aci_information10            varchar2(72);
362   p_aci_information11            varchar2(72);
363   p_aci_information12            varchar2(72);
364   p_aci_information13            varchar2(72);
365   p_aci_information14            varchar2(72);
366   p_aci_information15            varchar2(72);
367   p_aci_information16            varchar2(72);
368   p_aci_information17            varchar2(72);
369   p_aci_information18            varchar2(72);
370   p_aci_information19            varchar2(72);
371   p_aci_information20            varchar2(72);
372   l_error_msg                    varchar2(4000);
373   l_course_rec     OTA_ACTIVITY_VERSIONS_VL%rowtype;
374   l_interface_code      varchar2(40);
375   l_crt_upd             varchar2(1);
376 -- =============================================================================
380 Cursor C_Sel_one is
377 -- ~ Package Body Cursor variables:
378 -- =============================================================================
379 
381     Select ota_activity_definitions.CATEGORY_USAGE_ID
382       from ota_activity_definitions
383      where activity_id = p_activity_id;
384 
385 -- =============================================================================
386 -- Default_Record_Values:
387 -- =============================================================================
388   l_proc    varchar2(72) := g_package ||'InsUpd_Course';
389 
390   l_create_flag    number(2) := 1;
391   e_upl_not_allowed exception; -- when mode is 'View Only'
392   e_crt_not_allowed exception; -- when mode is 'Update Only'
393   g_upl_err_msg varchar2(100) := 'Upload NOT allowed.';
394   g_crt_err_msg varchar2(100) := 'Creating NOT allowed.';
395   l_act_ver_id      number(9,0);
396   l_obj_ver_num       number(2);
397   l_object_version_number  number(2);
398   l_crt_upd_len         number;
399 
400 
401 Begin
402 --hr_utility.trace_on(null, 'Course_Trace');
403 hr_utility.set_location(' Entering:' || l_proc,10);
404   --
405   -- Issue a savepoint
406   --
407   savepoint pqp_riw_course_wrapper;
408   --
409   -- Convert constant values to their corresponding boolean value
410   --
411   l_validate :=
412     hr_api.constant_to_boolean
413       (p_constant_value => p_validate);
414   --
415   -- Register Surrogate ID or user key values
416   --
417   ota_tav_ins.set_base_key_value
418     (p_activity_version_id => p_activity_version_id
419     );
420   --
421   -- Call API
422   --
423   l_activity_version_id := p_activity_version_id;
424   hr_utility.set_location('The version id is : '||l_activity_version_id, 89);
425   if l_activity_version_id is not null then
426        l_create_flag := 2;  --update course
427   else
428        l_create_flag := 1;  --create course
429   end if;
430 
431  l_crt_upd_len := LENGTH(p_crt_upd);
432  l_crt_upd := SUBSTR(p_crt_upd, 1, 1);
433  IF l_crt_upd_len > 1 THEN
434      l_interface_code := SUBSTR(p_crt_upd, 3);
435  ELSE
436      l_interface_code := null;
437  END IF;
438 
439  if (l_crt_upd = 'D') then
440    raise e_upl_not_allowed;  -- View only flag is enabled but Trying to Upload
441   end if;
442   if (l_crt_upd = 'U' and l_create_flag = 1) then
443    raise e_crt_not_allowed;  -- Update only flag is enabled but Trying to Create
444  end if;
445 
446  if(l_create_flag = 1) then
447   ota_activity_version_api.create_activity_version
448     (p_effective_date               => p_effective_date
449     ,p_validate                     => l_validate
450     ,p_activity_id                  => p_activity_id
451     ,p_superseded_by_act_version_id => p_superseded_by_act_version_id
452     ,p_developer_organization_id    => p_developer_organization_id
453     ,p_controlling_person_id        => p_controlling_person_id
454     ,p_version_name                 => p_version_name
455     ,p_comments                     => p_comments
456     ,p_description                  => p_description
457     ,p_duration                     => p_duration
458     ,p_duration_units               => p_duration_units
459     ,p_end_date                     => p_end_date
460     ,p_intended_audience            => p_intended_audience
461     ,p_language_id                  => p_language_id
462     ,p_maximum_attendees            => p_maximum_attendees
463     ,p_minimum_attendees            => p_minimum_attendees
464     ,p_objectives                   => p_objectives
465     ,p_start_date                   => p_start_date
466     ,p_success_criteria             => p_success_criteria
467     ,p_user_status                  => p_user_status
468     ,p_vendor_id                    => p_vendor_id
469     ,p_actual_cost                  => p_actual_cost
470     ,p_budget_cost                  => p_budget_cost
471     ,p_budget_currency_code         => p_budget_currency_code
472     ,p_expenses_allowed             => p_expenses_allowed
473     ,p_professional_credit_type     => p_professional_credit_type
474     ,p_professional_credits         => p_professional_credits
475     ,p_maximum_internal_attendees   => p_maximum_internal_attendees
476     ,p_tav_information_category     => p_tav_information_category
477     ,p_tav_information1             => p_tav_information1
478     ,p_tav_information2             => p_tav_information2
479     ,p_tav_information3             => p_tav_information3
480     ,p_tav_information4             => p_tav_information4
481     ,p_tav_information5             => p_tav_information5
482     ,p_tav_information6             => p_tav_information6
483     ,p_tav_information7             => p_tav_information7
484     ,p_tav_information8             => p_tav_information8
485     ,p_tav_information9             => p_tav_information9
486     ,p_tav_information10            => p_tav_information10
487     ,p_tav_information11            => p_tav_information11
488     ,p_tav_information12            => p_tav_information12
489     ,p_tav_information13            => p_tav_information13
490     ,p_tav_information14            => p_tav_information14
491     ,p_tav_information15            => p_tav_information15
492     ,p_tav_information16            => p_tav_information16
493     ,p_tav_information17            => p_tav_information17
494     ,p_tav_information18            => p_tav_information18
495     ,p_tav_information19            => p_tav_information19
496     ,p_tav_information20            => p_tav_information20
497     ,p_inventory_item_id            => p_inventory_item_id
498     ,p_organization_id              => p_organization_id
499     ,p_rco_id                       => p_rco_id
500     ,p_version_code                 => p_version_code
504     ,p_object_version_number        => l_obj_ver_num
501     ,p_keywords                     => p_keywords
502     ,p_business_group_id            => p_business_group_id
503     ,p_activity_version_id          => l_act_ver_id
505     ,p_data_source                  => p_data_source
506     ,p_competency_update_level      => p_competency_update_level
507     );
508 
509     hr_utility.set_location('The code has created success', 90);
510     Open C_Sel_one;
511     Fetch C_Sel_one into l_category_usage_id;
512     Close C_Sel_one;
513     hr_utility.set_location('After that success as well', 90);
514 
515 
516 
517 ota_activity_category_api.create_act_cat_inclusion
518     (p_validate                     => l_validate
519     ,p_effective_date               => p_effective_date
520     ,p_activity_version_id          => l_act_ver_id
521     ,p_activity_category            => l_activity_category
522     ,p_comments                     => p_comments
523     ,p_object_version_number        => l_obj_ver_num
524     ,p_aci_information_category     => l_aci_information_category
525     ,p_aci_information1             => p_aci_information1
526     ,p_aci_information2             => p_aci_information2
527     ,p_aci_information3             => p_aci_information3
528     ,p_aci_information4             => p_aci_information4
529     ,p_aci_information5             => p_aci_information5
530     ,p_aci_information6             => p_aci_information6
531     ,p_aci_information7             => p_aci_information7
532     ,p_aci_information8             => p_aci_information8
533     ,p_aci_information9             => p_aci_information9
534     ,p_aci_information10            => p_aci_information10
535     ,p_aci_information11            => p_aci_information11
536     ,p_aci_information12            => p_aci_information12
537     ,p_aci_information13            => p_aci_information13
538     ,p_aci_information14            => p_aci_information14
539     ,p_aci_information15            => p_aci_information15
540     ,p_aci_information16            => p_aci_information16
541     ,p_aci_information17            => p_aci_information17
542     ,p_aci_information18            => p_aci_information18
543     ,p_aci_information19            => p_aci_information19
544     ,p_aci_information20            => p_aci_information20
545     ,p_start_date_active            => null
546     ,p_end_date_active              => null
547     ,p_primary_flag                 => l_primary_flag
548     ,p_category_usage_id            => l_category_usage_id
549     );
550  end if;
551 
552  if l_create_flag = 2 then
553  hr_utility.set_location('Inside the update', 90);
554  g_interface_code := nvl(l_interface_code,'PQP_OLM_COURSE_INTF');
555 
556  g_course_rec.activity_id										:= p_activity_id;
557  g_course_rec.superseded_by_act_version_id	:= p_superseded_by_act_version_id;
558  g_course_rec.developer_organization_id			:= p_developer_organization_id;
559  g_course_rec.controlling_person_id					:= p_controlling_person_id    ;
560  g_course_rec.version_name									:= p_version_name             ;
561  g_course_rec.comments											:= p_comments                 ;
562  g_course_rec.description										:= p_description              ;
563  g_course_rec.duration											:= p_duration                 ;
564  g_course_rec.duration_units								:= p_duration_units           ;
565  g_course_rec.end_date											:= p_end_date                 ;
566  g_course_rec.intended_audience							:= p_intended_audience        ;
567  g_course_rec.language_id										:= p_language_id              ;
568  g_course_rec.maximum_attendees							:= p_maximum_attendees        ;
569  g_course_rec.minimum_attendees							:= p_minimum_attendees        ;
570  g_course_rec.objectives										:= p_objectives               ;
571  g_course_rec.start_date										:= p_start_date               ;
575  g_course_rec.actual_cost										:= p_actual_cost              ;
572  g_course_rec.success_criteria							:= p_success_criteria         ;
573  g_course_rec.user_status										:= p_user_status              ;
574  g_course_rec.vendor_id											:= p_vendor_id                ;
576  g_course_rec.budget_cost										:= p_budget_cost              ;
577  g_course_rec.budget_currency_code					:= p_budget_currency_code     ;
578  g_course_rec.expenses_allowed							:= p_expenses_allowed         ;
579  g_course_rec.professional_credit_type			:= p_professional_credit_type ;
580  g_course_rec.professional_credits					:= p_professional_credits     ;
581  g_course_rec.maximum_internal_attendees		:= p_maximum_internal_attendees;
582  g_course_rec.tav_information_category			:= p_tav_information_category  ;
583  g_course_rec.tav_information1							:= p_tav_information1          ;
584  g_course_rec.tav_information2							:= p_tav_information2          ;
585  g_course_rec.tav_information3							:= p_tav_information3          ;
586  g_course_rec.tav_information4							:= p_tav_information4          ;
587  g_course_rec.tav_information5							:= p_tav_information5          ;
588  g_course_rec.tav_information6							:= p_tav_information6          ;
589  g_course_rec.tav_information7							:= p_tav_information7          ;
590  g_course_rec.tav_information8							:= p_tav_information8          ;
591  g_course_rec.tav_information9							:= p_tav_information9          ;
592  g_course_rec.tav_information10							:= p_tav_information10         ;
593  g_course_rec.tav_information11							:= p_tav_information11         ;
594  g_course_rec.tav_information12							:= p_tav_information12         ;
595  g_course_rec.tav_information13							:= p_tav_information13         ;
596  g_course_rec.tav_information14							:= p_tav_information14         ;
597  g_course_rec.tav_information15							:= p_tav_information15         ;
598  g_course_rec.tav_information16							:= p_tav_information16         ;
599  g_course_rec.tav_information17							:= p_tav_information17         ;
600  g_course_rec.tav_information18							:= p_tav_information18         ;
601  g_course_rec.tav_information19							:= p_tav_information19         ;
602  g_course_rec.tav_information20							:= p_tav_information20         ;
603  g_course_rec.inventory_item_id							:= p_inventory_item_id 	     ;
604  g_course_rec.organization_id							:= p_organization_id	     ;
605  g_course_rec.rco_id								:= p_rco_id			     ;
606  g_course_rec.version_code							:= p_version_code                ;
607  g_course_rec.keywords								:= p_keywords                    ;
608  g_course_rec.business_group_id							:= p_business_group_id	     ;
609  g_course_rec.data_source							:= p_data_source              ;
610  g_course_rec.competency_update_level				                := p_competency_update_level   ;
611 
612 
613 
614 
615 l_course_rec := Get_Record_Values(g_interface_code);
616 
617 select object_version_number into l_object_version_number from
618      ota_activity_versions where activity_version_id = l_activity_version_id;
619 
620 ota_activity_version_api.update_activity_version
621   (
622   p_effective_date               => p_effective_date,
623   p_activity_version_id          => l_activity_version_id,
624   p_activity_id                  => l_course_rec.activity_id,
625   p_superseded_by_act_version_id => l_course_rec.superseded_by_act_version_id,
626   p_developer_organization_id    => l_course_rec.developer_organization_id,
627   p_controlling_person_id        => l_course_rec.controlling_person_id,
628   p_object_version_number        => l_object_version_number,
629   p_version_name                 => l_course_rec.version_name,
630   p_comments                     => l_course_rec.comments,
631   p_description                  => l_course_rec.description,
632   p_duration                     => l_course_rec.duration,
633   p_duration_units               => l_course_rec.duration_units,
634   p_end_date                     => l_course_rec.end_date,
635   p_intended_audience            => l_course_rec.intended_audience,
636   p_language_id                  => l_course_rec.language_id ,
637   p_maximum_attendees            => l_course_rec.maximum_attendees,
638   p_minimum_attendees            => l_course_rec.minimum_attendees,
639   p_objectives                   => l_course_rec.objectives,
640   p_start_date                   => l_course_rec.start_date,
641   p_success_criteria             => l_course_rec.success_criteria,
642   p_user_status                  => l_course_rec.user_status,
643   p_vendor_id                    => l_course_rec.vendor_id,
644   p_actual_cost                  => l_course_rec.actual_cost,
645   p_budget_cost                  => l_course_rec.budget_cost,
646   p_budget_currency_code         => l_course_rec.budget_currency_code,
647   p_expenses_allowed             => l_course_rec.expenses_allowed,
648   p_professional_credit_type     => l_course_rec.professional_credit_type,
649   p_professional_credits         => l_course_rec.professional_credits,
650   p_maximum_internal_attendees   => l_course_rec.maximum_internal_attendees
651     ,p_tav_information_category     => l_course_rec.tav_information_category
652     ,p_tav_information1             => l_course_rec.tav_information1
653     ,p_tav_information2             => l_course_rec.tav_information2
654     ,p_tav_information3             => l_course_rec.tav_information3
655     ,p_tav_information4             => l_course_rec.tav_information4
656     ,p_tav_information5             => l_course_rec.tav_information5
657     ,p_tav_information6             => l_course_rec.tav_information6
658     ,p_tav_information7             => l_course_rec.tav_information7
659     ,p_tav_information8             => l_course_rec.tav_information8
660     ,p_tav_information9             => l_course_rec.tav_information9
661     ,p_tav_information10            => l_course_rec.tav_information10
662     ,p_tav_information11            => l_course_rec.tav_information11
663     ,p_tav_information12            => l_course_rec.tav_information12
664     ,p_tav_information13            => l_course_rec.tav_information13
665     ,p_tav_information14            => l_course_rec.tav_information14
666     ,p_tav_information15            => l_course_rec.tav_information15
667     ,p_tav_information16            => l_course_rec.tav_information16
668     ,p_tav_information17            => l_course_rec.tav_information17
669     ,p_tav_information18            => l_course_rec.tav_information18
670     ,p_tav_information19            => l_course_rec.tav_information19
671     ,p_tav_information20            => l_course_rec.tav_information20
672     ,p_inventory_item_id            => l_course_rec.inventory_item_id
673     ,p_organization_id              => l_course_rec.organization_id
674     ,p_rco_id                       => l_course_rec.rco_id
675     ,p_version_code                 => l_course_rec.version_code
676     ,p_keywords                     => l_course_rec.keywords
677     ,p_business_group_id            => l_course_rec.business_group_id
678     ,p_data_source                  => l_course_rec.data_source
679     ,p_competency_update_level      => l_course_rec.competency_update_level
680   );
681  end if;
682 
683 
684 
685   hr_utility.set_location(' Leaving:' || l_proc,20);
686 
687 exception
688 
689   when e_upl_not_allowed then
690     hr_utility.set_message(8303, 'PQP_230500_HROSS_GENERIC_ERR');
691     hr_utility.set_message_token('GENERIC_TOKEN',g_upl_err_msg);
692     hr_utility.set_location('Leaving: ' || l_proc, 90);
693     hr_utility.raise_error;
694   when e_crt_not_allowed then
695     hr_utility.set_message(8303, 'PQP_230500_HROSS_GENERIC_ERR');
696     hr_utility.set_message_token('GENERIC_TOKEN',g_crt_err_msg);
697     hr_utility.set_location('Leaving: ' || l_proc, 100);
698     hr_utility.raise_error;
699 when others then
700    --l_error_msg := Substr(SQLERRM,1,2000);
701    hr_utility.set_location('SQLCODE :' || SQLCODE,90);
702    hr_utility.set_location('SQLERRM :' || SQLERRM,90);
703    --hr_utility.set_message(8303, 'PQP_230500_HROSS_GENERIC_ERR');
704    --hr_utility.set_message_token('GENERIC_TOKEN',substr(l_error_msg,1,500) );
705    hr_utility.set_location(' Leaving:' || l_proc,50);
706    hr_utility.raise_error;
707 
708 end InsUpd_Course;
709 end pqp_riw_course_wrapper;