57:
58: l_proc varchar2(100) := 'PAY_COST_ALLOCATION_SWI.UPDATE_COST_KFF_CONCAT_SEGMENTS';
59:
60: begin
61: hr_utility.set_location('Entering '||l_proc,10);
62: open csr_segments;
63: fetch csr_segments into
64: segment(1) ,
65: segment(2) ,
92: segment(29),
93: segment(30);
94: close csr_segments;
95:
96: hr_utility.set_location(l_proc,20);
97: open csr_cost_structure;
98: fetch csr_cost_structure into l_flex_num;
99: if csr_cost_structure%notfound then
100: close csr_cost_structure;
102: fnd_message.set_name('PAY', 'HR_7471_FLEX_PEA_INVALID_ID');
103: fnd_message.raise_error;
104: end if;
105: close csr_cost_structure;
106: hr_utility.set_location(l_proc,30);
107: /*Get the delimter to construct the concatenated segment*/
108: l_delimiter := fnd_flex_ext.get_delimiter
109: ('PAY'
110: ,'COST'
109: ('PAY'
110: ,'COST'
111: ,l_flex_num
112: );
113: hr_utility.trace('Delimeter => '||l_delimiter);
114: l_first_seg := true;
115: hr_utility.set_location(l_proc,40);
116: --
117: /*Construct the concatenated segment*/
111: ,l_flex_num
112: );
113: hr_utility.trace('Delimeter => '||l_delimiter);
114: l_first_seg := true;
115: hr_utility.set_location(l_proc,40);
116: --
117: /*Construct the concatenated segment*/
118: hr_utility.set_location(l_proc,50);
119: open get_seg_order(l_flex_num);
114: l_first_seg := true;
115: hr_utility.set_location(l_proc,40);
116: --
117: /*Construct the concatenated segment*/
118: hr_utility.set_location(l_proc,50);
119: open get_seg_order(l_flex_num);
120: loop
121: fetch get_seg_order into l_disp_no;
122: exit when get_seg_order%NOTFOUND;
131: end loop;
132: close get_seg_order;
133: --
134: l_concatenated_segments := substr(l_concat_string, 1, 240);
135: hr_utility.trace('l_concat_string => '||l_concat_string);
136: hr_utility.trace('l_concatenated_segments => '||l_concatenated_segments);
137: hr_utility.set_location(l_proc,60);
138: /*Now update the Cost KFF entry with the concatenated segment
139: only if the existing concatenated segment is not equal to the
132: close get_seg_order;
133: --
134: l_concatenated_segments := substr(l_concat_string, 1, 240);
135: hr_utility.trace('l_concat_string => '||l_concat_string);
136: hr_utility.trace('l_concatenated_segments => '||l_concatenated_segments);
137: hr_utility.set_location(l_proc,60);
138: /*Now update the Cost KFF entry with the concatenated segment
139: only if the existing concatenated segment is not equal to the
140: newly constructed concatenated segment(for Update)*/
133: --
134: l_concatenated_segments := substr(l_concat_string, 1, 240);
135: hr_utility.trace('l_concat_string => '||l_concat_string);
136: hr_utility.trace('l_concatenated_segments => '||l_concatenated_segments);
137: hr_utility.set_location(l_proc,60);
138: /*Now update the Cost KFF entry with the concatenated segment
139: only if the existing concatenated segment is not equal to the
140: newly constructed concatenated segment(for Update)*/
141: update pay_cost_allocation_keyflex
142: set concatenated_segments = l_concatenated_segments
143: where cost_allocation_keyflex_id = p_cost_allocation_keyflex_id
144: and id_flex_num = l_flex_num
145: and nvl(concatenated_segments, hr_api.g_varchar2) <> l_concatenated_segments;
146: hr_utility.set_location(l_proc,60);
147: if (SQL%ROWCOUNT = 0 ) then
148: hr_utility.trace('No Rows updated');
149: else
150: hr_utility.trace('Row updated with concatenated segment');
144: and id_flex_num = l_flex_num
145: and nvl(concatenated_segments, hr_api.g_varchar2) <> l_concatenated_segments;
146: hr_utility.set_location(l_proc,60);
147: if (SQL%ROWCOUNT = 0 ) then
148: hr_utility.trace('No Rows updated');
149: else
150: hr_utility.trace('Row updated with concatenated segment');
151: end if;
152: /*We are handling the exceptions in calling procedures.*/
146: hr_utility.set_location(l_proc,60);
147: if (SQL%ROWCOUNT = 0 ) then
148: hr_utility.trace('No Rows updated');
149: else
150: hr_utility.trace('Row updated with concatenated segment');
151: end if;
152: /*We are handling the exceptions in calling procedures.*/
153: hr_utility.set_location('Leaving '||l_proc,100);
154: end upd_cost_KFF_concat_segments;
149: else
150: hr_utility.trace('Row updated with concatenated segment');
151: end if;
152: /*We are handling the exceptions in calling procedures.*/
153: hr_utility.set_location('Leaving '||l_proc,100);
154: end upd_cost_KFF_concat_segments;
155: --
156: -- ----------------------------------------------------------------------------
157: -- |------------------------< create_cost_allocation >------------------------|
215: -- Other variables
216: l_cost_allocation_id number;
217: l_proc varchar2(72) := g_package ||'create_cost_allocation';
218: Begin
219: hr_utility.set_location(' Entering:' || l_proc,10);
220: --
221: -- Issue a savepoint
222: --
223: savepoint create_cost_allocation_swi;
243: );
244: /*This package is called from OAF page. OAF is creating the cost allocation
245: KFF entry but it doesn't populate the concatenated segments. So here
246: we need to set the concatenated segments of the KFF combination created*/
247: hr_utility.set_location(l_proc||': Checking to call upd_cost_KFF_concat_segments',20);
248: hr_utility.trace('p_cost_allocation_keyflex_id => '||nvl(p_cost_allocation_keyflex_id,0));
249: hr_utility.trace('p_concat_segments => '||nvl(p_concat_segments,'NULL'));
250: if (nvl(p_concat_segments,hr_api.g_varchar2) = hr_api.g_varchar2 and l_cost_allocation_keyflex_id is not null) then
251: hr_utility.set_location(l_proc||': Calling upd_cost_KFF_concat_segments',30);
244: /*This package is called from OAF page. OAF is creating the cost allocation
245: KFF entry but it doesn't populate the concatenated segments. So here
246: we need to set the concatenated segments of the KFF combination created*/
247: hr_utility.set_location(l_proc||': Checking to call upd_cost_KFF_concat_segments',20);
248: hr_utility.trace('p_cost_allocation_keyflex_id => '||nvl(p_cost_allocation_keyflex_id,0));
249: hr_utility.trace('p_concat_segments => '||nvl(p_concat_segments,'NULL'));
250: if (nvl(p_concat_segments,hr_api.g_varchar2) = hr_api.g_varchar2 and l_cost_allocation_keyflex_id is not null) then
251: hr_utility.set_location(l_proc||': Calling upd_cost_KFF_concat_segments',30);
252: /*Eventhough this procedure is accepting all segments, SS is not passing
245: KFF entry but it doesn't populate the concatenated segments. So here
246: we need to set the concatenated segments of the KFF combination created*/
247: hr_utility.set_location(l_proc||': Checking to call upd_cost_KFF_concat_segments',20);
248: hr_utility.trace('p_cost_allocation_keyflex_id => '||nvl(p_cost_allocation_keyflex_id,0));
249: hr_utility.trace('p_concat_segments => '||nvl(p_concat_segments,'NULL'));
250: if (nvl(p_concat_segments,hr_api.g_varchar2) = hr_api.g_varchar2 and l_cost_allocation_keyflex_id is not null) then
251: hr_utility.set_location(l_proc||': Calling upd_cost_KFF_concat_segments',30);
252: /*Eventhough this procedure is accepting all segments, SS is not passing
253: them. So we are deriving the individual segments in upd_cost_KFF_concat_segments()*/
247: hr_utility.set_location(l_proc||': Checking to call upd_cost_KFF_concat_segments',20);
248: hr_utility.trace('p_cost_allocation_keyflex_id => '||nvl(p_cost_allocation_keyflex_id,0));
249: hr_utility.trace('p_concat_segments => '||nvl(p_concat_segments,'NULL'));
250: if (nvl(p_concat_segments,hr_api.g_varchar2) = hr_api.g_varchar2 and l_cost_allocation_keyflex_id is not null) then
251: hr_utility.set_location(l_proc||': Calling upd_cost_KFF_concat_segments',30);
252: /*Eventhough this procedure is accepting all segments, SS is not passing
253: them. So we are deriving the individual segments in upd_cost_KFF_concat_segments()*/
254: upd_cost_KFF_concat_segments(
255: p_business_group_id => p_business_group_id
257: end if;
258: --
259: -- Call API
260: --
261: hr_utility.set_location(l_proc||': Calling pay_cost_allocation_api.create_cost_allocation',40);
262: pay_cost_allocation_api.create_cost_allocation
263: (p_validate => l_validate
264: ,p_effective_date => p_effective_date
265: ,p_assignment_id => p_assignment_id
319: -- messages of any type exist in the Multiple Message List.
320: -- Also disable Multiple Message Detection.
321: --
322: p_return_status := hr_multi_message.get_return_status_disable;
323: hr_utility.set_location(' Leaving:' || l_proc,100);
324: --
325: exception
326: when hr_multi_message.error_message_exist then
327: --
338: p_effective_end_date := null;
339: p_cost_allocation_keyflex_id := l_cost_allocation_keyflex_id;
340: p_object_version_number := null;
341: p_return_status := hr_multi_message.get_return_status_disable;
342: hr_utility.set_location(' Leaving:' || l_proc, 110);
343: when others then
344: --
345: -- When Multiple Message Detection is enabled catch
346: -- any Application specific or other unexpected
349: -- error.
350: --
351: rollback to create_cost_allocation_swi;
352: if hr_multi_message.unexpected_error_add(l_proc) then
353: hr_utility.set_location(' Leaving:' || l_proc,120);
354: raise;
355: end if;
356: --
357: -- Reset IN OUT and set OUT parameters
361: p_effective_end_date := null;
362: p_cost_allocation_keyflex_id := l_cost_allocation_keyflex_id;
363: p_object_version_number := null;
364: p_return_status := hr_multi_message.get_return_status_disable;
365: hr_utility.set_location(' Leaving:' || l_proc,130);
366: end create_cost_allocation;
367: -- ----------------------------------------------------------------------------
368: -- |------------------------< delete_cost_allocation >------------------------|
369: -- ----------------------------------------------------------------------------
386: --
387: -- Other variables
388: l_proc varchar2(72) := g_package ||'delete_cost_allocation';
389: Begin
390: hr_utility.set_location(' Entering:' || l_proc,10);
391: --
392: -- Issue a savepoint
393: --
394: savepoint delete_cost_allocation_swi;
433: -- messages of any type exist in the Multiple Message List.
434: -- Also disable Multiple Message Detection.
435: --
436: p_return_status := hr_multi_message.get_return_status_disable;
437: hr_utility.set_location(' Leaving:' || l_proc,20);
438: --
439: exception
440: when hr_multi_message.error_message_exist then
441: --
450: p_object_version_number := l_object_version_number;
451: p_effective_start_date := null;
452: p_effective_end_date := null;
453: p_return_status := hr_multi_message.get_return_status_disable;
454: hr_utility.set_location(' Leaving:' || l_proc, 30);
455: when others then
456: --
457: -- When Multiple Message Detection is enabled catch
458: -- any Application specific or other unexpected
461: -- error.
462: --
463: rollback to delete_cost_allocation_swi;
464: if hr_multi_message.unexpected_error_add(l_proc) then
465: hr_utility.set_location(' Leaving:' || l_proc,40);
466: raise;
467: end if;
468: --
469: -- Reset IN OUT and set OUT parameters
471: p_object_version_number := l_object_version_number;
472: p_effective_start_date := null;
473: p_effective_end_date := null;
474: p_return_status := hr_multi_message.get_return_status_disable;
475: hr_utility.set_location(' Leaving:' || l_proc,50);
476: end delete_cost_allocation;
477: -- ----------------------------------------------------------------------------
478: -- |------------------------< update_cost_allocation >------------------------|
479: -- ----------------------------------------------------------------------------
541: --
542: -- Other variables
543: l_proc varchar2(72) := g_package ||'update_cost_allocation';
544: Begin
545: hr_utility.set_location(' Entering:' || l_proc,10);
546: --
547: -- Issue a savepoint
548: --
549: savepoint update_cost_allocation_swi;
561: --
562: l_validate :=
563: hr_api.constant_to_boolean
564: (p_constant_value => p_validate);
565: hr_utility.set_location(l_proc, 20);
566: begin
567: hr_utility.set_location(l_proc,30);
568: open csr_bg;
569: fetch csr_bg into l_business_group_id;
563: hr_api.constant_to_boolean
564: (p_constant_value => p_validate);
565: hr_utility.set_location(l_proc, 20);
566: begin
567: hr_utility.set_location(l_proc,30);
568: open csr_bg;
569: fetch csr_bg into l_business_group_id;
570: if (csr_bg%notfound) then
571: close csr_bg;
568: open csr_bg;
569: fetch csr_bg into l_business_group_id;
570: if (csr_bg%notfound) then
571: close csr_bg;
572: hr_utility.set_location(l_proc,40);
573: fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
574: fnd_message.raise_error;
575: end if;
576: hr_utility.set_location(l_proc,50);
572: hr_utility.set_location(l_proc,40);
573: fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
574: fnd_message.raise_error;
575: end if;
576: hr_utility.set_location(l_proc,50);
577: close csr_bg;
578: --
579: /*Eventhough this procedure is accepting all segments, SS is not passing
580: them. So we are deriving the individual segments in upd_cost_KFF_concat_segments()*/
577: close csr_bg;
578: --
579: /*Eventhough this procedure is accepting all segments, SS is not passing
580: them. So we are deriving the individual segments in upd_cost_KFF_concat_segments()*/
581: hr_utility.set_location(l_proc,60);
582: upd_cost_KFF_concat_segments(
583: p_business_group_id => l_business_group_id
584: ,p_cost_allocation_keyflex_id => l_cost_allocation_keyflex_id);
585: end;
585: end;
586: --
587: -- Call API
588: --
589: hr_utility.set_location(l_proc,70);
590: pay_cost_allocation_api.update_cost_allocation
591: (p_validate => l_validate
592: ,p_effective_date => p_effective_date
593: ,p_datetrack_update_mode => p_datetrack_update_mode
646: -- messages of any type exist in the Multiple Message List.
647: -- Also disable Multiple Message Detection.
648: --
649: p_return_status := hr_multi_message.get_return_status_disable;
650: hr_utility.set_location(' Leaving:' || l_proc,100);
651: --
652: exception
653: when hr_multi_message.error_message_exist then
654: --
665: p_cost_allocation_keyflex_id := l_cost_allocation_keyflex_id;
666: p_effective_start_date := null;
667: p_effective_end_date := null;
668: p_return_status := hr_multi_message.get_return_status_disable;
669: hr_utility.set_location(' Leaving:' || l_proc, 110);
670: when others then
671: --
672: -- When Multiple Message Detection is enabled catch
673: -- any Application specific or other unexpected
676: -- error.
677: --
678: rollback to update_cost_allocation_swi;
679: if hr_multi_message.unexpected_error_add(l_proc) then
680: hr_utility.set_location(' Leaving:' || l_proc,120);
681: raise;
682: end if;
683: --
684: -- Reset IN OUT and set OUT parameters
688: p_cost_allocation_keyflex_id := l_cost_allocation_keyflex_id;
689: p_effective_start_date := null;
690: p_effective_end_date := null;
691: p_return_status := hr_multi_message.get_return_status_disable;
692: hr_utility.set_location(' Leaving:' || l_proc,130);
693: end update_cost_allocation;
694:
695: /*For Bug 10187159 */
696: -- This procedure insert a row into the fnd_sessions table
704: where session_id = userenv('sessionid');
705: --variables
706: l_session_id number ;
707: begin
708: hr_utility.trace('Entered insert_fnd_sessions ');
709: -- Insert a row into fnd_sessions if reqd
710: open csr_get_session_id;
711: fetch csr_get_session_id into l_session_id;
712: if csr_get_session_id%notfound then
711: fetch csr_get_session_id into l_session_id;
712: if csr_get_session_id%notfound then
713: insert into fnd_sessions(session_id,effective_date)
714: values (userenv('sessionid'),fnd_date.canonical_to_date(p_effective_date));
715: hr_utility.trace('inserted a row into the fnd_sessions table');
716: end if;
717: close csr_get_session_id;
718:
719: end insert_fnd_sessions;