DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_APR_SHD

Source


1 Package Body pay_apr_shd as
2 /* $Header: pyaprrhi.pkb 120.0.12000000.1 2007/01/17 15:39:22 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33);   -- Global package name
9 --
10 --
14 Function return_api_dml_status Return Boolean Is
11 -- ----------------------------------------------------------------------------
12 -- |------------------------< return_api_dml_status >-------------------------|
13 -- ----------------------------------------------------------------------------
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   (p_constraint_name in all_constraints.constraint_name%TYPE
27   ) Is
28 --
29   l_proc        varchar2(72);
30 --
31 Begin
32   --
33   l_proc := g_package||'constraint_error';
34 
35   If (p_constraint_name = 'PAY_AU_PROCESSES_PK') Then
36     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
37     fnd_message.set_token('PROCEDURE', l_proc);
38     fnd_message.set_token('STEP','5');
39     fnd_message.raise_error;
40   ElsIf (p_constraint_name = 'PAY_AU_PROCESSES_UK1') Then
41     fnd_message.set_name('PAY', 'PER_7901_SYS_DUPLICATE_RECORDS');
42     fnd_message.raise_error;
43   ElsIf (p_constraint_name = 'PAY_AU_PROCESSES_UK2') Then
44     fnd_message.set_name('PAY', 'PER_7901_SYS_DUPLICATE_RECORDS');
45     fnd_message.raise_error;
46   Else
47     fnd_message.set_name('PAY', 'PAY_52681_BHT_CHILD_EXISTS');
48     fnd_message.raise_error;
49   End If;
50   --
51 End constraint_error;
52 --
53 -- ----------------------------------------------------------------------------
54 -- |-----------------------------< api_updating >-----------------------------|
55 -- ----------------------------------------------------------------------------
56 Function api_updating
57   (p_process_id                           in     number
58   ,p_object_version_number                in     number
59   )
60   Return Boolean Is
61   --
62   --
63   -- Cursor selects the 'current' row from the HR Schema
64   --
65   Cursor C_Sel1 is
66     select
67        process_id
68       ,short_name
69       ,name
70       ,enabled_flag
71       ,business_group_id
72       ,legislation_code
73       ,description
74       ,accrual_category
75       ,object_version_number
76     from        pay_au_processes
77     where       process_id = p_process_id;
78   --
79   l_fct_ret     boolean;
80   --
81 Begin
82   --
83   If (p_process_id is null and
84       p_object_version_number is null
85      ) Then
86     --
87     -- One of the primary key arguments is null therefore we must
88     -- set the returning function value to false
89     --
90     l_fct_ret := false;
91   Else
92     If (p_process_id
93         = pay_apr_shd.g_old_rec.process_id and
94         p_object_version_number
95         = pay_apr_shd.g_old_rec.object_version_number
96        ) Then
97       --
98       -- The g_old_rec is current therefore we must
99       -- set the returning function to true
100       --
101       l_fct_ret := true;
102     Else
103       --
104       -- Select the current row into g_old_rec
105       --
106       Open C_Sel1;
107       Fetch C_Sel1 Into pay_apr_shd.g_old_rec;
108       If C_Sel1%notfound Then
109         Close C_Sel1;
110         --
111         -- The primary key is invalid therefore we must error
112         --
113         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
114         fnd_message.raise_error;
115       End If;
116       Close C_Sel1;
117       If (p_object_version_number
118           <> pay_apr_shd.g_old_rec.object_version_number) Then
119         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
120         fnd_message.raise_error;
121       End If;
122       l_fct_ret := true;
123     End If;
124   End If;
125   Return (l_fct_ret);
126 --
127 End api_updating;
128 --
129 -- ----------------------------------------------------------------------------
130 -- |---------------------------------< lck >----------------------------------|
131 -- ----------------------------------------------------------------------------
132 Procedure lck
133   (p_process_id                           in     number
134   ,p_object_version_number                in     number
135   ) is
136 --
137 -- Cursor selects the 'current' row from the HR Schema
138 --
139   Cursor C_Sel1 is
140     select
141        process_id
142       ,short_name
143       ,name
144       ,enabled_flag
145       ,business_group_id
146       ,legislation_code
147       ,description
148       ,accrual_category
149       ,object_version_number
150     from        pay_au_processes
151     where       process_id = p_process_id
152     for update nowait;
153 --
154   l_proc        varchar2(72);
155 --
156 Begin
157   l_proc        := g_package||'lck';
158   --
159   hr_utility.set_location('Entering:'||l_proc, 5);
160   --
161   hr_api.mandatory_arg_error
162     (p_api_name           => l_proc
163     ,p_argument           => 'PROCESS_ID'
164     ,p_argument_value     => p_process_id
165     );
166   hr_utility.set_location(l_proc,6);
167   hr_api.mandatory_arg_error
168     (p_api_name           => l_proc
169     ,p_argument           => 'OBJECT_VERSION_NUMBER'
170     ,p_argument_value     => p_object_version_number
171     );
172   --
173   Open  C_Sel1;
174   Fetch C_Sel1 Into pay_apr_shd.g_old_rec;
175   If C_Sel1%notfound then
176     Close C_Sel1;
177     --
178     -- The primary key is invalid therefore we must error
179     --
180     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
181     fnd_message.raise_error;
182   End If;
183   Close C_Sel1;
184   If (p_object_version_number
185       <> pay_apr_shd.g_old_rec.object_version_number) Then
186         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
187         fnd_message.raise_error;
188   End If;
189   --
190   hr_utility.set_location(' Leaving:'||l_proc, 10);
191   --
192   -- We need to trap the ORA LOCK exception
193   --
194 Exception
195   When HR_Api.Object_Locked then
196     --
197     -- The object is locked therefore we need to supply a meaningful
198     -- error message.
199     --
200     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
201     fnd_message.set_token('TABLE_NAME', 'pay_au_processes');
202     fnd_message.raise_error;
203 End lck;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |-----------------------------< convert_args >-----------------------------|
207 -- ----------------------------------------------------------------------------
208 Function convert_args
209   (p_process_id                     in number
210   ,p_short_name                     in varchar2
211   ,p_name                           in varchar2
212   ,p_enabled_flag                   in varchar2
213   ,p_business_group_id              in number
214   ,p_legislation_code               in varchar2
215   ,p_description                    in varchar2
216   ,p_accrual_category               in varchar2
217   ,p_object_version_number          in number
218   )
219   Return g_rec_type is
220 --
221   l_rec   g_rec_type;
222 --
223 Begin
224   --
225   -- Convert arguments into local l_rec structure.
226   --
227   l_rec.process_id                       := p_process_id;
228   l_rec.short_name                       := p_short_name;
229   l_rec.name                             := p_name;
230   l_rec.enabled_flag                     := p_enabled_flag;
231   l_rec.business_group_id                := p_business_group_id;
232   l_rec.legislation_code                 := p_legislation_code;
233   l_rec.description                      := p_description;
234   l_rec.accrual_category                 := p_accrual_category;
235   l_rec.object_version_number            := p_object_version_number;
236   --
237   -- Return the plsql record structure.
238   --
239   Return(l_rec);
240 --
241 End convert_args;
242 --
243 Begin
244   g_package := '  pay_apr_shd.';  -- Global package name
245 end pay_apr_shd;