DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_ALIEN_TRANS_DATA_API

Source


1 Package Body pqp_alien_trans_data_api as
2 /* $Header: pqatdapi.pkb 115.6 2003/01/22 00:54:14 tmehra ship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  pqp_alien_trans_data_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |------------------------< create_alien_trans_data >----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_alien_trans_data
13   (p_validate                       in  boolean   default false
14   ,p_alien_transaction_id           out nocopy number
15   ,p_person_id                      in  number    default null
16   ,p_data_source_type               in  varchar2  default null
17   ,p_tax_year                       in  number    default null
18   ,p_income_code                    in  varchar2  default null
19   ,p_withholding_rate               in  number    default null
20   ,p_income_code_sub_type           in  varchar2  default null
21   ,p_exemption_code                 in  varchar2  default null
22   ,p_maximum_benefit_amount         in  number    default null
23   ,p_retro_lose_ben_amt_flag        in  varchar2  default null
24   ,p_date_benefit_ends              in  date      default null
25   ,p_retro_lose_ben_date_flag       in  varchar2  default null
26   ,p_current_residency_status       in  varchar2  default null
27   ,p_nra_to_ra_date                 in  date      default null
28   ,p_target_departure_date          in  date      default null
29   ,p_tax_residence_country_code     in  varchar2  default null
30   ,p_treaty_info_update_date        in  date      default null
31   ,p_nra_exempt_from_fica           in  varchar2  default null
32   ,p_student_exempt_from_fica       in  varchar2  default null
33   ,p_addl_withholding_flag          in  varchar2  default null
34   ,p_addl_withholding_amt           in  number    default null
35   ,p_addl_wthldng_amt_period_type   in  varchar2  default null
36   ,p_personal_exemption             in  number    default null
37   ,p_addl_exemption_allowed         in  number    default null
38   ,p_number_of_days_in_usa          in  number    default null
39   ,p_wthldg_allow_eligible_flag     in  varchar2  default null
40   ,p_treaty_ben_allowed_flag        in  varchar2  default null
41   ,p_treaty_benefits_start_date     in  date      default null
42   ,p_ra_effective_date              in  date      default null
43   ,p_state_code                     in  varchar2  default null
44   ,p_state_honors_treaty_flag       in  varchar2  default null
45   ,p_ytd_payments                   in  number    default null
46   ,p_ytd_w2_payments                in  number    default null
47   ,p_ytd_w2_withholding             in  number    default null
48   ,p_ytd_withholding_allowance      in  number    default null
49   ,p_ytd_treaty_payments            in  number    default null
50   ,p_ytd_treaty_withheld_amt        in  number    default null
51   ,p_record_source                  in  varchar2  default null
52   ,p_visa_type                      in  varchar2  default null
53   ,p_j_sub_type                     in  varchar2  default null
54   ,p_primary_activity               in  varchar2  default null
55   ,p_non_us_country_code            in  varchar2  default null
56   ,p_citizenship_country_code       in  varchar2  default null
57   ,p_constant_addl_tax              in  number    default null
58   ,p_date_8233_signed               in  date      default null
59   ,p_date_w4_signed                 in  date      default null
60   ,p_error_indicator                in  varchar2  default null
61   ,p_prev_er_treaty_benefit_amt     in  number    default null
62   ,p_error_text                     in  varchar2  default null
63   ,p_object_version_number          out nocopy number
64   ,p_effective_date                 in  date
65   ,p_current_analysis               in  varchar2  default null
66   ,p_forecast_income_code           in  varchar2  default null
67   ) is
68   --
69   -- Declare cursors and local variables
70   --
71   l_alien_transaction_id pqp_alien_transaction_data.alien_transaction_id%TYPE;
72   l_proc varchar2(72) := g_package||'create_alien_trans_data';
73   l_object_version_number pqp_alien_transaction_data.object_version_number%TYPE;
74   --
75 begin
76   --
77   hr_utility.set_location('Entering:'|| l_proc, 10);
78   --
79   -- Issue a savepoint if operating in validation only mode
80   --
81   savepoint create_alien_trans_data;
82   --
83   hr_utility.set_location(l_proc, 20);
84   --
85   -- Process Logic
86   --
87   begin
88     --
89     -- Start of API User Hook for the before hook of create_alien_trans_data
90     --
91     pqp_alien_trans_data_bk1.create_alien_trans_data_b
92       (
93        p_person_id                      =>  p_person_id
94       ,p_data_source_type               =>  p_data_source_type
95       ,p_tax_year                       =>  p_tax_year
96       ,p_income_code                    =>  p_income_code
97       ,p_withholding_rate               =>  p_withholding_rate
98       ,p_income_code_sub_type           =>  p_income_code_sub_type
99       ,p_exemption_code                 =>  p_exemption_code
100       ,p_maximum_benefit_amount         =>  p_maximum_benefit_amount
101       ,p_retro_lose_ben_amt_flag        =>  p_retro_lose_ben_amt_flag
102       ,p_date_benefit_ends              =>  p_date_benefit_ends
103       ,p_retro_lose_ben_date_flag       =>  p_retro_lose_ben_date_flag
104       ,p_current_residency_status       =>  p_current_residency_status
105       ,p_nra_to_ra_date                 =>  p_nra_to_ra_date
106       ,p_target_departure_date          =>  p_target_departure_date
107       ,p_tax_residence_country_code     =>  p_tax_residence_country_code
108       ,p_treaty_info_update_date        =>  p_treaty_info_update_date
109       ,p_nra_exempt_from_fica           =>  p_nra_exempt_from_fica
110       ,p_student_exempt_from_fica       =>  p_student_exempt_from_fica
111       ,p_addl_withholding_flag          =>  p_addl_withholding_flag
112       ,p_addl_withholding_amt           =>  p_addl_withholding_amt
113       ,p_addl_wthldng_amt_period_type   =>  p_addl_wthldng_amt_period_type
114       ,p_personal_exemption             =>  p_personal_exemption
115       ,p_addl_exemption_allowed         =>  p_addl_exemption_allowed
116       ,p_number_of_days_in_usa          =>  p_number_of_days_in_usa
117       ,p_wthldg_allow_eligible_flag     =>  p_wthldg_allow_eligible_flag
118       ,p_treaty_ben_allowed_flag        =>  p_treaty_ben_allowed_flag
119       ,p_treaty_benefits_start_date     =>  p_treaty_benefits_start_date
120       ,p_ra_effective_date              =>  p_ra_effective_date
121       ,p_state_code                     =>  p_state_code
122       ,p_state_honors_treaty_flag       =>  p_state_honors_treaty_flag
123       ,p_ytd_payments                   =>  p_ytd_payments
124       ,p_ytd_w2_payments                =>  p_ytd_w2_payments
125       ,p_ytd_w2_withholding             =>  p_ytd_w2_withholding
126       ,p_ytd_withholding_allowance      =>  p_ytd_withholding_allowance
127       ,p_ytd_treaty_payments            =>  p_ytd_treaty_payments
128       ,p_ytd_treaty_withheld_amt        =>  p_ytd_treaty_withheld_amt
129       ,p_record_source                  =>  p_record_source
130       ,p_visa_type                      =>  p_visa_type
131       ,p_j_sub_type                     =>  p_j_sub_type
132       ,p_primary_activity               =>  p_primary_activity
133       ,p_non_us_country_code            =>  p_non_us_country_code
134       ,p_citizenship_country_code       =>  p_citizenship_country_code
135       ,p_constant_addl_tax              =>  p_constant_addl_tax
136       ,p_date_8233_signed               =>  p_date_8233_signed
137       ,p_date_w4_signed                 =>  p_date_w4_signed
138       ,p_error_indicator                =>  p_error_indicator
139       ,p_prev_er_treaty_benefit_amt     =>  p_prev_er_treaty_benefit_amt
140       ,p_error_text                     =>  p_error_text
141       ,p_effective_date                 =>  trunc(p_effective_date)
142       ,p_current_analysis               =>  p_current_analysis
143       ,p_forecast_income_code           =>  p_forecast_income_code
144       );
145   exception
146     when hr_api.cannot_find_prog_unit then
147       hr_api.cannot_find_prog_unit_error
148         (
149          p_module_name => 'CREATE_ALIEN_TRANS_DATA'
150         ,p_hook_type   => 'BP'
151         );
152     --
153     -- End of API User Hook for the before hook of create_alien_trans_data
154     --
155   end;
156   --
157   pqp_atd_ins.ins
158     (
159      p_alien_transaction_id          => l_alien_transaction_id
160     ,p_person_id                     => p_person_id
161     ,p_data_source_type              => p_data_source_type
162     ,p_tax_year                      => p_tax_year
163     ,p_income_code                   => p_income_code
164     ,p_withholding_rate              => p_withholding_rate
165     ,p_income_code_sub_type          => p_income_code_sub_type
166     ,p_exemption_code                => p_exemption_code
167     ,p_maximum_benefit_amount        => p_maximum_benefit_amount
168     ,p_retro_lose_ben_amt_flag       => p_retro_lose_ben_amt_flag
169     ,p_date_benefit_ends             => p_date_benefit_ends
170     ,p_retro_lose_ben_date_flag      => p_retro_lose_ben_date_flag
171     ,p_current_residency_status      => p_current_residency_status
172     ,p_nra_to_ra_date                => p_nra_to_ra_date
173     ,p_target_departure_date         => p_target_departure_date
174     ,p_tax_residence_country_code    => p_tax_residence_country_code
175     ,p_treaty_info_update_date       => p_treaty_info_update_date
176     ,p_nra_exempt_from_fica          => p_nra_exempt_from_fica
177     ,p_student_exempt_from_fica      => p_student_exempt_from_fica
178     ,p_addl_withholding_flag         => p_addl_withholding_flag
179     ,p_addl_withholding_amt          => p_addl_withholding_amt
180     ,p_addl_wthldng_amt_period_type  => p_addl_wthldng_amt_period_type
181     ,p_personal_exemption            => p_personal_exemption
182     ,p_addl_exemption_allowed        => p_addl_exemption_allowed
183     ,p_number_of_days_in_usa         => p_number_of_days_in_usa
184     ,p_wthldg_allow_eligible_flag    => p_wthldg_allow_eligible_flag
185     ,p_treaty_ben_allowed_flag       => p_treaty_ben_allowed_flag
186     ,p_treaty_benefits_start_date    => p_treaty_benefits_start_date
187     ,p_ra_effective_date             => p_ra_effective_date
188     ,p_state_code                    => p_state_code
189     ,p_state_honors_treaty_flag      => p_state_honors_treaty_flag
190     ,p_ytd_payments                  => p_ytd_payments
191     ,p_ytd_w2_payments               => p_ytd_w2_payments
192     ,p_ytd_w2_withholding            => p_ytd_w2_withholding
193     ,p_ytd_withholding_allowance     => p_ytd_withholding_allowance
194     ,p_ytd_treaty_payments           => p_ytd_treaty_payments
195     ,p_ytd_treaty_withheld_amt       => p_ytd_treaty_withheld_amt
196     ,p_record_source                 => p_record_source
197     ,p_visa_type                     => p_visa_type
198     ,p_j_sub_type                    => p_j_sub_type
199     ,p_primary_activity              => p_primary_activity
200     ,p_non_us_country_code           => p_non_us_country_code
201     ,p_citizenship_country_code      => p_citizenship_country_code
202     ,p_constant_addl_tax             => p_constant_addl_tax
203     ,p_date_8233_signed              => p_date_8233_signed
204     ,p_date_w4_signed                => p_date_w4_signed
205     ,p_error_indicator               => p_error_indicator
206     ,p_prev_er_treaty_benefit_amt    => p_prev_er_treaty_benefit_amt
207     ,p_error_text                    => p_error_text
208     ,p_object_version_number         => l_object_version_number
209     ,p_effective_date                => trunc(p_effective_date)
210     ,p_current_analysis              =>  p_current_analysis
211     ,p_forecast_income_code          =>  p_forecast_income_code
212     );
213   --
214   begin
215     --
216     -- Start of API User Hook for the after hook of create_alien_trans_data
217     --
218     pqp_alien_trans_data_bk1.create_alien_trans_data_a
219       (
220        p_alien_transaction_id           =>  l_alien_transaction_id
221       ,p_person_id                      =>  p_person_id
222       ,p_data_source_type               =>  p_data_source_type
223       ,p_tax_year                       =>  p_tax_year
224       ,p_income_code                    =>  p_income_code
225       ,p_withholding_rate               =>  p_withholding_rate
226       ,p_income_code_sub_type           =>  p_income_code_sub_type
227       ,p_exemption_code                 =>  p_exemption_code
228       ,p_maximum_benefit_amount         =>  p_maximum_benefit_amount
229       ,p_retro_lose_ben_amt_flag        =>  p_retro_lose_ben_amt_flag
230       ,p_date_benefit_ends              =>  p_date_benefit_ends
231       ,p_retro_lose_ben_date_flag       =>  p_retro_lose_ben_date_flag
232       ,p_current_residency_status       =>  p_current_residency_status
233       ,p_nra_to_ra_date                 =>  p_nra_to_ra_date
234       ,p_target_departure_date          =>  p_target_departure_date
235       ,p_tax_residence_country_code     =>  p_tax_residence_country_code
236       ,p_treaty_info_update_date        =>  p_treaty_info_update_date
237       ,p_nra_exempt_from_fica           =>  p_nra_exempt_from_fica
238       ,p_student_exempt_from_fica       =>  p_student_exempt_from_fica
239       ,p_addl_withholding_flag          =>  p_addl_withholding_flag
240       ,p_addl_withholding_amt           =>  p_addl_withholding_amt
241       ,p_addl_wthldng_amt_period_type   =>  p_addl_wthldng_amt_period_type
242       ,p_personal_exemption             =>  p_personal_exemption
243       ,p_addl_exemption_allowed         =>  p_addl_exemption_allowed
244       ,p_number_of_days_in_usa          =>  p_number_of_days_in_usa
245       ,p_wthldg_allow_eligible_flag     =>  p_wthldg_allow_eligible_flag
246       ,p_treaty_ben_allowed_flag        =>  p_treaty_ben_allowed_flag
247       ,p_treaty_benefits_start_date     =>  p_treaty_benefits_start_date
248       ,p_ra_effective_date              =>  p_ra_effective_date
249       ,p_state_code                     =>  p_state_code
250       ,p_state_honors_treaty_flag       =>  p_state_honors_treaty_flag
251       ,p_ytd_payments                   =>  p_ytd_payments
252       ,p_ytd_w2_payments                =>  p_ytd_w2_payments
253       ,p_ytd_w2_withholding             =>  p_ytd_w2_withholding
254       ,p_ytd_withholding_allowance      =>  p_ytd_withholding_allowance
255       ,p_ytd_treaty_payments            =>  p_ytd_treaty_payments
256       ,p_ytd_treaty_withheld_amt        =>  p_ytd_treaty_withheld_amt
257       ,p_record_source                  =>  p_record_source
258       ,p_visa_type                      =>  p_visa_type
259       ,p_j_sub_type                     =>  p_j_sub_type
260       ,p_primary_activity               =>  p_primary_activity
261       ,p_non_us_country_code            =>  p_non_us_country_code
262       ,p_citizenship_country_code       =>  p_citizenship_country_code
263       ,p_constant_addl_tax              =>  p_constant_addl_tax
264       ,p_date_8233_signed               =>  p_date_8233_signed
265       ,p_date_w4_signed                 =>  p_date_w4_signed
266       ,p_error_indicator                =>  p_error_indicator
267       ,p_prev_er_treaty_benefit_amt     =>  p_prev_er_treaty_benefit_amt
268       ,p_error_text                     =>  p_error_text
269       ,p_object_version_number          =>  l_object_version_number
270       ,p_effective_date                 => trunc(p_effective_date)
271       ,p_current_analysis              =>  p_current_analysis
272       ,p_forecast_income_code          =>  p_forecast_income_code
273       );
274   exception
275     when hr_api.cannot_find_prog_unit then
276       hr_api.cannot_find_prog_unit_error
277         (p_module_name => 'CREATE_ALIEN_TRANS_DATA'
278         ,p_hook_type   => 'AP'
279         );
280     --
281     -- End of API User Hook for the after hook of create_alien_trans_data
282     --
283   end;
284   --
285   hr_utility.set_location(l_proc, 60);
286   --
287   -- When in validation only mode raise the Validate_Enabled exception
288   --
289   if p_validate then
290     raise hr_api.validate_enabled;
291   end if;
292   --
293   -- Set all output arguments
294   --
295   p_alien_transaction_id := l_alien_transaction_id;
296   p_object_version_number := l_object_version_number;
297   --
298   hr_utility.set_location(' Leaving:'||l_proc, 70);
299   --
300 exception
301   --
302   when hr_api.validate_enabled then
303     --
307     ROLLBACK TO create_alien_trans_data;
304     -- As the Validate_Enabled exception has been raised
305     -- we must rollback to the savepoint
306     --
308     --
309     -- Only set output warning arguments
310     -- (Any key or derived arguments must be set to null
311     -- when validation only mode is being used.)
312     --
313     p_alien_transaction_id := null;
314     p_object_version_number  := null;
315     hr_utility.set_location(' Leaving:'||l_proc, 80);
316     --
317   when others then
318     --
319     -- A validation or unexpected error has occured
320     --
321 
322     ROLLBACK TO create_alien_trans_data;
323 
324     p_alien_transaction_id := null;
325     p_object_version_number  := null;
326     hr_utility.set_location(' Leaving:'||l_proc, 90);
327     raise;
328     --
329 end create_alien_trans_data;
330 -- ----------------------------------------------------------------------------
331 -- |------------------------< update_alien_trans_data >--- ------------------|
332 -- ----------------------------------------------------------------------------
333 --
334 procedure update_alien_trans_data
335   (p_validate                       in  boolean   default false
336   ,p_alien_transaction_id           in  number
337   ,p_person_id                      in  number    default hr_api.g_number
338   ,p_data_source_type               in  varchar2  default hr_api.g_varchar2
339   ,p_tax_year                       in  number    default hr_api.g_number
340   ,p_income_code                    in  varchar2  default hr_api.g_varchar2
341   ,p_withholding_rate               in  number    default hr_api.g_number
342   ,p_income_code_sub_type           in  varchar2  default hr_api.g_varchar2
343   ,p_exemption_code                 in  varchar2  default hr_api.g_varchar2
344   ,p_maximum_benefit_amount         in  number    default hr_api.g_number
345   ,p_retro_lose_ben_amt_flag        in  varchar2  default hr_api.g_varchar2
346   ,p_date_benefit_ends              in  date      default hr_api.g_date
347   ,p_retro_lose_ben_date_flag       in  varchar2  default hr_api.g_varchar2
348   ,p_current_residency_status       in  varchar2  default hr_api.g_varchar2
349   ,p_nra_to_ra_date                 in  date      default hr_api.g_date
350   ,p_target_departure_date          in  date      default hr_api.g_date
351   ,p_tax_residence_country_code     in  varchar2  default hr_api.g_varchar2
352   ,p_treaty_info_update_date        in  date      default hr_api.g_date
353   ,p_nra_exempt_from_fica           in  varchar2  default hr_api.g_varchar2
354   ,p_student_exempt_from_fica       in  varchar2  default hr_api.g_varchar2
355   ,p_addl_withholding_flag          in  varchar2  default hr_api.g_varchar2
356   ,p_addl_withholding_amt           in  number    default hr_api.g_number
357   ,p_addl_wthldng_amt_period_type   in  varchar2  default hr_api.g_varchar2
358   ,p_personal_exemption             in  number    default hr_api.g_number
359   ,p_addl_exemption_allowed         in  number    default hr_api.g_number
360   ,p_number_of_days_in_usa          in  number    default hr_api.g_number
361   ,p_wthldg_allow_eligible_flag     in  varchar2  default hr_api.g_varchar2
362   ,p_treaty_ben_allowed_flag        in  varchar2  default hr_api.g_varchar2
363   ,p_treaty_benefits_start_date     in  date      default hr_api.g_date
364   ,p_ra_effective_date              in  date      default hr_api.g_date
365   ,p_state_code                     in  varchar2  default hr_api.g_varchar2
366   ,p_state_honors_treaty_flag       in  varchar2  default hr_api.g_varchar2
367   ,p_ytd_payments                   in  number    default hr_api.g_number
368   ,p_ytd_w2_payments                in  number    default hr_api.g_number
369   ,p_ytd_w2_withholding             in  number    default hr_api.g_number
370   ,p_ytd_withholding_allowance      in  number    default hr_api.g_number
371   ,p_ytd_treaty_payments            in  number    default hr_api.g_number
372   ,p_ytd_treaty_withheld_amt        in  number    default hr_api.g_number
373   ,p_record_source                  in  varchar2  default hr_api.g_varchar2
374   ,p_visa_type                      in  varchar2  default hr_api.g_varchar2
375   ,p_j_sub_type                     in  varchar2  default hr_api.g_varchar2
376   ,p_primary_activity               in  varchar2  default hr_api.g_varchar2
377   ,p_non_us_country_code            in  varchar2  default hr_api.g_varchar2
378   ,p_citizenship_country_code       in  varchar2  default hr_api.g_varchar2
379   ,p_constant_addl_tax              in  number    default hr_api.g_number
380   ,p_date_8233_signed               in  date      default hr_api.g_date
381   ,p_date_w4_signed                 in  date      default hr_api.g_date
382   ,p_error_indicator                in  varchar2  default hr_api.g_varchar2
383   ,p_prev_er_treaty_benefit_amt     in  number    default hr_api.g_number
384   ,p_error_text                     in  varchar2  default hr_api.g_varchar2
385   ,p_object_version_number          in out nocopy number
386   ,p_effective_date                 in  date
387   ,p_current_analysis               in  varchar2  default hr_api.g_varchar2
388   ,p_forecast_income_code           in  varchar2  default hr_api.g_varchar2
389   ) is
390   --
391   -- Declare cursors and local variables
392   --
393   l_proc varchar2(72) := g_package||'update_alien_trans_data';
394   l_object_version_number pqp_alien_transaction_data.object_version_number%TYPE;
395   --
396 begin
397   --
398   hr_utility.set_location('Entering:'|| l_proc, 10);
399   --
400   -- Issue a savepoint if operating in validation only mode
401   --
402   savepoint update_alien_trans_data;
403   --
407   --
404   hr_utility.set_location(l_proc, 20);
405   --
406   -- Process Logic
408   l_object_version_number := p_object_version_number;
409   --
410   begin
411     --
412     -- Start of API User Hook for the before hook of update_alien_trans_data
413     --
414     pqp_alien_trans_data_bk2.update_alien_trans_data_b
415       (
416        p_alien_transaction_id           =>  p_alien_transaction_id
417       ,p_person_id                      =>  p_person_id
418       ,p_data_source_type               =>  p_data_source_type
419       ,p_tax_year                       =>  p_tax_year
420       ,p_income_code                    =>  p_income_code
421       ,p_withholding_rate               =>  p_withholding_rate
422       ,p_income_code_sub_type           =>  p_income_code_sub_type
423       ,p_exemption_code                 =>  p_exemption_code
424       ,p_maximum_benefit_amount         =>  p_maximum_benefit_amount
425       ,p_retro_lose_ben_amt_flag        =>  p_retro_lose_ben_amt_flag
426       ,p_date_benefit_ends              =>  p_date_benefit_ends
427       ,p_retro_lose_ben_date_flag       =>  p_retro_lose_ben_date_flag
428       ,p_current_residency_status       =>  p_current_residency_status
429       ,p_nra_to_ra_date                 =>  p_nra_to_ra_date
430       ,p_target_departure_date          =>  p_target_departure_date
431       ,p_tax_residence_country_code     =>  p_tax_residence_country_code
432       ,p_treaty_info_update_date        =>  p_treaty_info_update_date
433       ,p_nra_exempt_from_fica           =>  p_nra_exempt_from_fica
434       ,p_student_exempt_from_fica       =>  p_student_exempt_from_fica
435       ,p_addl_withholding_flag          =>  p_addl_withholding_flag
436       ,p_addl_withholding_amt           =>  p_addl_withholding_amt
437       ,p_addl_wthldng_amt_period_type   =>  p_addl_wthldng_amt_period_type
438       ,p_personal_exemption             =>  p_personal_exemption
439       ,p_addl_exemption_allowed         =>  p_addl_exemption_allowed
440       ,p_number_of_days_in_usa          =>  p_number_of_days_in_usa
441       ,p_wthldg_allow_eligible_flag     =>  p_wthldg_allow_eligible_flag
442       ,p_treaty_ben_allowed_flag        =>  p_treaty_ben_allowed_flag
443       ,p_treaty_benefits_start_date     =>  p_treaty_benefits_start_date
444       ,p_ra_effective_date              =>  p_ra_effective_date
445       ,p_state_code                     =>  p_state_code
446       ,p_state_honors_treaty_flag       =>  p_state_honors_treaty_flag
447       ,p_ytd_payments                   =>  p_ytd_payments
448       ,p_ytd_w2_payments                =>  p_ytd_w2_payments
449       ,p_ytd_w2_withholding             =>  p_ytd_w2_withholding
450       ,p_ytd_withholding_allowance      =>  p_ytd_withholding_allowance
451       ,p_ytd_treaty_payments            =>  p_ytd_treaty_payments
452       ,p_ytd_treaty_withheld_amt        =>  p_ytd_treaty_withheld_amt
453       ,p_record_source                  =>  p_record_source
454       ,p_visa_type                      =>  p_visa_type
455       ,p_j_sub_type                     =>  p_j_sub_type
456       ,p_primary_activity               =>  p_primary_activity
457       ,p_non_us_country_code            =>  p_non_us_country_code
458       ,p_citizenship_country_code       =>  p_citizenship_country_code
459       ,p_constant_addl_tax              =>  p_constant_addl_tax
460       ,p_date_8233_signed               =>  p_date_8233_signed
461       ,p_date_w4_signed                 =>  p_date_w4_signed
462       ,p_error_indicator                =>  p_error_indicator
463       ,p_prev_er_treaty_benefit_amt     =>  p_prev_er_treaty_benefit_amt
464       ,p_error_text                     =>  p_error_text
465       ,p_object_version_number          =>  p_object_version_number
466       ,p_effective_date                 => trunc(p_effective_date)
467       ,p_current_analysis              =>  p_current_analysis
468       ,p_forecast_income_code          =>  p_forecast_income_code
469       );
470   exception
471     when hr_api.cannot_find_prog_unit then
472       hr_api.cannot_find_prog_unit_error
473         (p_module_name => 'UPDATE_ALIEN_TRANS_DATA'
474         ,p_hook_type   => 'BP'
475         );
476     --
477     -- End of API User Hook for the before hook of update_alien_trans_data
478     --
479   end;
480   --
481   pqp_atd_upd.upd
482     (
483      p_alien_transaction_id          => p_alien_transaction_id
484     ,p_person_id                     => p_person_id
485     ,p_data_source_type              => p_data_source_type
486     ,p_tax_year                      => p_tax_year
487     ,p_income_code                   => p_income_code
488     ,p_withholding_rate              => p_withholding_rate
489     ,p_income_code_sub_type          => p_income_code_sub_type
490     ,p_exemption_code                => p_exemption_code
491     ,p_maximum_benefit_amount        => p_maximum_benefit_amount
492     ,p_retro_lose_ben_amt_flag       => p_retro_lose_ben_amt_flag
493     ,p_date_benefit_ends             => p_date_benefit_ends
494     ,p_retro_lose_ben_date_flag      => p_retro_lose_ben_date_flag
495     ,p_current_residency_status      => p_current_residency_status
496     ,p_nra_to_ra_date                => p_nra_to_ra_date
497     ,p_target_departure_date         => p_target_departure_date
498     ,p_tax_residence_country_code    => p_tax_residence_country_code
499     ,p_treaty_info_update_date       => p_treaty_info_update_date
500     ,p_nra_exempt_from_fica          => p_nra_exempt_from_fica
501     ,p_student_exempt_from_fica      => p_student_exempt_from_fica
502     ,p_addl_withholding_flag         => p_addl_withholding_flag
506     ,p_addl_exemption_allowed        => p_addl_exemption_allowed
503     ,p_addl_withholding_amt          => p_addl_withholding_amt
504     ,p_addl_wthldng_amt_period_type  => p_addl_wthldng_amt_period_type
505     ,p_personal_exemption            => p_personal_exemption
507     ,p_number_of_days_in_usa         => p_number_of_days_in_usa
508     ,p_wthldg_allow_eligible_flag    => p_wthldg_allow_eligible_flag
509     ,p_treaty_ben_allowed_flag       => p_treaty_ben_allowed_flag
510     ,p_treaty_benefits_start_date    => p_treaty_benefits_start_date
511     ,p_ra_effective_date             => p_ra_effective_date
512     ,p_state_code                    => p_state_code
513     ,p_state_honors_treaty_flag      => p_state_honors_treaty_flag
514     ,p_ytd_payments                  => p_ytd_payments
515     ,p_ytd_w2_payments               => p_ytd_w2_payments
516     ,p_ytd_w2_withholding            => p_ytd_w2_withholding
517     ,p_ytd_withholding_allowance     => p_ytd_withholding_allowance
518     ,p_ytd_treaty_payments           => p_ytd_treaty_payments
519     ,p_ytd_treaty_withheld_amt       => p_ytd_treaty_withheld_amt
520     ,p_record_source                 => p_record_source
521     ,p_visa_type                     => p_visa_type
522     ,p_j_sub_type                    => p_j_sub_type
523     ,p_primary_activity              => p_primary_activity
524     ,p_non_us_country_code           => p_non_us_country_code
525     ,p_citizenship_country_code      => p_citizenship_country_code
526     ,p_constant_addl_tax             => p_constant_addl_tax
527     ,p_date_8233_signed              => p_date_8233_signed
528     ,p_date_w4_signed                => p_date_w4_signed
529     ,p_error_indicator               => p_error_indicator
530     ,p_prev_er_treaty_benefit_amt    => p_prev_er_treaty_benefit_amt
531     ,p_error_text                    => p_error_text
532     ,p_object_version_number         => l_object_version_number
533     ,p_effective_date                => trunc(p_effective_date)
534     ,p_current_analysis              =>  p_current_analysis
535     ,p_forecast_income_code          =>  p_forecast_income_code
536     );
537   --
538   begin
539     --
540     -- Start of API User Hook for the after hook of update_alien_trans_data
541     --
542     pqp_alien_trans_data_bk2.update_alien_trans_data_a
543       (
544        p_alien_transaction_id           =>  p_alien_transaction_id
545       ,p_person_id                      =>  p_person_id
546       ,p_data_source_type               =>  p_data_source_type
547       ,p_tax_year                       =>  p_tax_year
548       ,p_income_code                    =>  p_income_code
549       ,p_withholding_rate               =>  p_withholding_rate
550       ,p_income_code_sub_type           =>  p_income_code_sub_type
551       ,p_exemption_code                 =>  p_exemption_code
552       ,p_maximum_benefit_amount         =>  p_maximum_benefit_amount
553       ,p_retro_lose_ben_amt_flag        =>  p_retro_lose_ben_amt_flag
554       ,p_date_benefit_ends              =>  p_date_benefit_ends
555       ,p_retro_lose_ben_date_flag       =>  p_retro_lose_ben_date_flag
556       ,p_current_residency_status       =>  p_current_residency_status
557       ,p_nra_to_ra_date                 =>  p_nra_to_ra_date
558       ,p_target_departure_date          =>  p_target_departure_date
559       ,p_tax_residence_country_code     =>  p_tax_residence_country_code
560       ,p_treaty_info_update_date        =>  p_treaty_info_update_date
561       ,p_nra_exempt_from_fica           =>  p_nra_exempt_from_fica
562       ,p_student_exempt_from_fica       =>  p_student_exempt_from_fica
563       ,p_addl_withholding_flag          =>  p_addl_withholding_flag
564       ,p_addl_withholding_amt           =>  p_addl_withholding_amt
565       ,p_addl_wthldng_amt_period_type   =>  p_addl_wthldng_amt_period_type
566       ,p_personal_exemption             =>  p_personal_exemption
567       ,p_addl_exemption_allowed         =>  p_addl_exemption_allowed
568       ,p_number_of_days_in_usa          =>  p_number_of_days_in_usa
569       ,p_wthldg_allow_eligible_flag     =>  p_wthldg_allow_eligible_flag
570       ,p_treaty_ben_allowed_flag        =>  p_treaty_ben_allowed_flag
571       ,p_treaty_benefits_start_date     =>  p_treaty_benefits_start_date
572       ,p_ra_effective_date              =>  p_ra_effective_date
573       ,p_state_code                     =>  p_state_code
574       ,p_state_honors_treaty_flag       =>  p_state_honors_treaty_flag
575       ,p_ytd_payments                   =>  p_ytd_payments
576       ,p_ytd_w2_payments                =>  p_ytd_w2_payments
577       ,p_ytd_w2_withholding             =>  p_ytd_w2_withholding
578       ,p_ytd_withholding_allowance      =>  p_ytd_withholding_allowance
579       ,p_ytd_treaty_payments            =>  p_ytd_treaty_payments
580       ,p_ytd_treaty_withheld_amt        =>  p_ytd_treaty_withheld_amt
581       ,p_record_source                  =>  p_record_source
582       ,p_visa_type                      =>  p_visa_type
583       ,p_j_sub_type                     =>  p_j_sub_type
584       ,p_primary_activity               =>  p_primary_activity
585       ,p_non_us_country_code            =>  p_non_us_country_code
586       ,p_citizenship_country_code       =>  p_citizenship_country_code
587       ,p_constant_addl_tax              =>  p_constant_addl_tax
588       ,p_date_8233_signed               =>  p_date_8233_signed
589       ,p_date_w4_signed                 =>  p_date_w4_signed
590       ,p_error_indicator                =>  p_error_indicator
591       ,p_prev_er_treaty_benefit_amt     =>  p_prev_er_treaty_benefit_amt
592       ,p_error_text                     =>  p_error_text
596       ,p_forecast_income_code          =>  p_forecast_income_code
593       ,p_object_version_number          =>  l_object_version_number
594       ,p_effective_date                => trunc(p_effective_date)
595       ,p_current_analysis              =>  p_current_analysis
597       );
598   exception
599     when hr_api.cannot_find_prog_unit then
600       hr_api.cannot_find_prog_unit_error
601         (p_module_name => 'UPDATE_ALIEN_TRANS_DATA'
602         ,p_hook_type   => 'AP'
603         );
604     --
605     -- End of API User Hook for the after hook of update_alien_trans_data
606     --
607   end;
608   --
609   hr_utility.set_location(l_proc, 60);
610   --
611   -- When in validation only mode raise the Validate_Enabled exception
612   --
613   if p_validate then
614     raise hr_api.validate_enabled;
615   end if;
616   --
617   -- Set all output arguments
618   --
619   p_object_version_number := l_object_version_number;
620   --
621   hr_utility.set_location(' Leaving:'||l_proc, 70);
622   --
623 exception
624   --
625   when hr_api.validate_enabled then
626     --
627     -- As the Validate_Enabled exception has been raised
628     -- we must rollback to the savepoint
629     --
630     ROLLBACK TO update_alien_trans_data;
631     --
632     -- Only set output warning arguments
633     -- (Any key or derived arguments must be set to null
634     -- when validation only mode is being used.)
635     --
636     hr_utility.set_location(' Leaving:'||l_proc, 80);
637     --
638   when others then
639     --
640     -- A validation or unexpected error has occured
641     --
642     ROLLBACK TO update_alien_trans_data;
643     p_object_version_number := l_object_version_number;
644     hr_utility.set_location(' Leaving:'||l_proc, 90);
645     raise;
646     --
647 end update_alien_trans_data;
648 -- ----------------------------------------------------------------------------
649 -- |------------------------< delete_alien_trans_data >----------------------|
650 -- ----------------------------------------------------------------------------
651 --
652 procedure delete_alien_trans_data
653   (p_validate                       in  boolean  default false
654   ,p_alien_transaction_id           in  number
655   ,p_object_version_number          in out nocopy number
656   ,p_effective_date                 in  date
657   ) is
658   --
659   -- Declare cursors and local variables
660   --
661   l_proc varchar2(72) := g_package||'update_alien_trans_data';
662   l_object_version_number pqp_alien_transaction_data.object_version_number%TYPE;
663   --
664 begin
665   --
666   hr_utility.set_location('Entering:'|| l_proc, 10);
667   --
668   -- Issue a savepoint if operating in validation only mode
669   --
670   savepoint delete_alien_trans_data;
671   --
672   hr_utility.set_location(l_proc, 20);
673   --
674   -- Process Logic
675   --
676   l_object_version_number := p_object_version_number;
677   --
678   --
679   begin
680     --
681     -- Start of API User Hook for the before hook of delete_alien_trans_data
682     --
683     pqp_alien_trans_data_bk3.delete_alien_trans_data_b
684       (
685        p_alien_transaction_id           =>  p_alien_transaction_id
686       ,p_object_version_number          =>  p_object_version_number
687     ,p_effective_date                      => trunc(p_effective_date)
688       );
689   exception
690     when hr_api.cannot_find_prog_unit then
691       hr_api.cannot_find_prog_unit_error
692         (p_module_name => 'DELETE_ALIEN_TRANS_DATA'
693         ,p_hook_type   => 'BP'
694         );
695     --
696     -- End of API User Hook for the before hook of delete_alien_trans_data
697     --
698   end;
699   --
700   pqp_atd_del.del
701     (
702      p_alien_transaction_id          => p_alien_transaction_id
703     ,p_object_version_number         => l_object_version_number
704     ,p_effective_date                => p_effective_date
705     );
706   --
707   begin
708     --
709     -- Start of API User Hook for the after hook of delete_alien_trans_data
710     --
711     pqp_alien_trans_data_bk3.delete_alien_trans_data_a
712       (
713        p_alien_transaction_id           =>  p_alien_transaction_id
714       ,p_object_version_number          =>  l_object_version_number
715     ,p_effective_date                      => trunc(p_effective_date)
716       );
717   exception
718     when hr_api.cannot_find_prog_unit then
719       hr_api.cannot_find_prog_unit_error
720         (p_module_name => 'DELETE_ALIEN_TRANS_DATA'
721         ,p_hook_type   => 'AP'
722         );
723     --
724     -- End of API User Hook for the after hook of delete_alien_trans_data
725     --
726   end;
727   --
728   hr_utility.set_location(l_proc, 60);
729   --
730   -- When in validation only mode raise the Validate_Enabled exception
731   --
732   if p_validate then
733     raise hr_api.validate_enabled;
734   end if;
735   --
736   hr_utility.set_location(' Leaving:'||l_proc, 70);
737   --
738 exception
739   --
740   when hr_api.validate_enabled then
741     --
742     -- As the Validate_Enabled exception has been raised
743     -- we must rollback to the savepoint
744     --
745     ROLLBACK TO delete_alien_trans_data;
746     --
747     -- Only set output warning arguments
748     -- (Any key or derived arguments must be set to null
749     -- when validation only mode is being used.)
750     --
751     --
752   when others then
753     --
754     -- A validation or unexpected error has occured
755     --
756     ROLLBACK TO delete_alien_trans_data;
757     p_object_version_number := l_object_version_number;
758     raise;
759     --
760 end delete_alien_trans_data;
761 --
762 -- ----------------------------------------------------------------------------
763 -- |-------------------------------< lck >------------------------------------|
764 -- ----------------------------------------------------------------------------
765 --
766 procedure lck
767   (
768    p_alien_transaction_id                   in     number
769   ,p_object_version_number          in     number
770   ) is
771   --
772   --
773   -- Declare cursors and local variables
774   --
775   l_proc varchar2(72) := g_package||'lck';
776   --
777 begin
778   --
779   hr_utility.set_location('Entering:'|| l_proc, 10);
780   --
781   pqp_atd_shd.lck
782     (
783       p_alien_transaction_id                 => p_alien_transaction_id
784      ,p_object_version_number      => p_object_version_number
785     );
786   --
787   hr_utility.set_location(' Leaving:'||l_proc, 70);
788   --
789 end lck;
790 --
791 end pqp_alien_trans_data_api;