DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_EGU_SHD

Source


1 Package Body pay_egu_shd as
2 /* $Header: pyegurhi.pkb 120.0 2005/09/26 09:28 tvankayl noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_egu_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_EVENT_GROUP_USAGES_PK') 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_EVENT_GROUP_USAGES_UK1') 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   Else
32     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35     fnd_message.raise_error;
36   End If;
37   --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44   (p_event_group_usage_id                 in     number
45   ,p_object_version_number                in     number
46   )
47   Return Boolean Is
48   --
49   --
50   -- Cursor selects the 'current' row from the HR Schema
51   --
52   Cursor C_Sel1 is
53     select
54        event_group_usage_id
55       ,event_group_id
56       ,element_set_id
57       ,business_group_id
58       ,legislation_code
59       ,object_version_number
60     from  pay_event_group_usages
61     where event_group_usage_id = p_event_group_usage_id;
62   --
63   l_fct_ret     boolean;
64   --
65 Begin
66   --
67   If (p_event_group_usage_id is null and
68       p_object_version_number is null
69      ) Then
70     --
71     -- One of the primary key arguments is null therefore we must
72     -- set the returning function value to false
73     --
74     l_fct_ret := false;
75   Else
76     If (p_event_group_usage_id
77         = pay_egu_shd.g_old_rec.event_group_usage_id and
78         p_object_version_number
79         = pay_egu_shd.g_old_rec.object_version_number
80        ) Then
81       --
82       -- The g_old_rec is current therefore we must
83       -- set the returning function to true
84       --
85       l_fct_ret := true;
86     Else
87       --
88       -- Select the current row into g_old_rec
89       --
90       Open C_Sel1;
91       Fetch C_Sel1 Into pay_egu_shd.g_old_rec;
92       If C_Sel1%notfound Then
93         Close C_Sel1;
94         --
95         -- The primary key is invalid therefore we must error
96         --
97         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
98         fnd_message.raise_error;
99       End If;
100       Close C_Sel1;
101       If (p_object_version_number
102           <> pay_egu_shd.g_old_rec.object_version_number) Then
103         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
104         fnd_message.raise_error;
105       End If;
106       l_fct_ret := true;
107     End If;
108   End If;
109   Return (l_fct_ret);
110 --
111 End api_updating;
112 --
113 -- ----------------------------------------------------------------------------
114 -- |---------------------------------< lck >----------------------------------|
115 -- ----------------------------------------------------------------------------
116 Procedure lck
117   (p_event_group_usage_id                 in     number
118   ,p_object_version_number                in     number
119   ) is
120 --
121 -- Cursor selects the 'current' row from the HR Schema
122 --
123   Cursor C_Sel1 is
124     select
125        event_group_usage_id
126       ,event_group_id
127       ,element_set_id
128       ,business_group_id
129       ,legislation_code
130       ,object_version_number
131     from   pay_event_group_usages
132     where  event_group_usage_id = p_event_group_usage_id
133     for update nowait;
134 --
135   l_proc        varchar2(72) := g_package||'lck';
136 --
137 Begin
138   hr_utility.set_location('Entering:'||l_proc, 5);
139   --
140   hr_api.mandatory_arg_error
141     (p_api_name           => l_proc
142     ,p_argument           => 'EVENT_GROUP_USAGE_ID'
143     ,p_argument_value     => p_event_group_usage_id
144     );
145 
146   hr_utility.set_location(l_proc,6);
147   hr_api.mandatory_arg_error
148     (p_api_name           => l_proc
149     ,p_argument           => 'OBJECT_VERSION_NUMBER'
150     ,p_argument_value     => p_object_version_number
151     );
152   --
153   Open  C_Sel1;
154   Fetch C_Sel1 Into pay_egu_shd.g_old_rec;
155   If C_Sel1%notfound then
156     Close C_Sel1;
157     --
158     -- The primary key is invalid therefore we must error
159     --
160     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
161     fnd_message.raise_error;
162   End If;
163   Close C_Sel1;
164   If (p_object_version_number
165       <> pay_egu_shd.g_old_rec.object_version_number) Then
166         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
167         fnd_message.raise_error;
168   End If;
169   --
170   hr_utility.set_location(' Leaving:'||l_proc, 10);
171   --
172   -- We need to trap the ORA LOCK exception
173   --
174 Exception
175   When HR_Api.Object_Locked then
176     --
177     -- The object is locked therefore we need to supply a meaningful
178     -- error message.
179     --
180     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
181     fnd_message.set_token('TABLE_NAME', 'pay_event_group_usages');
182     fnd_message.raise_error;
183 End lck;
184 --
185 -- ----------------------------------------------------------------------------
186 -- |-----------------------------< convert_args >-----------------------------|
187 -- ----------------------------------------------------------------------------
188 Function convert_args
189   (p_event_group_usage_id           in number
190   ,p_event_group_id                 in number
191   ,p_element_set_id                 in number
192   ,p_business_group_id              in number
193   ,p_legislation_code               in varchar2
194   ,p_object_version_number          in number
195   )
196   Return g_rec_type is
197 --
198   l_rec   g_rec_type;
199 --
200 Begin
201   --
202   -- Convert arguments into local l_rec structure.
203   --
204   l_rec.event_group_usage_id             := p_event_group_usage_id;
205   l_rec.event_group_id                   := p_event_group_id;
206   l_rec.element_set_id                   := p_element_set_id;
207   l_rec.business_group_id                := p_business_group_id;
208   l_rec.legislation_code                 := p_legislation_code;
209   l_rec.object_version_number            := p_object_version_number;
210   --
211   -- Return the plsql record structure.
212   --
213   Return(l_rec);
214 --
215 End convert_args;
216 --
217 end pay_egu_shd;