DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_BTL_SHD

Source


1 Package Body pay_btl_shd as
2 /* $Header: pybtlrhi.pkb 120.7 2005/11/09 08:16:09 mkataria noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_btl_shd.';  -- Global package name
9 
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------< return_api_dml_status >-------------------------|
13 -- ----------------------------------------------------------------------------
14 Function return_api_dml_status Return Boolean Is
15 --
16 Begin
17   --
18   Return (nvl(g_api_dml, false));
19   --
20 End return_api_dml_status;
21 --
22 -- ----------------------------------------------------------------------------
23 -- |---------------------------< constraint_error >---------------------------|
24 -- ----------------------------------------------------------------------------
25 Procedure constraint_error
26   (
27   p_constraint_name in all_constraints.constraint_name%TYPE
28   ) Is
29 --
30   l_proc 	varchar2(72) := g_package||'constraint_error';
31 --
32 Begin
33   --
34   If (p_constraint_name = 'PAY_BATCH_LINES_FK3') Then
35     fnd_message.set_name('PAY', 'PAY_52680_BHT_INVALID_HEADER');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'PAY_BATCH_LINES_PK') Then
38     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'PAY_BCHL_BATCH_LINE_STATUS_CHK') Then
43     fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
44     fnd_message.set_token('COLUMN_NAME','BATCH_LINE_STATUS');
45     fnd_message.raise_error;
46   ElsIf (p_constraint_name = 'PAY_BCHL_ENTRY_TYPE_CHK') Then
47     fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
48     fnd_message.set_token('COLUMN_NAME','ENTRY_TYPE');
49     fnd_message.raise_error;
50   Else
51     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
52     fnd_message.set_token('PROCEDURE', l_proc);
53     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
54     fnd_message.raise_error;
55   End If;
56   --
57 End constraint_error;
58 --
59 -- ----------------------------------------------------------------------------
60 -- |-----------------------------< api_updating >-----------------------------|
61 -- ----------------------------------------------------------------------------
62 Function api_updating
63   (p_batch_line_id                        in     number
64   ,p_object_version_number                in     number
65   )
66   Return Boolean Is
67 --
68   --
69   -- Cursor selects the 'current' row from the HR Schema
70   --
71   Cursor C_Sel1 is
72     select
73        batch_line_id
74       ,cost_allocation_keyflex_id
75       ,element_type_id
76       ,assignment_id
77       ,batch_id
78       ,batch_line_status
79       ,assignment_number
80       ,batch_sequence
81       ,concatenated_segments
82       ,effective_date
83       ,element_name
84       ,entry_type
85       ,reason
86       ,segment1
87       ,segment2
88       ,segment3
89       ,segment4
90       ,segment5
91       ,segment6
92       ,segment7
93       ,segment8
94       ,segment9
95       ,segment10
96       ,segment11
97       ,segment12
98       ,segment13
99       ,segment14
100       ,segment15
101       ,segment16
102       ,segment17
103       ,segment18
104       ,segment19
105       ,segment20
106       ,segment21
107       ,segment22
108       ,segment23
109       ,segment24
110       ,segment25
111       ,segment26
112       ,segment27
113       ,segment28
114       ,segment29
115       ,segment30
116       ,value_1
117       ,value_2
118       ,value_3
119       ,value_4
120       ,value_5
121       ,value_6
122       ,value_7
123       ,value_8
124       ,value_9
125       ,value_10
126       ,value_11
127       ,value_12
128       ,value_13
129       ,value_14
130       ,value_15
131       ,attribute_category
132       ,attribute1
133       ,attribute2
134       ,attribute3
135       ,attribute4
136       ,attribute5
137       ,attribute6
138       ,attribute7
139       ,attribute8
140       ,attribute9
141       ,attribute10
142       ,attribute11
143       ,attribute12
144       ,attribute13
145       ,attribute14
146       ,attribute15
147       ,attribute16
148       ,attribute17
149       ,attribute18
150       ,attribute19
151       ,attribute20
152       ,entry_information_category
153       ,entry_information1
154       ,entry_information2
155       ,entry_information3
156       ,entry_information4
157       ,entry_information5
158       ,entry_information6
159       ,entry_information7
160       ,entry_information8
161       ,entry_information9
162       ,entry_information10
163       ,entry_information11
164       ,entry_information12
165       ,entry_information13
166       ,entry_information14
167       ,entry_information15
168       ,entry_information16
169       ,entry_information17
170       ,entry_information18
171       ,entry_information19
172       ,entry_information20
173       ,entry_information21
174       ,entry_information22
175       ,entry_information23
176       ,entry_information24
177       ,entry_information25
178       ,entry_information26
179       ,entry_information27
180       ,entry_information28
181       ,entry_information29
182       ,entry_information30
183       ,date_earned
184       ,personal_payment_method_id
185       ,subpriority
186       ,effective_start_date
187       ,effective_end_date
188       ,object_version_number
189     from	pay_batch_lines
190     where	batch_line_id = p_batch_line_id;
191 --
192   l_fct_ret	boolean;
193 --
194 Begin
195   --
196   If (p_batch_line_id is null and
197       p_object_version_number is null
198      ) Then
199     --
200     -- One of the primary key arguments is null therefore we must
201     -- set the returning function value to false
202     --
203     l_fct_ret := false;
204   Else
205     If (p_batch_line_id
206         = pay_btl_shd.g_old_rec.batch_line_id and
207         p_object_version_number
208         = pay_btl_shd.g_old_rec.object_version_number
209        ) Then
210       --
211       -- The g_old_rec is current therefore we must
212       -- set the returning function to true
213       --
214       l_fct_ret := true;
215     Else
216       --
217       -- Select the current row into g_old_rec
218       --
219       Open C_Sel1;
220       Fetch C_Sel1 Into pay_btl_shd.g_old_rec;
221       If C_Sel1%notfound Then
222         Close C_Sel1;
223         --
224         -- The primary key is invalid therefore we must error
225         --
226         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
227         fnd_message.raise_error;
228       End If;
229       Close C_Sel1;
230       If (p_object_version_number
231           <> pay_btl_shd.g_old_rec.object_version_number) Then
232         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
233         fnd_message.raise_error;
234       End If;
235       l_fct_ret := true;
236     End If;
237   End If;
238   Return (l_fct_ret);
239 --
240 End api_updating;
241 --
242 -- ----------------------------------------------------------------------------
243 -- |---------------------------------< lck >----------------------------------|
244 -- ----------------------------------------------------------------------------
245 Procedure lck
246   (p_batch_line_id                        in     number
247   ,p_object_version_number                in     number
248   ) is
249 --
250 -- Cursor selects the 'current' row from the HR Schema
251 --
252   Cursor C_Sel1 is
253     select
254        batch_line_id
255       ,cost_allocation_keyflex_id
256       ,element_type_id
257       ,assignment_id
258       ,batch_id
259       ,batch_line_status
260       ,assignment_number
261       ,batch_sequence
262       ,concatenated_segments
263       ,effective_date
264       ,element_name
265       ,entry_type
266       ,reason
267       ,segment1
268       ,segment2
269       ,segment3
270       ,segment4
271       ,segment5
272       ,segment6
273       ,segment7
274       ,segment8
275       ,segment9
276       ,segment10
277       ,segment11
278       ,segment12
279       ,segment13
280       ,segment14
281       ,segment15
282       ,segment16
283       ,segment17
284       ,segment18
285       ,segment19
286       ,segment20
287       ,segment21
288       ,segment22
289       ,segment23
290       ,segment24
291       ,segment25
292       ,segment26
293       ,segment27
294       ,segment28
295       ,segment29
296       ,segment30
297       ,value_1
298       ,value_2
299       ,value_3
300       ,value_4
301       ,value_5
302       ,value_6
303       ,value_7
304       ,value_8
305       ,value_9
306       ,value_10
307       ,value_11
308       ,value_12
309       ,value_13
310       ,value_14
311       ,value_15
312       ,attribute_category
313       ,attribute1
314       ,attribute2
315       ,attribute3
316       ,attribute4
317       ,attribute5
318       ,attribute6
319       ,attribute7
320       ,attribute8
321       ,attribute9
322       ,attribute10
323       ,attribute11
324       ,attribute12
325       ,attribute13
326       ,attribute14
327       ,attribute15
328       ,attribute16
329       ,attribute17
330       ,attribute18
331       ,attribute19
332       ,attribute20
333       ,entry_information_category
334       ,entry_information1
335       ,entry_information2
336       ,entry_information3
337       ,entry_information4
338       ,entry_information5
339       ,entry_information6
340       ,entry_information7
341       ,entry_information8
342       ,entry_information9
343       ,entry_information10
344       ,entry_information11
345       ,entry_information12
346       ,entry_information13
347       ,entry_information14
348       ,entry_information15
349       ,entry_information16
350       ,entry_information17
351       ,entry_information18
352       ,entry_information19
353       ,entry_information20
354       ,entry_information21
355       ,entry_information22
356       ,entry_information23
357       ,entry_information24
358       ,entry_information25
359       ,entry_information26
360       ,entry_information27
361       ,entry_information28
362       ,entry_information29
363       ,entry_information30
364       ,date_earned
365       ,personal_payment_method_id
366       ,subpriority
367       ,effective_start_date
368       ,effective_end_date
369       ,object_version_number
370     from	pay_batch_lines
371     where	batch_line_id = p_batch_line_id
372     for	update nowait;
373 --
374   l_proc	varchar2(72) := g_package||'lck';
375 --
376 Begin
377   hr_utility.set_location('Entering:'||l_proc, 5);
378   --
379   hr_api.mandatory_arg_error
380     (p_api_name           => l_proc
381     ,p_argument           => 'BATCH_LINE_ID'
382     ,p_argument_value     => p_batch_line_id
383     );
384   --
385   Open  C_Sel1;
386   Fetch C_Sel1 Into pay_btl_shd.g_old_rec;
387   If C_Sel1%notfound then
388     Close C_Sel1;
389     --
390     -- The primary key is invalid therefore we must error
391     --
392     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
393     fnd_message.raise_error;
394   End If;
395   Close C_Sel1;
396   If (p_object_version_number
397       <> pay_btl_shd.g_old_rec.object_version_number) Then
398         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
399         fnd_message.raise_error;
400   End If;
401   --
402   hr_utility.set_location(' Leaving:'||l_proc, 10);
403   --
404   -- We need to trap the ORA LOCK exception
405   --
406 Exception
407   When HR_Api.Object_Locked then
408     --
409     -- The object is locked therefore we need to supply a meaningful
410     -- error message.
411     --
412     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
413     fnd_message.set_token('TABLE_NAME', 'pay_batch_lines');
414     fnd_message.raise_error;
415 End lck;
416 --
417 -- ----------------------------------------------------------------------------
418 -- |-----------------------------< convert_args >-----------------------------|
419 -- ----------------------------------------------------------------------------
420 Function convert_args
421   (p_batch_line_id                  in number
422   ,p_cost_allocation_keyflex_id     in number
423   ,p_element_type_id                in number
424   ,p_assignment_id                  in number
425   ,p_batch_id                       in number
426   ,p_batch_line_status              in varchar2
427   ,p_assignment_number              in varchar2
428   ,p_batch_sequence                 in number
429   ,p_concatenated_segments          in varchar2
430   ,p_effective_date                 in date
431   ,p_element_name                   in varchar2
432   ,p_entry_type                     in varchar2
433   ,p_reason                         in varchar2
434   ,p_segment1                       in varchar2
435   ,p_segment2                       in varchar2
436   ,p_segment3                       in varchar2
437   ,p_segment4                       in varchar2
438   ,p_segment5                       in varchar2
439   ,p_segment6                       in varchar2
440   ,p_segment7                       in varchar2
441   ,p_segment8                       in varchar2
442   ,p_segment9                       in varchar2
443   ,p_segment10                      in varchar2
444   ,p_segment11                      in varchar2
445   ,p_segment12                      in varchar2
446   ,p_segment13                      in varchar2
447   ,p_segment14                      in varchar2
448   ,p_segment15                      in varchar2
449   ,p_segment16                      in varchar2
450   ,p_segment17                      in varchar2
451   ,p_segment18                      in varchar2
452   ,p_segment19                      in varchar2
453   ,p_segment20                      in varchar2
454   ,p_segment21                      in varchar2
455   ,p_segment22                      in varchar2
456   ,p_segment23                      in varchar2
457   ,p_segment24                      in varchar2
458   ,p_segment25                      in varchar2
459   ,p_segment26                      in varchar2
460   ,p_segment27                      in varchar2
461   ,p_segment28                      in varchar2
462   ,p_segment29                      in varchar2
463   ,p_segment30                      in varchar2
464   ,p_value_1                        in varchar2
465   ,p_value_2                        in varchar2
466   ,p_value_3                        in varchar2
467   ,p_value_4                        in varchar2
468   ,p_value_5                        in varchar2
469   ,p_value_6                        in varchar2
470   ,p_value_7                        in varchar2
471   ,p_value_8                        in varchar2
472   ,p_value_9                        in varchar2
476   ,p_value_13                       in varchar2
473   ,p_value_10                       in varchar2
474   ,p_value_11                       in varchar2
475   ,p_value_12                       in varchar2
477   ,p_value_14                       in varchar2
478   ,p_value_15                       in varchar2
479   ,p_attribute_category             in varchar2
480   ,p_attribute1                     in varchar2
481   ,p_attribute2                     in varchar2
482   ,p_attribute3                     in varchar2
483   ,p_attribute4                     in varchar2
484   ,p_attribute5                     in varchar2
485   ,p_attribute6                     in varchar2
486   ,p_attribute7                     in varchar2
487   ,p_attribute8                     in varchar2
488   ,p_attribute9                     in varchar2
489   ,p_attribute10                    in varchar2
490   ,p_attribute11                    in varchar2
491   ,p_attribute12                    in varchar2
492   ,p_attribute13                    in varchar2
493   ,p_attribute14                    in varchar2
494   ,p_attribute15                    in varchar2
495   ,p_attribute16                    in varchar2
496   ,p_attribute17                    in varchar2
497   ,p_attribute18                    in varchar2
498   ,p_attribute19                    in varchar2
499   ,p_attribute20                    in varchar2
500   ,p_entry_information_category     in varchar2
501   ,p_entry_information1             in varchar2
502   ,p_entry_information2             in varchar2
503   ,p_entry_information3             in varchar2
504   ,p_entry_information4             in varchar2
505   ,p_entry_information5             in varchar2
506   ,p_entry_information6             in varchar2
507   ,p_entry_information7             in varchar2
508   ,p_entry_information8             in varchar2
509   ,p_entry_information9             in varchar2
510   ,p_entry_information10            in varchar2
511   ,p_entry_information11            in varchar2
512   ,p_entry_information12            in varchar2
513   ,p_entry_information13            in varchar2
514   ,p_entry_information14            in varchar2
515   ,p_entry_information15            in varchar2
516   ,p_entry_information16            in varchar2
517   ,p_entry_information17            in varchar2
518   ,p_entry_information18            in varchar2
519   ,p_entry_information19            in varchar2
520   ,p_entry_information20            in varchar2
521   ,p_entry_information21            in varchar2
522   ,p_entry_information22            in varchar2
523   ,p_entry_information23            in varchar2
524   ,p_entry_information24            in varchar2
525   ,p_entry_information25            in varchar2
526   ,p_entry_information26            in varchar2
527   ,p_entry_information27            in varchar2
528   ,p_entry_information28            in varchar2
529   ,p_entry_information29            in varchar2
530   ,p_entry_information30            in varchar2
531   ,p_date_earned                    in date
532   ,p_personal_payment_method_id     in number
533   ,p_subpriority                    in number
534   ,p_effective_start_date           in date
535   ,p_effective_end_date             in date
536   ,p_object_version_number          in number
537   )
538   Return g_rec_type is
539 --
540   l_rec   g_rec_type;
541 --
542 Begin
543   --
544   -- Convert arguments into local l_rec structure.
545   --
546   l_rec.batch_line_id                    := p_batch_line_id;
547   l_rec.cost_allocation_keyflex_id       := p_cost_allocation_keyflex_id;
548   l_rec.element_type_id                  := p_element_type_id;
549   l_rec.assignment_id                    := p_assignment_id;
550   l_rec.batch_id                         := p_batch_id;
551   l_rec.batch_line_status                := p_batch_line_status;
552   l_rec.assignment_number                := p_assignment_number;
553   l_rec.batch_sequence                   := p_batch_sequence;
554   l_rec.concatenated_segments            := p_concatenated_segments;
555   l_rec.effective_date                   := p_effective_date;
556   l_rec.element_name                     := p_element_name;
557   l_rec.entry_type                       := p_entry_type;
558   l_rec.reason                           := p_reason;
559   l_rec.segment1                         := p_segment1;
560   l_rec.segment2                         := p_segment2;
561   l_rec.segment3                         := p_segment3;
562   l_rec.segment4                         := p_segment4;
563   l_rec.segment5                         := p_segment5;
564   l_rec.segment6                         := p_segment6;
565   l_rec.segment7                         := p_segment7;
566   l_rec.segment8                         := p_segment8;
567   l_rec.segment9                         := p_segment9;
568   l_rec.segment10                        := p_segment10;
569   l_rec.segment11                        := p_segment11;
570   l_rec.segment12                        := p_segment12;
571   l_rec.segment13                        := p_segment13;
572   l_rec.segment14                        := p_segment14;
573   l_rec.segment15                        := p_segment15;
574   l_rec.segment16                        := p_segment16;
575   l_rec.segment17                        := p_segment17;
576   l_rec.segment18                        := p_segment18;
580   l_rec.segment22                        := p_segment22;
577   l_rec.segment19                        := p_segment19;
578   l_rec.segment20                        := p_segment20;
579   l_rec.segment21                        := p_segment21;
581   l_rec.segment23                        := p_segment23;
582   l_rec.segment24                        := p_segment24;
583   l_rec.segment25                        := p_segment25;
584   l_rec.segment26                        := p_segment26;
585   l_rec.segment27                        := p_segment27;
586   l_rec.segment28                        := p_segment28;
587   l_rec.segment29                        := p_segment29;
588   l_rec.segment30                        := p_segment30;
589   l_rec.value_1                          := p_value_1;
590   l_rec.value_2                          := p_value_2;
591   l_rec.value_3                          := p_value_3;
592   l_rec.value_4                          := p_value_4;
593   l_rec.value_5                          := p_value_5;
594   l_rec.value_6                          := p_value_6;
595   l_rec.value_7                          := p_value_7;
596   l_rec.value_8                          := p_value_8;
597   l_rec.value_9                          := p_value_9;
598   l_rec.value_10                         := p_value_10;
599   l_rec.value_11                         := p_value_11;
600   l_rec.value_12                         := p_value_12;
601   l_rec.value_13                         := p_value_13;
602   l_rec.value_14                         := p_value_14;
603   l_rec.value_15                         := p_value_15;
604   l_rec.attribute_category               := p_attribute_category;
605   l_rec.attribute1                       := p_attribute1;
606   l_rec.attribute2                       := p_attribute2;
607   l_rec.attribute3                       := p_attribute3;
608   l_rec.attribute4                       := p_attribute4;
609   l_rec.attribute5                       := p_attribute5;
610   l_rec.attribute6                       := p_attribute6;
611   l_rec.attribute7                       := p_attribute7;
612   l_rec.attribute8                       := p_attribute8;
613   l_rec.attribute9                       := p_attribute9;
614   l_rec.attribute10                      := p_attribute10;
615   l_rec.attribute11                      := p_attribute11;
616   l_rec.attribute12                      := p_attribute12;
617   l_rec.attribute13                      := p_attribute13;
618   l_rec.attribute14                      := p_attribute14;
619   l_rec.attribute15                      := p_attribute15;
620   l_rec.attribute16                      := p_attribute16;
621   l_rec.attribute17                      := p_attribute17;
622   l_rec.attribute18                      := p_attribute18;
623   l_rec.attribute19                      := p_attribute19;
624   l_rec.attribute20                      := p_attribute20;
625   l_rec.entry_information_category       := p_entry_information_category;
626   l_rec.entry_information1               := p_entry_information1;
627   l_rec.entry_information2               := p_entry_information2;
628   l_rec.entry_information3               := p_entry_information3;
629   l_rec.entry_information4               := p_entry_information4;
630   l_rec.entry_information5               := p_entry_information5;
631   l_rec.entry_information6               := p_entry_information6;
632   l_rec.entry_information7               := p_entry_information7;
633   l_rec.entry_information8               := p_entry_information8;
634   l_rec.entry_information9               := p_entry_information9;
635   l_rec.entry_information10              := p_entry_information10;
636   l_rec.entry_information11              := p_entry_information11;
637   l_rec.entry_information12              := p_entry_information12;
638   l_rec.entry_information13              := p_entry_information13;
639   l_rec.entry_information14              := p_entry_information14;
640   l_rec.entry_information15              := p_entry_information15;
641   l_rec.entry_information16              := p_entry_information16;
642   l_rec.entry_information17              := p_entry_information17;
643   l_rec.entry_information18              := p_entry_information18;
644   l_rec.entry_information19              := p_entry_information19;
645   l_rec.entry_information20              := p_entry_information20;
646   l_rec.entry_information21              := p_entry_information21;
647   l_rec.entry_information22              := p_entry_information22;
648   l_rec.entry_information23              := p_entry_information23;
649   l_rec.entry_information24              := p_entry_information24;
650   l_rec.entry_information25              := p_entry_information25;
651   l_rec.entry_information26              := p_entry_information26;
652   l_rec.entry_information27              := p_entry_information27;
653   l_rec.entry_information28              := p_entry_information28;
654   l_rec.entry_information29              := p_entry_information29;
655   l_rec.entry_information30              := p_entry_information30;
656   l_rec.date_earned                      := p_date_earned;
657   l_rec.personal_payment_method_id       := p_personal_payment_method_id;
658   l_rec.subpriority                      := p_subpriority;
659   l_rec.effective_start_date             := p_effective_start_date;
660   l_rec.effective_end_date               := p_effective_end_date;
661   l_rec.object_version_number            := p_object_version_number;
662   --
663   -- Return the plsql record structure.
664   --
665   Return(l_rec);
666 --
667 End convert_args;
668 --
669 --
670 --type segment_value is varray(30) of varchar2(150);
671 --l_segment_value  segment_value ;
672 --
673 --
674 
675 --
676 -- ----------------------------------------------------------------------------
677 -- |-----------------------------< keyflex_comb >-----------------------------|
678 -- ----------------------------------------------------------------------------
679 
680 Procedure keyflex_comb(
681     p_dml_mode               in     varchar2  default hr_api.g_varchar2,
682     p_appl_short_name        in     varchar2  default hr_api.g_varchar2,
683     p_flex_code              in     varchar2  default hr_api.g_varchar2,
684     p_segment1               in     varchar2  default hr_api.g_varchar2,
685     p_segment2               in     varchar2  default hr_api.g_varchar2,
686     p_segment3               in     varchar2  default hr_api.g_varchar2,
687     p_segment4               in     varchar2  default hr_api.g_varchar2,
688     p_segment5               in     varchar2  default hr_api.g_varchar2,
689     p_segment6               in     varchar2  default hr_api.g_varchar2,
690     p_segment7               in     varchar2  default hr_api.g_varchar2,
691     p_segment8               in     varchar2  default hr_api.g_varchar2,
692     p_segment9               in     varchar2  default hr_api.g_varchar2,
693     p_segment10              in     varchar2  default hr_api.g_varchar2,
694     p_segment11              in     varchar2  default hr_api.g_varchar2,
695     p_segment12              in     varchar2  default hr_api.g_varchar2,
696     p_segment13              in     varchar2  default hr_api.g_varchar2,
697     p_segment14              in     varchar2  default hr_api.g_varchar2,
698     p_segment15              in     varchar2  default hr_api.g_varchar2,
699     p_segment16              in     varchar2  default hr_api.g_varchar2,
700     p_segment17              in     varchar2  default hr_api.g_varchar2,
701     p_segment18              in     varchar2  default hr_api.g_varchar2,
702     p_segment19              in     varchar2  default hr_api.g_varchar2,
703     p_segment20              in     varchar2  default hr_api.g_varchar2,
704     p_segment21              in     varchar2  default hr_api.g_varchar2,
705     p_segment22              in     varchar2  default hr_api.g_varchar2,
706     p_segment23              in     varchar2  default hr_api.g_varchar2,
707     p_segment24              in     varchar2  default hr_api.g_varchar2,
708     p_segment25              in     varchar2  default hr_api.g_varchar2,
709     p_segment26              in     varchar2  default hr_api.g_varchar2,
713     p_segment30              in     varchar2  default hr_api.g_varchar2,
710     p_segment27              in     varchar2  default hr_api.g_varchar2,
711     p_segment28              in     varchar2  default hr_api.g_varchar2,
712     p_segment29              in     varchar2  default hr_api.g_varchar2,
714     p_concat_segments_in     in     varchar2  default hr_api.g_varchar2,
715     p_batch_line_id          in     number  default hr_api.g_number,
716     p_batch_id               in     number  default hr_api.g_number,
717     --
718     -- OUT parameter,
719     -- l_rec.cost_allocation_keyflex_id may have a new value
720     --
721     p_ccid                   in out nocopy  number,
722     p_concat_segments_out    out    nocopy  varchar2
723     )    is
724 
725  cursor csr_bg_id(c_batch_id pay_batch_headers.batch_id%type) is
726     select pbh.business_group_id
727     from pay_batch_headers pbh
728     where pbh.batch_id = c_batch_id;
729 
730  cursor csr_id_flex_num(c_business_group_id  pay_batch_headers.business_group_id%type)is
731     select cost_allocation_structure
732     from per_business_groups
733     where business_group_id= c_business_group_id;
734 
735  cursor csr_batch_id (p_batch_line_id pay_batch_lines.batch_line_id%type) is
736     select pbl.batch_id
737     from pay_batch_lines pbl
738     where pbl.batch_line_id = p_batch_line_id;
739 
740  cursor csr_get_concat_segments(c_ccid pay_batch_lines.cost_allocation_keyflex_id%type) is
741     select concatenated_segments
742     from pay_cost_allocation_keyflex
743     where cost_allocation_keyflex_id = c_ccid;
744 
745     l_business_group_id     pay_batch_headers.business_group_id%type;
746     l_ccid                  pay_batch_lines.cost_allocation_keyflex_id%type;
747     l_concat_segments_out   pay_batch_lines.concatenated_segments%type;
748     l_batch_id              pay_batch_headers.batch_id%type;
749     l_check_segments        boolean;
750     l_proc	            varchar2(72) := g_package||'keyflex_comb';
751     l_id_flex_num           pay_cost_allocation_keyflex.id_flex_num%type;
752 
753 --
754 begin
755     hr_utility.set_location('Entering:'||l_proc, 5);
756 
757 
758     l_ccid:= -1;
759     l_concat_segments_out := p_concat_segments_out;
760 
761    hr_utility.set_location(l_proc, 10);
762 
763 --
764 
765     if (p_dml_mode='UPDATE') then
766 
767       open csr_batch_id(p_batch_line_id);
768       fetch csr_batch_id into l_batch_id;
769       close csr_batch_id;
770     elsif (p_dml_mode='INSERT') then
771       l_batch_id := p_batch_id;
772 
773     end if;
774   --
775     hr_utility.set_location(l_proc, 20);
776 
777     open csr_bg_id(l_batch_id);
778     fetch csr_bg_id into l_business_group_id;
779     close csr_bg_id;
780   --
781     open csr_id_flex_num(l_business_group_id);
782     fetch csr_id_flex_num into l_id_flex_num;
783     close csr_id_flex_num;
784 
785   --
786   pay_btl_shd.g_api_dml := true;  -- set the api dml status
787 
788 
789 
790 if  p_dml_mode = 'UPDATE' then
791 
792 
793     l_ccid :=
794 	  hr_entry.maintain_cost_keyflex(
795             p_cost_keyflex_structure     => l_id_flex_num,
796             p_cost_allocation_keyflex_id => l_ccid,
797             p_concatenated_segments      => NULL,
798             p_summary_flag               =>'N',
799             p_start_date_active          => NULL,
800             p_end_date_active            => NULL,
801             p_segment1                   =>p_segment1,
802             p_segment2                   =>p_segment2,
803             p_segment3                   =>p_segment3,
804             p_segment4                   =>p_segment4,
805             p_segment5                   =>p_segment5,
806             p_segment6                   =>p_segment6,
807             p_segment7                   =>p_segment7,
808             p_segment8                   =>p_segment8,
809             p_segment9                   =>p_segment9,
810             p_segment10                  =>p_segment10,
811             p_segment11                  =>p_segment11,
812             p_segment12                  =>p_segment12,
813             p_segment13                  =>p_segment13,
814             p_segment14                  =>p_segment14,
815             p_segment15                  =>p_segment15,
816             p_segment16                  =>p_segment16,
817             p_segment17                  =>p_segment17,
818             p_segment18                  =>p_segment18,
819             p_segment19                  =>p_segment19,
820             p_segment20                  =>p_segment20,
821             p_segment21                  =>p_segment21,
822             p_segment22                  =>p_segment22,
823             p_segment23                  =>p_segment23,
824             p_segment24                  =>p_segment24,
825             p_segment25                  =>p_segment25,
826             p_segment26                  =>p_segment26,
827             p_segment27                  =>p_segment27,
828             p_segment28                  =>p_segment28,
829             p_segment29                  =>p_segment29,
830             p_segment30                  =>p_segment30);
831     --
832     --
833     elsif p_dml_mode = 'INSERT' then
834 
835 
836   --
837   -- insert flexfield segment
838   --
839 
840   l_ccid :=
841 	  hr_entry.maintain_cost_keyflex(
842             p_cost_keyflex_structure     => l_id_flex_num,
843             p_cost_allocation_keyflex_id => l_ccid,
844             p_concatenated_segments      => NULL,
845             p_summary_flag               =>'N',
846             p_start_date_active          => NULL,
847             p_end_date_active            => NULL,
848             p_segment1                   =>p_segment1,
849             p_segment2                   =>p_segment2,
850             p_segment3                   =>p_segment3,
851             p_segment4                   =>p_segment4,
852             p_segment5                   =>p_segment5,
853             p_segment6                   =>p_segment6,
854             p_segment7                   =>p_segment7,
855             p_segment8                   =>p_segment8,
856             p_segment9                   =>p_segment9,
857             p_segment10                  =>p_segment10,
858             p_segment11                  =>p_segment11,
859             p_segment12                  =>p_segment12,
860             p_segment13                  =>p_segment13,
861             p_segment14                  =>p_segment14,
862             p_segment15                  =>p_segment15,
863             p_segment16                  =>p_segment16,
864             p_segment17                  =>p_segment17,
865             p_segment18                  =>p_segment18,
866             p_segment19                  =>p_segment19,
867             p_segment20                  =>p_segment20,
868             p_segment21                  =>p_segment21,
869             p_segment22                  =>p_segment22,
870             p_segment23                  =>p_segment23,
871             p_segment24                  =>p_segment24,
872             p_segment25                  =>p_segment25,
873             p_segment26                  =>p_segment26,
874             p_segment27                  =>p_segment27,
875             p_segment28                  =>p_segment28,
876             p_segment29                  =>p_segment29,
877             p_segment30                  =>p_segment30);
878   --
879   --
880   end if;
881   p_ccid := l_ccid;
882 
883 
884   open csr_get_concat_segments(p_ccid);
885     fetch csr_get_concat_segments into p_concat_segments_out;
886     close csr_get_concat_segments;
887 
888 
889 exception
890     when app_exception.application_exception then
891       hr_message.provide_error;
892        hr_utility.raise_error;
893 
894 end keyflex_comb;
895 --
896 --
897 -- ----------------------------------------------------------------------------
898 -- |-----------------------------< get_flex_segs >----------------------------|
899 -- ----------------------------------------------------------------------------
900 
901 
902 procedure get_flex_segs
903 (
904 p_rec  in out nocopy g_rec_type
905 )
906 is
907 
908 
909 cursor csr_get_segs(c_ccid pay_batch_lines.cost_allocation_keyflex_id%type ) is
910     select segment1,segment2,segment3,segment4,segment5,segment6,segment7,segment8,segment9,
911            segment10,segment11,segment12,segment13,segment14,segment15,segment16,segment17,
912            segment18,segment19,segment20,segment21,segment22,segment23,segment24,segment25,
913            segment26,segment27,segment28,segment29,segment30
914      from pay_cost_allocation_keyflex
915      where cost_allocation_keyflex_id = c_ccid;
916 
917 l_new_segments segment_value;
918 begin
919 
920 open csr_get_segs( p_rec.cost_allocation_keyflex_id );
921 fetch csr_get_segs into         p_rec.segment1,
922                                 p_rec.segment2,
923                                 p_rec.segment3,
924                                 p_rec.segment4,
925                                 p_rec.segment5,
926                                 p_rec.segment6,
927                                 p_rec.segment7,
928                                 p_rec.segment8,
929                                 p_rec.segment9,
930                                 p_rec.segment10,
931                                 p_rec.segment11,
932                                 p_rec.segment12,
933                                 p_rec.segment13,
934                                 p_rec.segment14,
935                                 p_rec.segment15,
936                                 p_rec.segment16,
937                                 p_rec.segment17,
938                                 p_rec.segment18,
939                                 p_rec.segment19,
940                                 p_rec.segment20,
941                                 p_rec.segment21,
942                                 p_rec.segment22,
943                                 p_rec.segment23,
944                                 p_rec.segment24,
945                                 p_rec.segment25,
946                                 p_rec.segment26,
947                                 p_rec.segment27,
948                                 p_rec.segment28,
949                                 p_rec.segment29,
950                                 p_rec.segment30;
951 close csr_get_segs;
952 end get_flex_segs;
953 --
954 end pay_btl_shd;
955