DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_APP_SHD

Source


1 Package Body pay_app_shd as
2 /* $Header: pyapprhi.pkb 120.0.12000000.1 2007/01/17 15:36:55 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33);  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16   --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc        varchar2(72);
29 --
30 Begin
31   l_proc := g_package||'constraint_error';
32   --
33   If (p_constraint_name = 'PAY_AU_PROCESS_PARAMETERS_CHK1') Then
34     fnd_message.set_name('PER', 'PER_52500_INV_YES_NO_FLAG');
35     fnd_message.raise_error;
36   ElsIf (p_constraint_name = 'PAY_AU_PROCESS_PARAMETERS_CHK2') Then
37     fnd_message.set_name('PAY', 'HR_AU_DATA_TYPE_MISMATCH');
38     fnd_message.raise_error;
39   ElsIf (p_constraint_name = 'PAY_AU_PROCESS_PARAMETERS_FK1') Then
40     fnd_message.set_name('PAY', 'HR_AU_INVALID_PROCESS');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'PAY_AU_PROCESS_PARAMETERS_PK') Then
43     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('STEP','20');
46     fnd_message.raise_error;
47   ElsIf (p_constraint_name = 'PAY_AU_PROCESS_PARAMETERS_UK1') Then
48     fnd_message.set_name('PAY', 'PER_7901_SYS_DUPLICATE_RECORDS');
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_process_parameter_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        process_parameter_id
74       ,process_id
75       ,internal_name
76       ,data_type
77       ,enabled_flag
78       ,object_version_number
79     from        pay_au_process_parameters
80     where       process_parameter_id = p_process_parameter_id;
81   --
82   l_fct_ret     boolean;
83   --
84 Begin
85   --
86   If (p_process_parameter_id is null and
87       p_object_version_number is null
88      ) Then
89     --
90     -- One of the primary key arguments is null therefore we must
91     -- set the returning function value to false
92     --
93     l_fct_ret := false;
94   Else
95     If (p_process_parameter_id
96         = pay_app_shd.g_old_rec.process_parameter_id and
97         p_object_version_number
98         = pay_app_shd.g_old_rec.object_version_number
99        ) Then
100       --
101       -- The g_old_rec is current therefore we must
102       -- set the returning function to true
103       --
104       l_fct_ret := true;
105     Else
106       --
107       -- Select the current row into g_old_rec
108       --
109       Open C_Sel1;
110       Fetch C_Sel1 Into pay_app_shd.g_old_rec;
111       If C_Sel1%notfound Then
112         Close C_Sel1;
113         --
114         -- The primary key is invalid therefore we must error
115         --
116         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
117         fnd_message.raise_error;
118       End If;
119       Close C_Sel1;
120       If (p_object_version_number
121           <> pay_app_shd.g_old_rec.object_version_number) Then
122         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
123         fnd_message.raise_error;
124       End If;
125       l_fct_ret := true;
126     End If;
127   End If;
128   Return (l_fct_ret);
129 --
130 End api_updating;
131 --
132 -- ----------------------------------------------------------------------------
133 -- |---------------------------------< lck >----------------------------------|
134 -- ----------------------------------------------------------------------------
135 Procedure lck
136   (p_process_parameter_id                 in     number
137   ,p_object_version_number                in     number
138   ) is
139 --
140 -- Cursor selects the 'current' row from the HR Schema
141 --
142   Cursor C_Sel1 is
143     select
144        process_parameter_id
145       ,process_id
146       ,internal_name
147       ,data_type
148       ,enabled_flag
149       ,object_version_number
150     from        pay_au_process_parameters
151     where       process_parameter_id = p_process_parameter_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_PARAMETER_ID'
164     ,p_argument_value     => p_process_parameter_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_app_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_app_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_process_parameters');
202     fnd_message.raise_error;
203 End lck;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |-----------------------------< convert_args >-----------------------------|
207 -- ----------------------------------------------------------------------------
208 Function convert_args
209   (p_process_parameter_id           in number
210   ,p_process_id                     in number
211   ,p_internal_name                  in varchar2
212   ,p_data_type                      in varchar2
213   ,p_enabled_flag                   in varchar2
214   ,p_object_version_number          in number
215   )
216   Return g_rec_type is
217 --
218   l_rec   g_rec_type;
219 --
220 Begin
221   --
222   -- Convert arguments into local l_rec structure.
223   --
224   l_rec.process_parameter_id             := p_process_parameter_id;
225   l_rec.process_id                       := p_process_id;
226   l_rec.internal_name                    := p_internal_name;
227   l_rec.data_type                        := p_data_type;
228   l_rec.enabled_flag                     := p_enabled_flag;
229   l_rec.object_version_number            := p_object_version_number;
230   --
231   -- Return the plsql record structure.
232   --
233   Return(l_rec);
234 --
235 End convert_args;
236 --
237 begin
238   g_package  := '  pay_app_shd.';  -- Global package name
239 end pay_app_shd;