DBA Data[Home] [Help]
Skip to content

PACKAGE BODY: APPS.PAY_APM_SHD

Source


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