DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_MGR_SHD

Source


1 Package Body pay_mgr_shd as
2 /* $Header: pymgrrhi.pkb 120.2 2005/07/10 23:13:53 pgongada noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_mgr_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15   l_proc        varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31   l_proc 	varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34   hr_utility.set_location('Entering:'||l_proc, 5);
35   --
36   If (p_constraint_name = 'PAY_MAGNETIC_RECORDS_FK2') Then
37     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('STEP','5');
40     hr_utility.raise_error;
41   ElsIf (p_constraint_name = 'PAY_MAGNETIC_RECORDS_FK3') Then
42     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('STEP','10');
45     hr_utility.raise_error;
46   ElsIf (p_constraint_name = 'PAY_MAGNETIC_RECORDS_PK') Then
47     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
48     hr_utility.set_message_token('PROCEDURE', l_proc);
49     hr_utility.set_message_token('STEP','15');
50     hr_utility.raise_error;
51   ElsIf (p_constraint_name = 'PAY_MGR_LAST_RUN_EXECUTED__CHK') Then
52     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
53     hr_utility.set_message_token('PROCEDURE', l_proc);
54     hr_utility.set_message_token('STEP','20');
55     hr_utility.raise_error;
56   ElsIf (p_constraint_name = 'PAY_MGR_OVERFLOW_MODE_CHK') Then
57     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
58     hr_utility.set_message_token('PROCEDURE', l_proc);
59     hr_utility.set_message_token('STEP','25');
60     hr_utility.raise_error;
61   Else
62     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
63     fnd_message.set_token('PROCEDURE', l_proc);
64     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
65     fnd_message.raise_error;
66   End If;
67   --
68   hr_utility.set_location(' Leaving:'||l_proc, 10);
69 End constraint_error;
70 --
71 -- ----------------------------------------------------------------------------
72 -- |-----------------------------< api_updating >-----------------------------|
73 -- ----------------------------------------------------------------------------
74 Function api_updating
75   (
76   p_magnetic_block_id                  in number,
77   p_sequence                           in number
78   )      Return Boolean Is
79 --
80   --
81   -- Cursor selects the 'current' row from the HR Schema
82   --
83   Cursor C_Sel1 is
84     select
85 		formula_id,
86 	magnetic_block_id,
87 	next_block_id,
88 	last_run_executed_mode,
89 	overflow_mode,
90 	sequence,
91 	frequency	,
92         action_level,block_label,block_row_label,xml_proc_name
93     from	pay_magnetic_records
94     where	magnetic_block_id = p_magnetic_block_id
95   and   sequence = p_sequence;
96 --
97   l_proc	varchar2(72)	:= g_package||'api_updating';
98   l_fct_ret	boolean;
99 --
100 Begin
101   hr_utility.set_location('Entering:'||l_proc, 5);
102   --
103   If (
104 	p_magnetic_block_id is null and
105 	p_sequence is null
106      ) Then
107     --
108     -- One of the primary key arguments is null therefore we must
109     -- set the returning function value to false
110     --
111     l_fct_ret := false;
112   Else
113     If (
114 	p_magnetic_block_id = g_old_rec.magnetic_block_id and
115 	p_sequence = g_old_rec.sequence
116        ) Then
117       hr_utility.set_location(l_proc, 10);
118       --
119       -- The g_old_rec is current therefore we must
120       -- set the returning function to true
121       --
122       l_fct_ret := true;
123     Else
124       --
125       -- Select the current row into g_old_rec
126       --
127       Open C_Sel1;
128       Fetch C_Sel1 Into g_old_rec;
129       If C_Sel1%notfound Then
130         Close C_Sel1;
131         --
132         -- The primary key is invalid therefore we must error
133         --
134         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
135         hr_utility.raise_error;
136       End If;
137       Close C_Sel1;
138       --
139       hr_utility.set_location(l_proc, 15);
140       l_fct_ret := true;
141     End If;
142   End If;
143   hr_utility.set_location(' Leaving:'||l_proc, 20);
144   Return (l_fct_ret);
145 --
146 End api_updating;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |---------------------------------< lck >----------------------------------|
150 -- ----------------------------------------------------------------------------
151 Procedure lck
152   (
153   p_magnetic_block_id                  in number,
154   p_sequence                           in number
155   ) is
156 --
157 -- Cursor selects the 'current' row from the HR Schema
158 --
159   Cursor C_Sel1 is
160     select 	formula_id,
161 	magnetic_block_id,
162 	next_block_id,
163 	last_run_executed_mode,
164 	overflow_mode,
165 	sequence,
166 	frequency	,
167         action_level,block_label,block_row_label,xml_proc_name
168     from	pay_magnetic_records
169     where	magnetic_block_id = p_magnetic_block_id
170   and   sequence = p_sequence
171     for	update nowait;
172 --
173   l_proc	varchar2(72) := g_package||'lck';
174 --
175 Begin
176   hr_utility.set_location('Entering:'||l_proc, 5);
177   --
178   -- Add any mandatory argument checking here:
179   -- Example:
180   -- hr_api.mandatory_arg_error
181   --   (p_api_name       => l_proc,
182   --    p_argument       => 'object_version_number',
183   --    p_argument_value => p_object_version_number);
184   --
185   Open  C_Sel1;
186   Fetch C_Sel1 Into g_old_rec;
187   If C_Sel1%notfound then
188     Close C_Sel1;
189     --
190     -- The primary key is invalid therefore we must error
191     --
192     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
193     hr_utility.raise_error;
194   End If;
195   Close C_Sel1;
196   --
197 --
198   hr_utility.set_location(' Leaving:'||l_proc, 10);
199 --
200 -- We need to trap the ORA LOCK exception
201 --
202 Exception
203   When HR_Api.Object_Locked then
204     --
205     -- The object is locked therefore we need to supply a meaningful
206     -- error message.
207     --
208     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
209     hr_utility.set_message_token('TABLE_NAME', 'pay_magnetic_records');
210     hr_utility.raise_error;
211 End lck;
212 --
213 -- ----------------------------------------------------------------------------
214 -- |-----------------------------< convert_args >-----------------------------|
215 -- ----------------------------------------------------------------------------
216 Function convert_args
217 	(
218 	p_formula_id                    in number,
219 	p_magnetic_block_id             in number,
220 	p_next_block_id                 in number,
221 	p_last_run_executed_mode        in varchar2,
222 	p_overflow_mode                 in varchar2,
223 	p_sequence                      in number,
224 	p_frequency                     in number,
225         p_action_level                  in varchar2,
226         p_block_label                   in varchar2,
227         p_block_row_label               in varchar2,
228         p_xml_proc_name                 in varchar2
229 	)
230 	Return g_rec_type is
231 --
232   l_rec	  g_rec_type;
233   l_proc  varchar2(72) := g_package||'convert_args';
234 --
235 Begin
236   --
237   hr_utility.set_location('Entering:'||l_proc, 5);
238   --
239   -- Convert arguments into local l_rec structure.
240   --
241   l_rec.formula_id                       := p_formula_id;
242   l_rec.magnetic_block_id                := p_magnetic_block_id;
243   l_rec.next_block_id                    := p_next_block_id;
244   l_rec.last_run_executed_mode           := p_last_run_executed_mode;
245   l_rec.overflow_mode                    := p_overflow_mode;
246   l_rec.sequence                         := p_sequence;
247   l_rec.frequency                        := p_frequency;
248   l_rec.action_level                     := p_action_level;
249   l_rec.block_label                      := p_block_label;
250   l_rec.block_row_label                  := p_block_row_label;
251   l_rec.xml_proc_name                    := p_xml_proc_name;
252   --
253   -- Return the plsql record structure.
254   --
255   hr_utility.set_location(' Leaving:'||l_proc, 10);
256   Return(l_rec);
257 --
258 End convert_args;
259 --
260 end pay_mgr_shd;