DBA Data[Home] [Help]

PACKAGE BODY: APPS.SSP_ERN_SHD

Source


1 Package Body ssp_ern_shd as
2 /* $Header: spernrhi.pkb 120.5.12010000.2 2008/08/13 13:25:38 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ssp_ern_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, 1);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 100);
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, 1);
35   --
36   If (p_constraint_name = 'SSP_EARNINGS_CALCULATIONS_PK') Then
37     fnd_message.set_name('SSP', 'SSP_35043_INVALID_PRIMARY_KEY');
38   ElsIf (p_constraint_name = 'SSP_EARNINGS_CALCULATIONS_UK1') Then
39     fnd_message.set_name('SSP', 'SSP_35053_ERN_INV_UK1');
40   Else
41     fnd_message.set_name('PAY','HR_7877_API_INVALID_CONSTRAINT');
42     fnd_message.set_token ('PROCEDURE',l_proc);
43     fnd_message.set_token ('CONSTRAINT_NAME',p_constraint_name);
44   End If;
45   --
46   fnd_message.raise_error;
47   hr_utility.set_location(' Leaving:'||l_proc, 100);
48 End constraint_error;
49 --
50 -- ----------------------------------------------------------------------------
51 -- |-----------------------------< api_updating >-----------------------------|
52 -- ----------------------------------------------------------------------------
53 Function api_updating
54   (
55   p_earnings_calculations_id           in number,
56   p_object_version_number              in number
57   )      Return Boolean Is
58 --
59 -- Cursor selects the 'current' row from the HR Schema
60 --
61   Cursor C_Sel1 is
62 	select	earnings_calculations_id,
63 		object_version_number,
64 		person_id,
65 		effective_date,
66 		average_earnings_amount,
67 		user_entered,
68 		payment_periods
69 	  from	ssp_earnings_calculations
70 	 where	earnings_calculations_id = p_earnings_calculations_id;
71 --
72   l_proc	varchar2(72)	:= g_package||'api_updating';
73   l_fct_ret	boolean;
74 --
75 Begin
76   hr_utility.set_location('Entering:'||l_proc, 1);
77   --
78   If (p_earnings_calculations_id is null and p_object_version_number is null)
79   then
80     --
81     -- One of the primary key arguments is null therefore we must
82     -- set the returning function value to false
83     --
84     l_fct_ret := false;
85   Else
86     If (
87 	p_earnings_calculations_id = g_old_rec.earnings_calculations_id and
88 	p_object_version_number = g_old_rec.object_version_number
89        )
90     then
91       hr_utility.set_location(l_proc, 10);
92       --
93       -- The g_old_rec is current therefore we must
94       -- set the returning function to true
95       --
96       l_fct_ret := true;
97     Else
98       --
99       -- Select the current row into g_old_rec
100       --
101       Open C_Sel1;
102       Fetch C_Sel1 Into g_old_rec.earnings_calculations_id,
103 			g_old_rec.object_version_number,
104 			g_old_rec.person_id,
105 			g_old_rec.effective_date,
106 			g_old_rec.average_earnings_amount,
107 			g_old_rec.user_entered,
108 			g_old_rec.payment_periods;
109       --
110       If C_Sel1%notfound Then
111         Close C_Sel1;
112         --
113         -- The primary key is invalid therefore we must error
114         --
115         fnd_message.set_name('SSP', 'SSP_35043_INVALID_PRIMARY_KEY');
116         fnd_message.raise_error;
117       End If;
118       Close C_Sel1;
119       If (p_object_version_number <> g_old_rec.object_version_number)
120       Then
121         fnd_message.set_name('SSP', 'SSP_35044_OBJECT_INVALID');
122         fnd_message.raise_error;
123       End If;
124       hr_utility.set_location(l_proc, 15);
125       l_fct_ret := true;
126     End If;
127   End If;
128   hr_utility.set_location(' Leaving:'||l_proc, 100);
129   Return (l_fct_ret);
130 --
131 End api_updating;
132 --
133 -- ----------------------------------------------------------------------------
134 -- |---------------------------------< lck >----------------------------------|
135 -- ----------------------------------------------------------------------------
136 Procedure lck
137   (
138   p_earnings_calculations_id           in number,
139   p_object_version_number              in number
140   ) is
141 --
142 -- Cursor selects the 'current' row from the HR Schema
143 --
144   Cursor C_Sel1 is
145     select earnings_calculations_id,
146 	   object_version_number,
147 	   person_id,
148 	   effective_date,
149 	   average_earnings_amount,
150 	   user_entered,
151 	   payment_periods
152     from   ssp_earnings_calculations
153     where  earnings_calculations_id = p_earnings_calculations_id
154     for	update nowait;
155 --
156   l_proc	varchar2(72) := g_package||'lck';
157 --
158 Begin
159   hr_utility.set_location('Entering:'||l_proc, 1);
160   --
161   -- Add any mandatory argument checking here:
162   -- Example:
163   -- hr_api.mandatory_arg_error
164   --   (p_api_name       => l_proc,
165   --    p_argument       => 'object_version_number',
166   --    p_argument_value => p_object_version_number);
167   --
168   Open  C_Sel1;
169   Fetch C_Sel1 Into g_old_rec.earnings_calculations_id,
170                     g_old_rec.object_version_number,
171 		    g_old_rec.person_id,
172                     g_old_rec.effective_date,
173                     g_old_rec.average_earnings_amount,
174 		    g_old_rec.user_entered,
175 		    g_old_rec.payment_periods;
176   --
177   If C_Sel1%notfound then
178     Close C_Sel1;
179     --
180     -- The primary key is invalid therefore we must error
181     --
182     fnd_message.set_name('SSP', 'SSP_35043_INVALID_PRIMARY_KEY');
183     fnd_message.raise_error;
184   End If;
185   Close C_Sel1;
186   If (p_object_version_number <> g_old_rec.object_version_number)
187   Then
188     fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
189     fnd_message.raise_error;
190   end If;
191 --
192   hr_utility.set_location(' Leaving:'||l_proc, 100);
193 --
194 -- We need to trap the ORA LOCK exception
195 --
196 Exception
197   When HR_Api.Object_Locked then
198     --
199     -- The object is locked so supply a meaningful error message.
200     --
201     fnd_message.set_name('PAY','HR_7165_OBJECT_LOCKED');
202     fnd_message.set_token ('TABLE_NAME','ssp_earnings_calculations');
203     fnd_message.raise_error;
204 End lck;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |-----------------------------< convert_args >-----------------------------|
208 -- ----------------------------------------------------------------------------
209 Function convert_args
210 	(
211 	p_earnings_calculations_id      in number,
212 	p_object_version_number         in number,
213 	p_person_id                     in number,
214 	p_effective_date                in date,
215 	p_average_earnings_amount       in number,
216 	p_user_entered                  in varchar2,
217 	p_absence_category		in varchar2, --DFoster 1304683
218 	p_payment_periods		in number
219 	)
220 	Return g_rec_type is
221 --
222   l_rec	  g_rec_type;
223   l_proc  varchar2(72) := g_package||'convert_args';
224 --
225 Begin
226   --
227   hr_utility.set_location('Entering:'||l_proc, 1);
228   --
229   -- Convert arguments into local l_rec structure.
230   --
231   l_rec.earnings_calculations_id         := p_earnings_calculations_id;
232   l_rec.object_version_number            := p_object_version_number;
233   l_rec.person_id                        := p_person_id;
234   l_rec.effective_date                   := p_effective_date;
235   l_rec.average_earnings_amount          := p_average_earnings_amount;
236   l_rec.user_entered                     := p_user_entered;
237   l_rec.absence_category		 := p_absence_category; --DFoster 1304683
238   l_rec.payment_periods                  := p_payment_periods;
239   --
240   -- Return the plsql record structure.
241   --
242   hr_utility.set_location('Leaving :'||l_proc, 100);
243   Return(l_rec);
244 --
245 End convert_args;
246 --
247 end ssp_ern_shd;