DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_EXA_UPD

Source


1 PACKAGE BODY pay_exa_upd AS
2 /* $Header: pyexarhi.pkb 115.13 2003/09/26 06:48:50 tvankayl ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_exa_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< update_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml update logic. The functions of this
17 --   procedure are as follows:
18 --   1) Increment the object_version_number by 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   2) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To update the specified row in the schema using the primary key in
23 --      the predicates.
24 --   4) To trap any constraint violations that may have occurred.
25 --   5) To raise any other errors.
26 --
27 -- Pre Conditions:
28 --   This is an internal private procedure which must be called from the upd
29 --   procedure.
30 --
31 -- In Arguments:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be updated in the schema.
36 --
37 -- Post Failure:
38 --   On the update dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   The update 'set' arguments list should be modified if any of your
47 --   attributes are not updateable.
48 --
49 -- Access Status:
50 --   Internal Table Handler Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 procedure update_dml(
55    p_rec in out nocopy pay_exa_shd.g_rec_type
56    ) is
57   --
58   l_proc  varchar2(72) := g_package||'update_dml';
59   --
60 begin
61   hr_utility.set_location('Entering:'||l_proc, 5);
62   pay_exa_shd.g_api_dml := true;  -- set the api dml status
63   --
64   -- update_validate(), chk_territory_code(), pay_exa_shd.api_updating()
65   -- has been called,
66   -- this selects a row into g_old_rec and returns true if the PK value
67   -- passed in matches a row on the db,
68   -- nb. no locking is done
69   --
70   pay_exa_shd.lck
71     (p_rec.external_account_id,
72      p_rec.object_version_number);
73   --
74   -- only do U if values have changed
75   --
76   if ( nvl(p_rec.territory_code, hr_api.g_varchar2) <>
77        nvl(pay_exa_shd.g_old_rec.territory_code, hr_api.g_varchar2) )
78        or
79      ( nvl(p_rec.prenote_date, hr_api.g_date) <>
80        nvl(pay_exa_shd.g_old_rec.prenote_date, hr_api.g_date) ) then
81     hr_utility.trace('| doing update on combination table');
82     --
83     -- fresh combination record
84     --
85     if ( pay_exa_shd.g_old_rec.territory_code is null ) then
86       hr_utility.trace('| updating territory_code');
87       --
88       UPDATE PAY_EXTERNAL_ACCOUNTS
89       SET    territory_code = p_rec.territory_code
90       WHERE  external_account_id = p_rec.external_account_id
91       ;
92     end if;
93     ------------------------------------------------------------------------
94     -- bug2307154 changes for prenote_date
95     ------------------------------------------------------------------------
96     --
97     -- Check for defaulted prenote_date.
98     --
99     if p_rec.prenote_date = hr_api.g_date then
100       hr_utility.trace('| not updating prenote_date (default passed in)');
101       --
102       -- No change to be made: existing combination's date is not updated,
103       -- and fresh combination must have date clear (for prenotification to
104       -- take place).
105       --
106       null;
107     elsif ( nvl(p_rec.prenote_date, hr_api.g_date) <>
108          nvl(pay_exa_shd.g_old_rec.prenote_date, hr_api.g_date) ) then
109       hr_utility.trace('| updating prenote_date');
110       --
111       UPDATE PAY_EXTERNAL_ACCOUNTS
112       SET    prenote_date = p_rec.prenote_date
113       WHERE  external_account_id = p_rec.external_account_id
114       ;
115     end if;
116     --
117     -- U has occurred, increment object version number
118     --
119     UPDATE PAY_EXTERNAL_ACCOUNTS
120     SET    object_version_number = nvl(object_version_number, 0) + 1
121     WHERE  external_account_id = p_rec.external_account_id
122     ;
123   end if;
124   --
125   pay_exa_shd.g_api_dml := false;   -- unset the api dml status
126   --
127   hr_utility.set_location(' Leaving:'||l_proc, 10);
128 --
129 Exception
130   When hr_api.check_integrity_violated Then
131     -- A check constraint has been violated
132     pay_exa_shd.g_api_dml := false;   -- Unset the api dml status
133     pay_exa_shd.constraint_error
134       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
135   When hr_api.parent_integrity_violated Then
136     -- Parent integrity has been violated
137     pay_exa_shd.g_api_dml := false;   -- Unset the api dml status
138     pay_exa_shd.constraint_error
139       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
140   When hr_api.unique_integrity_violated Then
141     -- Unique integrity has been violated
142     pay_exa_shd.g_api_dml := false;   -- Unset the api dml status
143     pay_exa_shd.constraint_error
144       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
145   When Others Then
146     pay_exa_shd.g_api_dml := false;   -- Unset the api dml status
147     Raise;
148 end update_dml;
149 --
150 -- ----------------------------------------------------------------------------
151 -- |------------------------------< pre_update >------------------------------|
152 -- ----------------------------------------------------------------------------
153 -- {Start Of Comments}
154 --
155 -- Description:
156 --   This private procedure contains any processing which is required before
157 --   the update dml.
158 --
159 -- Pre Conditions:
160 --   This is an internal procedure which is called from the upd procedure.
161 --
162 -- In Arguments:
163 --   A Pl/Sql record structre.
164 --
165 -- Post Success:
166 --   Processing continues.
167 --
168 -- Post Failure:
169 --   If an error has occurred, an error message and exception will be raised
170 --   but not handled.
171 --
172 -- Developer Implementation Notes:
173 --   Any pre-processing required before the update dml is issued should be
174 --   coded within this procedure. It is important to note that any 3rd party
175 --   maintenance should be reviewed before placing in this procedure.
176 --
177 -- Access Status:
178 --   Internal Table Handler Use Only.
179 --
180 -- {End Of Comments}
181 -- ----------------------------------------------------------------------------
182 procedure pre_update(
183    p_rec in pay_exa_shd.g_rec_type
184    ) is
185   --
186   l_proc  varchar2(72) := g_package||'pre_update';
187   --
188 begin
189   hr_utility.set_location('Entering:'||l_proc, 5);
190   --
191   hr_utility.set_location(' Leaving:'||l_proc, 10);
192 end pre_update;
193 --
194 -- ----------------------------------------------------------------------------
195 -- |-----------------------------< post_update >------------------------------|
196 -- ----------------------------------------------------------------------------
197 -- {Start Of Comments}
198 --
199 -- Description:
200 --   This private procedure contains any processing which is required after the
201 --   update dml.
202 --
203 -- Pre Conditions:
204 --   This is an internal procedure which is called from the upd procedure.
205 --
206 -- In Arguments:
207 --   A Pl/Sql record structre.
208 --
209 -- Post Success:
210 --   Processing continues.
211 --
212 -- Post Failure:
213 --   If an error has occurred, an error message and exception will be raised
214 --   but not handled.
215 --
216 -- Developer Implementation Notes:
217 --   Any post-processing required after the update dml is issued should be
218 --   coded within this procedure. It is important to note that any 3rd party
219 --   maintenance should be reviewed before placing in this procedure.
220 --
221 -- Access Status:
222 --   Internal Table Handler Use Only.
223 --
224 -- {End Of Comments}
225 -- ----------------------------------------------------------------------------
226 procedure post_update(
227    p_rec in pay_exa_shd.g_rec_type
228    ) is
229 --
230   l_proc  varchar2(72) := g_package||'post_update';
231 --
232 Begin
233   hr_utility.set_location('Entering:'||l_proc, 5);
234   --
235   hr_utility.set_location(' Leaving:'||l_proc, 10);
236 end post_update;
237 --
238 -- ----------------------------------------------------------------------------
239 -- |-----------------------------< convert_defs >-----------------------------|
240 -- ----------------------------------------------------------------------------
241 procedure convert_defs(
242    p_rec in out nocopy pay_exa_shd.g_rec_type
243    ) is
244 --
245   l_proc  varchar2(72) := g_package||'convert_defs';
246 --
247 Begin
248   --
249   hr_utility.set_location('Entering:'||l_proc, 5);
250   --
251   -- we must now examine each argument value in the p_rec plsql record
252   -- structure to see if a system default is being used,
253   -- if a system default is being used then we must set to the 'current'
254   -- argument value
255   --
256   If (p_rec.territory_code = hr_api.g_varchar2) then
257     p_rec.territory_code :=
258     pay_exa_shd.g_old_rec.territory_code;
259   End If;
260   --------------------------------------------------------------------------
261   -- bug2307154: do not convert prenote_date if it has been defaulted.
262   --
263   -- If p_prenote_date is defaulted (hr_api.g_varchar2) then no change if
264   -- the update results in an existing flex combination. If the update
265   -- results in a fresh combination the prenote date remains as NULL
266   -- (bug1776298) as prenotification must be done on fresh bank details.
267   --
268   -- Note: this is a deviation from the API strategy as convert_defs will
269   -- not convert a defaulted prenote date value, and the update logic
270   -- will look for hr_api.g_date when it handles the prenote_date.
271   --------------------------------------------------------------------------
272   If (p_rec.id_flex_num = hr_api.g_number) then
273     p_rec.id_flex_num :=
274     pay_exa_shd.g_old_rec.id_flex_num;
275   End If;
276   If (p_rec.summary_flag = hr_api.g_varchar2) then
277     p_rec.summary_flag :=
278     pay_exa_shd.g_old_rec.summary_flag;
279   End If;
280   If (p_rec.enabled_flag = hr_api.g_varchar2) then
281     p_rec.enabled_flag :=
282     pay_exa_shd.g_old_rec.enabled_flag;
283   End If;
284   If (p_rec.start_date_active = hr_api.g_date) then
285     p_rec.start_date_active :=
286     pay_exa_shd.g_old_rec.start_date_active;
287   End If;
288   If (p_rec.end_date_active = hr_api.g_date) then
289     p_rec.end_date_active :=
290     pay_exa_shd.g_old_rec.end_date_active;
291   End If;
292   If (p_rec.segment1 = hr_api.g_varchar2) then
293     p_rec.segment1 :=
294     pay_exa_shd.g_old_rec.segment1;
295   End If;
296   If (p_rec.segment2 = hr_api.g_varchar2) then
297     p_rec.segment2 :=
298     pay_exa_shd.g_old_rec.segment2;
299   End If;
300   If (p_rec.segment3 = hr_api.g_varchar2) then
301     p_rec.segment3 :=
302     pay_exa_shd.g_old_rec.segment3;
303   End If;
304   If (p_rec.segment4 = hr_api.g_varchar2) then
305     p_rec.segment4 :=
306     pay_exa_shd.g_old_rec.segment4;
307   End If;
308   If (p_rec.segment5 = hr_api.g_varchar2) then
309     p_rec.segment5 :=
310     pay_exa_shd.g_old_rec.segment5;
311   End If;
312   If (p_rec.segment6 = hr_api.g_varchar2) then
313     p_rec.segment6 :=
314     pay_exa_shd.g_old_rec.segment6;
315   End If;
316   If (p_rec.segment7 = hr_api.g_varchar2) then
317     p_rec.segment7 :=
318     pay_exa_shd.g_old_rec.segment7;
319   End If;
320   If (p_rec.segment8 = hr_api.g_varchar2) then
321     p_rec.segment8 :=
322     pay_exa_shd.g_old_rec.segment8;
323   End If;
324   If (p_rec.segment9 = hr_api.g_varchar2) then
325     p_rec.segment9 :=
326     pay_exa_shd.g_old_rec.segment9;
327   End If;
328   If (p_rec.segment10 = hr_api.g_varchar2) then
329     p_rec.segment10 :=
330     pay_exa_shd.g_old_rec.segment10;
331   End If;
332   If (p_rec.segment11 = hr_api.g_varchar2) then
333     p_rec.segment11 :=
334     pay_exa_shd.g_old_rec.segment11;
335   End If;
336   If (p_rec.segment12 = hr_api.g_varchar2) then
337     p_rec.segment12 :=
338     pay_exa_shd.g_old_rec.segment12;
339   End If;
340   If (p_rec.segment13 = hr_api.g_varchar2) then
341     p_rec.segment13 :=
342     pay_exa_shd.g_old_rec.segment13;
343   End If;
344   If (p_rec.segment14 = hr_api.g_varchar2) then
345     p_rec.segment14 :=
346     pay_exa_shd.g_old_rec.segment14;
347   End If;
348   If (p_rec.segment15 = hr_api.g_varchar2) then
349     p_rec.segment15 :=
350     pay_exa_shd.g_old_rec.segment15;
351   End If;
352   If (p_rec.segment16 = hr_api.g_varchar2) then
353     p_rec.segment16 :=
354     pay_exa_shd.g_old_rec.segment16;
355   End If;
356   If (p_rec.segment17 = hr_api.g_varchar2) then
357     p_rec.segment17 :=
358     pay_exa_shd.g_old_rec.segment17;
359   End If;
360   If (p_rec.segment18 = hr_api.g_varchar2) then
361     p_rec.segment18 :=
362     pay_exa_shd.g_old_rec.segment18;
363   End If;
364   If (p_rec.segment19 = hr_api.g_varchar2) then
365     p_rec.segment19 :=
366     pay_exa_shd.g_old_rec.segment19;
367   End If;
368   If (p_rec.segment20 = hr_api.g_varchar2) then
369     p_rec.segment20 :=
370     pay_exa_shd.g_old_rec.segment20;
371   End If;
372   If (p_rec.segment21 = hr_api.g_varchar2) then
373     p_rec.segment21 :=
374     pay_exa_shd.g_old_rec.segment21;
375   End If;
376   If (p_rec.segment22 = hr_api.g_varchar2) then
377     p_rec.segment22 :=
378     pay_exa_shd.g_old_rec.segment22;
379   End If;
380   If (p_rec.segment23 = hr_api.g_varchar2) then
381     p_rec.segment23 :=
382     pay_exa_shd.g_old_rec.segment23;
383   End If;
384   If (p_rec.segment24 = hr_api.g_varchar2) then
385     p_rec.segment24 :=
386     pay_exa_shd.g_old_rec.segment24;
387   End If;
388   If (p_rec.segment25 = hr_api.g_varchar2) then
389     p_rec.segment25 :=
390     pay_exa_shd.g_old_rec.segment25;
391   End If;
392   If (p_rec.segment26 = hr_api.g_varchar2) then
393     p_rec.segment26 :=
394     pay_exa_shd.g_old_rec.segment26;
395   End If;
396   If (p_rec.segment27 = hr_api.g_varchar2) then
397     p_rec.segment27 :=
398     pay_exa_shd.g_old_rec.segment27;
399   End If;
400   If (p_rec.segment28 = hr_api.g_varchar2) then
401     p_rec.segment28 :=
402     pay_exa_shd.g_old_rec.segment28;
403   End If;
404   If (p_rec.segment29 = hr_api.g_varchar2) then
405     p_rec.segment29 :=
406     pay_exa_shd.g_old_rec.segment29;
407   End If;
408   If (p_rec.segment30 = hr_api.g_varchar2) then
409     p_rec.segment30 :=
410     pay_exa_shd.g_old_rec.segment30;
411   End If;
412   --
413   hr_utility.set_location(' Leaving:'||l_proc, 10);
414 end convert_defs;
415 --
416 -- ----------------------------------------------------------------------------
417 -- |---------------------------------< upd >----------------------------------|
418 -- ----------------------------------------------------------------------------
419 procedure upd(
420    p_rec        in out nocopy pay_exa_shd.g_rec_type
421   ,p_validate   in     boolean default false
422   ) is
423   --
424   l_proc  varchar2(72) := g_package||'upd';
425   --
426 begin
427   hr_utility.set_location('Entering:'||l_proc, 5);
428   --
429   -- determine if the business process is to be validated
430   --
431   If p_validate then
432     --
433     -- issue the savepoint
434     --
435     SAVEPOINT upd_pay_exa;
436   End If;
437   --
438   -- we must lock the row which we need to update
439   --
440   pay_exa_shd.lck
441     (p_rec.external_account_id,
442      p_rec.object_version_number);
443   --
444   -- stub - not sure if this is necessary as other parameters are
445   --        not used by U logic
446   --
447   pay_exa_upd.convert_defs(p_rec);
448   pay_exa_bus.update_validate(p_rec);
449   --
450   -- call the supporting pre-update operation
451   --
452   pre_update(p_rec);
453   --
454   -- update the row.
455   --
456   update_dml(p_rec);
457   --
458   -- call the supporting post-update operation
459   --
460   post_update(p_rec);
461   --
462   -- if we are validating then raise the Validate_Enabled exception
463   --
464   If p_validate then
465     Raise HR_Api.Validate_Enabled;
466   End If;
467   --
468   hr_utility.set_location(' Leaving:'||l_proc, 10);
469 Exception
470   When HR_Api.Validate_Enabled Then
471     --
472     -- As the Validate_Enabled exception has been raised
473     -- we must rollback to the savepoint
474     --
475     ROLLBACK TO upd_pay_exa;
476 end upd;
477 --
478 -- ----------------------------------------------------------------------------
479 -- |---------------------------------< upd >----------------------------------|
480 -- ----------------------------------------------------------------------------
481 procedure upd(
482    p_external_account_id          in number
483   ,p_territory_code               in varchar2
484   ,p_prenote_date                 in date             default hr_api.g_date
485   ,p_object_version_number        in out nocopy number
486   ,p_validate                     in boolean          default false
487   ) is
488   --
489   l_rec   pay_exa_shd.g_rec_type;
490   l_proc  varchar2(72) := g_package||'upd';
491   --
492   cursor csr_ovn(p_external_account_id number) is
493     SELECT pea.object_version_number
494     FROM   PAY_EXTERNAL_ACCOUNTS pea
495     WHERE  pea.external_account_id = p_external_account_id
496     ;
497   --
498 begin
499   hr_utility.set_location('Entering:'||l_proc, 5);
500   --
501   -- call conversion function to turn arguments into the l_rec structure,
502   -- nb. only parameters used by U logic are set
503   --
504   l_rec :=
505   pay_exa_shd.convert_args(
506     p_external_account_id         => p_external_account_id,
507     p_territory_code              => p_territory_code,
508     p_prenote_date                => p_prenote_date,
509     p_id_flex_num                 => null,
510     p_summary_flag                => null,
511     p_enabled_flag                => null,
512     p_start_date_active           => null,
513     p_end_date_active             => null,
514     p_segment1                    => null,
515     p_segment2                    => null,
516     p_segment3                    => null,
517     p_segment4                    => null,
518     p_segment5                    => null,
519     p_segment6                    => null,
520     p_segment7                    => null,
521     p_segment8                    => null,
522     p_segment9                    => null,
523     p_segment10                   => null,
524     p_segment11                   => null,
525     p_segment12                   => null,
526     p_segment13                   => null,
527     p_segment14                   => null,
528     p_segment15                   => null,
529     p_segment16                   => null,
530     p_segment17                   => null,
531     p_segment18                   => null,
532     p_segment19                   => null,
533     p_segment20                   => null,
534     p_segment21                   => null,
535     p_segment22                   => null,
536     p_segment23                   => null,
537     p_segment24                   => null,
538     p_segment25                   => null,
539     p_segment26                   => null,
540     p_segment27                   => null,
541     p_segment28                   => null,
542     p_segment29                   => null,
543     p_segment30                   => null,
544     p_object_version_number       => p_object_version_number
545     );
546   --
547   -- having converted the arguments into the plsql record structure we
548   -- call the corresponding record business process
549   --
550   upd(l_rec, p_validate);
551   --p_object_version_number := l_rec.object_version_number;
552   --
553   -- object version number may have changed,
554   -- select the latest value and pass as out paramter
555   --
556   open  csr_ovn(l_rec.external_account_id);
557   fetch csr_ovn into p_object_version_number;
558   close csr_ovn;
559   --
560   hr_utility.set_location(' Leaving:'||l_proc, 10);
561 end upd;
562 --
563 -- ----------------------------------------------------------------------------
564 -- |-------------------------------< upd_or_sel >-----------------------------|
565 -- ----------------------------------------------------------------------------
566 procedure upd_or_sel(
567    p_segment1              in     varchar2 default hr_api.g_varchar2
568   ,p_segment2              in     varchar2 default hr_api.g_varchar2
569   ,p_segment3              in     varchar2 default hr_api.g_varchar2
570   ,p_segment4              in     varchar2 default hr_api.g_varchar2
571   ,p_segment5              in     varchar2 default hr_api.g_varchar2
572   ,p_segment6              in     varchar2 default hr_api.g_varchar2
573   ,p_segment7              in     varchar2 default hr_api.g_varchar2
574   ,p_segment8              in     varchar2 default hr_api.g_varchar2
575   ,p_segment9              in     varchar2 default hr_api.g_varchar2
576   ,p_segment10             in     varchar2 default hr_api.g_varchar2
577   ,p_segment11             in     varchar2 default hr_api.g_varchar2
578   ,p_segment12             in     varchar2 default hr_api.g_varchar2
579   ,p_segment13             in     varchar2 default hr_api.g_varchar2
580   ,p_segment14             in     varchar2 default hr_api.g_varchar2
581   ,p_segment15             in     varchar2 default hr_api.g_varchar2
582   ,p_segment16             in     varchar2 default hr_api.g_varchar2
583   ,p_segment17             in     varchar2 default hr_api.g_varchar2
584   ,p_segment18             in     varchar2 default hr_api.g_varchar2
585   ,p_segment19             in     varchar2 default hr_api.g_varchar2
586   ,p_segment20             in     varchar2 default hr_api.g_varchar2
587   ,p_segment21             in     varchar2 default hr_api.g_varchar2
588   ,p_segment22             in     varchar2 default hr_api.g_varchar2
589   ,p_segment23             in     varchar2 default hr_api.g_varchar2
590   ,p_segment24             in     varchar2 default hr_api.g_varchar2
591   ,p_segment25             in     varchar2 default hr_api.g_varchar2
592   ,p_segment26             in     varchar2 default hr_api.g_varchar2
593   ,p_segment27             in     varchar2 default hr_api.g_varchar2
594   ,p_segment28             in     varchar2 default hr_api.g_varchar2
595   ,p_segment29             in     varchar2 default hr_api.g_varchar2
596   ,p_segment30             in     varchar2 default hr_api.g_varchar2
597   ,p_concat_segments       in     varchar2 default null
598   ,p_business_group_id     in     number
599 -- make territory_code code a mandatory parameter on U interface
600   ,p_territory_code        in     varchar2
601   ,p_prenote_date          in     date     default hr_api.g_date
602   ,p_external_account_id   in out nocopy number
603   ,p_object_version_number in out nocopy number
604   ,p_validate              in     boolean  default false
605   ) is
606   --
607   l_proc          varchar2(72) := g_package||'upd_or_sel';
608   l_rec           pay_exa_shd.g_rec_type;
609   l_concat_segments_out varchar2(4600);
610   l_external_account_id_init   pay_external_accounts.external_account_id%type;
611   l_prenote_date               pay_external_accounts.prenote_date%type;
612   l_object_version_number_init pay_external_accounts.object_version_number%type;
613   --
614 begin
615   hr_utility.set_location('***** Entering:' || l_proc || ' *****', 5);
616   --
617   -- store initial value of IN OUT paramters,
618   -- set back to IN state if validate only is true
619   --
620   l_external_account_id_init := p_external_account_id;
621   l_object_version_number_init := p_object_version_number;
622 
623   --
624   -- stub - do we need to validate prenote_date,
625   --        could be null ?
626   --
627 
628   --
629   -- may still need to set territory code incase fresh combination
630   -- record is being I'ed
631   --
632   hr_api.mandatory_arg_error(
633     p_api_name          => l_proc,
634     p_argument          => 'territory_code',
635     p_argument_value    => p_territory_code
636     );
637 
638   --
639   -- convert args into record format
640   --
641   l_rec :=
642     pay_exa_shd.convert_args(
643       p_external_account_id,
644       p_territory_code,
645       p_prenote_date,
646       --
647       -- use system defaults so that pay_exa_upd.convert_defs()
648       -- will convert the components to their current db values
649       --
650       hr_api.g_number,    -- id_flex_num
651       hr_api.g_varchar2,  -- summary_flag
652       hr_api.g_varchar2,  -- enabled_flag
653       hr_api.g_date,      -- start_date_active
654       hr_api.g_date,      -- end_date_active
655       --
656       p_segment1,
657       p_segment2,
658       p_segment3,
659       p_segment4,
660       p_segment5,
661       p_segment6,
662       p_segment7,
663       p_segment8,
664       p_segment9,
665       p_segment10,
666       p_segment11,
667       p_segment12,
668       p_segment13,
669       p_segment14,
670       p_segment15,
671       p_segment16,
672       p_segment17,
673       p_segment18,
674       p_segment19,
675       p_segment20,
676       p_segment21,
677       p_segment22,
678       p_segment23,
679       p_segment24,
680       p_segment25,
681       p_segment26,
682       p_segment27,
683       p_segment28,
684       p_segment29,
685       p_segment30,
686       p_object_version_number);
687 
688   --
689   -- nb. at this point id_flex_num, summary_flag, enabled_flag,
690   -- start_date_active and end_date_active have system defaulted
691   -- values in l_rec
692   --
693 
694   --
695   -- ccid passed in must always point to a combination row,
696   -- ie. a row in PAY_EXTERNAL_ACCOUNTS,
697   --
698   -- if segments1 ... 30 are changed, then we may be I'ing a
699   -- new combination row or changing the ccid to point to an
700   -- existing row
701   --
702 
703   --
704   -- always true,
705   -- used to populate g_old_rec
706   --
707   if pay_exa_shd.api_updating
708       (p_external_account_id   => l_rec.external_account_id,
709        p_object_version_number => l_rec.object_version_number) then
710     --
711     -- copy any system defaulted values from db row(g_old_rec) into l_rec
712     --
713     pay_exa_upd.convert_defs(p_rec => l_rec);
714   end if;
715 
716   --
717   -- nb. at this point id_flex_num, summary_flag, enabled_flag,
718   -- start_date_active and end_date_active have values
719   -- as on the db
720   --
721 
722   --
723   -- call wrapper,
724   -- generates formatted msg upon segement validation failure
725   --
726   pay_exa_shd.keyflex_comb(
727     p_dml_mode               => 'UPDATE',
728     p_business_group_id      => p_business_group_id,
729     p_appl_short_name        => 'PAY',
730     p_territory_code         => p_territory_code,
731     p_flex_code              => 'BANK',
732     p_segment1               => l_rec.segment1,
733     p_segment2               => l_rec.segment2,
734     p_segment3               => l_rec.segment3,
735     p_segment4               => l_rec.segment4,
736     p_segment5               => l_rec.segment5,
737     p_segment6               => l_rec.segment6,
738     p_segment7               => l_rec.segment7,
739     p_segment8               => l_rec.segment8,
740     p_segment9               => l_rec.segment9,
741     p_segment10              => l_rec.segment10,
742     p_segment11              => l_rec.segment11,
743     p_segment12              => l_rec.segment12,
744     p_segment13              => l_rec.segment13,
745     p_segment14              => l_rec.segment14,
746     p_segment15              => l_rec.segment15,
747     p_segment16              => l_rec.segment16,
748     p_segment17              => l_rec.segment17,
749     p_segment18              => l_rec.segment18,
750     p_segment19              => l_rec.segment19,
751     p_segment20              => l_rec.segment20,
752     p_segment21              => l_rec.segment21,
753     p_segment22              => l_rec.segment22,
754     p_segment23              => l_rec.segment23,
755     p_segment24              => l_rec.segment24,
756     p_segment25              => l_rec.segment25,
757     p_segment26              => l_rec.segment26,
758     p_segment27              => l_rec.segment27,
759     p_segment28              => l_rec.segment28,
760     p_segment29              => l_rec.segment29,
761     p_segment30              => l_rec.segment30,
762     p_concat_segments_in     => p_concat_segments,
763     --
764     -- OUT parameter,
765     -- l_rec.external_account_id may have a new value
766     --
767     p_ccid                   => l_rec.external_account_id,
768     p_concat_segments_out    => l_concat_segments_out
769     );
770   --
771   -- nb. object_version_number is a IN OUT parameter,
772   -- territory code is mandatory parameter,
773   -- update_validate() calls chk_territory_code()
774   -- to check that territory code is not mutating,
775   -- however if a fresh combination record has been I'ed then this
776   -- parameter is used to set territory code on the new record
777   --
778   upd(
779     l_rec.external_account_id,
780     l_rec.territory_code,
781     l_rec.prenote_date,
782     l_rec.object_version_number,
783     p_validate);
784   --
785   -- set the out arguments
786   --
787   p_external_account_id   := l_rec.external_account_id;
788   p_object_version_number := l_rec.object_version_number;
789   --
790   -- if in validate only mode restore IN OUT parameters to their initial state
791   --
792   if p_validate then
793     p_external_account_id := l_external_account_id_init;
794     p_object_version_number := l_object_version_number_init;
795   end if;
796   --
797   hr_utility.set_location('***** Leaving:' || l_proc || ' *****', 20);
798 end upd_or_sel;
799 --
800 END pay_exa_upd;