DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_BLD_SHD

Source


1 Package Body pay_bld_shd as
2 /* $Header: pybldrhi.pkb 120.0 2005/05/29 03:19:28 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_bld_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc        varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'PAY_BALANCE_DIMENSIONS_FK1') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   ElsIf (p_constraint_name = 'PAY_BALANCE_DIMENSIONS_PK') Then
27     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('STEP','10');
30     fnd_message.raise_error;
31   ElsIf (p_constraint_name = 'PAY_BALANCE_DIMENSIONS_UK2') Then
32     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('STEP','15');
35     fnd_message.raise_error;
36   ElsIf (p_constraint_name = 'PAY_BDIM_DIMENSION_TYPE_CHK') Then
37     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','20');
40     fnd_message.raise_error;
41   ElsIf (p_constraint_name = 'PAY_BDIM_EXPIRY_CHECKING_L_CHK') Then
42     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
43     fnd_message.set_token('PROCEDURE', l_proc);
44     fnd_message.set_token('STEP','25');
45     fnd_message.raise_error;
46   ElsIf (p_constraint_name = 'PAY_BDIM_FEED_CHECKING_TYP_CHK') Then
47     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
48     fnd_message.set_token('PROCEDURE', l_proc);
49     fnd_message.set_token('STEP','30');
50     fnd_message.raise_error;
51   ElsIf (p_constraint_name = 'PAY_BDIM_PAYMENTS_FLAG_CHK') Then
52     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
53     fnd_message.set_token('PROCEDURE', l_proc);
54     fnd_message.set_token('STEP','35');
55     fnd_message.raise_error;
56   Else
57     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
58     fnd_message.set_token('PROCEDURE', l_proc);
59     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
60     fnd_message.raise_error;
61   End If;
62   --
63 End constraint_error;
64 --
65 -- ----------------------------------------------------------------------------
66 -- |-----------------------------< api_updating >-----------------------------|
67 -- ----------------------------------------------------------------------------
68 Function api_updating
69   (p_balance_dimension_id                 in     number
70   )
71   Return Boolean Is
72   --
73   --
74   -- Cursor selects the 'current' row from the HR Schema
75   --
76   Cursor C_Sel1 is
77     select
78        balance_dimension_id
79       ,business_group_id
80       ,legislation_code
81       ,route_id
82       ,database_item_suffix
83       ,dimension_name
84       ,dimension_type
85       ,description
86       ,feed_checking_code
87       ,legislation_subgroup
88       ,payments_flag
89       ,expiry_checking_code
90       ,expiry_checking_level
91       ,feed_checking_type
92       ,dimension_level
93       ,period_type
94       ,asg_action_balance_dim_id
95       ,database_item_function
96       ,save_run_balance_enabled
97       ,start_date_code
98     from        pay_balance_dimensions
99     where       balance_dimension_id = p_balance_dimension_id;
100   --
101   l_fct_ret     boolean;
102   --
103 Begin
104   --
105   If (p_balance_dimension_id 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 (p_balance_dimension_id
114         = pay_bld_shd.g_old_rec.balance_dimension_id
115        ) Then
116       --
117       -- The g_old_rec is current therefore we must
118       -- set the returning function to true
119       --
120       l_fct_ret := true;
121     Else
122       --
123       -- Select the current row into g_old_rec
124       --
125       Open C_Sel1;
126       Fetch C_Sel1 Into pay_bld_shd.g_old_rec;
127       If C_Sel1%notfound Then
128         Close C_Sel1;
129         --
130         -- The primary key is invalid therefore we must error
131         --
132         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
133         fnd_message.raise_error;
134       End If;
135       Close C_Sel1;
136       --
137       l_fct_ret := true;
138     End If;
139   End If;
140   Return (l_fct_ret);
141 --
142 End api_updating;
143 --
144 -- ----------------------------------------------------------------------------
145 -- |---------------------------------< lck >----------------------------------|
146 -- ----------------------------------------------------------------------------
147 Procedure lck
148   (p_balance_dimension_id                 in     number
149   ) is
150 --
151 -- Cursor selects the 'current' row from the HR Schema
152 --
153   Cursor C_Sel1 is
154     select
155        balance_dimension_id
156       ,business_group_id
157       ,legislation_code
158       ,route_id
159       ,database_item_suffix
160       ,dimension_name
161       ,dimension_type
162       ,description
163       ,feed_checking_code
164       ,legislation_subgroup
165       ,payments_flag
166       ,expiry_checking_code
167       ,expiry_checking_level
168       ,feed_checking_type
169       ,dimension_level
170       ,period_type
171       ,asg_action_balance_dim_id
172       ,database_item_function
173       ,save_run_balance_enabled
174       ,start_date_code
175     from        pay_balance_dimensions
176     where       balance_dimension_id = p_balance_dimension_id
177     for update nowait;
178 --
179   l_proc        varchar2(72) := g_package||'lck';
180 --
181 Begin
182   hr_utility.set_location('Entering:'||l_proc, 5);
183   --
184   hr_api.mandatory_arg_error
185     (p_api_name           => l_proc
186     ,p_argument           => 'BALANCE_DIMENSION_ID'
187     ,p_argument_value     => p_balance_dimension_id
188     );
189   --
190   Open  C_Sel1;
191   Fetch C_Sel1 Into pay_bld_shd.g_old_rec;
192   If C_Sel1%notfound then
193     Close C_Sel1;
194     --
195     -- The primary key is invalid therefore we must error
196     --
197     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
198     fnd_message.raise_error;
199   End If;
200   Close C_Sel1;
201   --
202   --
203   hr_utility.set_location(' Leaving:'||l_proc, 10);
204   --
205   -- We need to trap the ORA LOCK exception
206   --
207 Exception
208   When HR_Api.Object_Locked then
209     --
210     -- The object is locked therefore we need to supply a meaningful
211     -- error message.
212     --
213     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
214     fnd_message.set_token('TABLE_NAME', 'pay_balance_dimensions');
215     fnd_message.raise_error;
216 End lck;
217 --
218 -- ----------------------------------------------------------------------------
219 -- |-----------------------------< convert_args >-----------------------------|
220 -- ----------------------------------------------------------------------------
221 Function convert_args
222   (p_balance_dimension_id           in number
223   ,p_business_group_id              in number
224   ,p_legislation_code               in varchar2
225   ,p_route_id                       in number
226   ,p_database_item_suffix           in varchar2
227   ,p_dimension_name                 in varchar2
228   ,p_dimension_type                 in varchar2
229   ,p_description                    in varchar2
230   ,p_feed_checking_code             in varchar2
231   ,p_legislation_subgroup           in varchar2
232   ,p_payments_flag                  in varchar2
233   ,p_expiry_checking_code           in varchar2
234   ,p_expiry_checking_level          in varchar2
235   ,p_feed_checking_type             in varchar2
236   ,p_dimension_level                in varchar2
237   ,p_period_type                    in varchar2
238   ,p_asg_action_balance_dim_id      in number
239   ,p_database_item_function         in varchar2
240   ,p_save_run_balance_enabled       in varchar2
241   ,p_start_date_code                in varchar2
242   )
243   Return g_rec_type is
244 --
245   l_rec   g_rec_type;
246 --
247 Begin
248   --
249   -- Convert arguments into local l_rec structure.
250   --
251   l_rec.balance_dimension_id             := p_balance_dimension_id;
252   l_rec.business_group_id                := p_business_group_id;
253   l_rec.legislation_code                 := p_legislation_code;
254   l_rec.route_id                         := p_route_id;
255   l_rec.database_item_suffix             := p_database_item_suffix;
256   l_rec.dimension_name                   := p_dimension_name;
257   l_rec.dimension_type                   := p_dimension_type;
258   l_rec.description                      := p_description;
259   l_rec.feed_checking_code               := p_feed_checking_code;
260   l_rec.legislation_subgroup             := p_legislation_subgroup;
261   l_rec.payments_flag                    := p_payments_flag;
262   l_rec.expiry_checking_code             := p_expiry_checking_code;
263   l_rec.expiry_checking_level            := p_expiry_checking_level;
264   l_rec.feed_checking_type               := p_feed_checking_type;
265   l_rec.dimension_level                  := p_dimension_level;
266   l_rec.period_type                      := p_period_type;
267   l_rec.asg_action_balance_dim_id        := p_asg_action_balance_dim_id;
268   l_rec.database_item_function           := p_database_item_function;
269   l_rec.save_run_balance_enabled         := p_save_run_balance_enabled;
270   l_rec.start_date_code                  := p_start_date_code;
271   --
272   -- Return the plsql record structure.
273   --
274   Return(l_rec);
275 --
276 End convert_args;
277 --
278 end pay_bld_shd;