DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_GBE_SHD

Source


1 Package Body pay_gbe_shd as
2 /* $Header: pygberhi.pkb 120.1 2005/06/30 06:59:09 tukumar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_gbe_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_GROSSUP_BAL_EXCLUSIONS_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_GROSSUP_BAL_EXCLUSIONS_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_GROSSUP_BAL_EXCLUSIONS_UK1') 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_GBE_SOURCE_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   Else
42     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
43     fnd_message.set_token('PROCEDURE', l_proc);
44     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
45     fnd_message.raise_error;
46   End If;
47   --
48 End constraint_error;
49 --
50 -- ----------------------------------------------------------------------------
51 -- |-----------------------------< api_updating >-----------------------------|
52 -- ----------------------------------------------------------------------------
53 Function api_updating
54   (p_grossup_balances_id                  in     number
55   ,p_object_version_number                in     number
56   )
57   Return Boolean Is
58 --
59   --
60   -- Cursor selects the 'current' row from the HR Schema
61   --
62   Cursor C_Sel1 is
63     select
64        grossup_balances_id
65       ,start_date
66       ,end_date
67       ,source_id
68       ,source_type
69       ,balance_type_id
70       ,object_version_number
71     from	pay_grossup_bal_exclusions
72     where	grossup_balances_id = p_grossup_balances_id;
73 --
74   l_fct_ret	boolean;
75 --
76 Begin
77   --
78   If (p_grossup_balances_id is null and
79       p_object_version_number is null
80      ) Then
81     --
82     -- One of the primary key arguments is null therefore we must
83     -- set the returning function value to false
84     --
85     l_fct_ret := false;
86   Else
87     If (p_grossup_balances_id
88         = pay_gbe_shd.g_old_rec.grossup_balances_id and
89         p_object_version_number
90         = pay_gbe_shd.g_old_rec.object_version_number
91        ) Then
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 pay_gbe_shd.g_old_rec;
103       If C_Sel1%notfound Then
104         Close C_Sel1;
105         --
106         -- The primary key is invalid therefore we must error
107         --
108         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
109         fnd_message.raise_error;
110       End If;
111       Close C_Sel1;
112       If (p_object_version_number
113           <> pay_gbe_shd.g_old_rec.object_version_number) Then
114         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
115         fnd_message.raise_error;
116       End If;
117       l_fct_ret := true;
118     End If;
119   End If;
120   Return (l_fct_ret);
121 --
122 End api_updating;
123 --
124 -- ----------------------------------------------------------------------------
125 -- |---------------------------------< lck >----------------------------------|
126 -- ----------------------------------------------------------------------------
127 Procedure lck
128   (p_grossup_balances_id                  in     number
129   ,p_object_version_number                in     number
130   ) is
131 --
132 -- Cursor selects the 'current' row from the HR Schema
133 --
134   Cursor C_Sel1 is
135     select
136        grossup_balances_id
137       ,start_date
138       ,end_date
139       ,source_id
140       ,source_type
141       ,balance_type_id
142       ,object_version_number
143     from	pay_grossup_bal_exclusions
144     where	grossup_balances_id = p_grossup_balances_id
145     for	update nowait;
146 --
147   l_proc	varchar2(72) := g_package||'lck';
148 --
149 Begin
150   hr_utility.set_location('Entering:'||l_proc, 5);
151   --
152   -- Add any mandatory argument checking here:
153   -- Example:
154   -- hr_api.mandatory_arg_error
155   --   (p_api_name       => l_proc,
156   --    p_argument       => 'object_version_number',
157   --    p_argument_value => p_object_version_number);
158   --
159   hr_api.mandatory_arg_error
160     (p_api_name           => l_proc
161     ,p_argument           => 'GROSSUP_BALANCES_ID'
162     ,p_argument_value     => p_grossup_balances_id
163     );
164   --
165   Open  C_Sel1;
166   Fetch C_Sel1 Into pay_gbe_shd.g_old_rec;
167   If C_Sel1%notfound then
168     Close C_Sel1;
169     --
170     -- The primary key is invalid therefore we must error
171     --
172     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
173     fnd_message.raise_error;
174   End If;
175   Close C_Sel1;
176   If (p_object_version_number
177       <> pay_gbe_shd.g_old_rec.object_version_number) Then
178         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
179         fnd_message.raise_error;
180   End If;
181   --
182   hr_utility.set_location(' Leaving:'||l_proc, 10);
183   --
184   -- We need to trap the ORA LOCK exception
185   --
186 Exception
187   When HR_Api.Object_Locked then
188     --
189     -- The object is locked therefore we need to supply a meaningful
190     -- error message.
191     --
192     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
193     fnd_message.set_token('TABLE_NAME', 'pay_grossup_bal_exclusions');
194     fnd_message.raise_error;
195 End lck;
196 --
197 -- ----------------------------------------------------------------------------
198 -- |-----------------------------< convert_args >-----------------------------|
199 -- ----------------------------------------------------------------------------
200 Function convert_args
201   (p_grossup_balances_id            in number
202   ,p_start_date                     in date
203   ,p_end_date                       in date
204   ,p_source_id                      in number
205   ,p_source_type                    in varchar2
206   ,p_balance_type_id                in number
207   ,p_object_version_number          in number
208   )
209   Return g_rec_type is
210 --
211   l_rec   g_rec_type;
212 --
213 Begin
214   --
215   -- Convert arguments into local l_rec structure.
216   --
217   l_rec.grossup_balances_id              := p_grossup_balances_id;
218   l_rec.start_date                       := p_start_date;
219   l_rec.end_date                         := p_end_date;
220   l_rec.source_id                        := p_source_id;
221   l_rec.source_type                      := p_source_type;
222   l_rec.balance_type_id                  := p_balance_type_id;
223   l_rec.object_version_number            := p_object_version_number;
224   --
225   -- Return the plsql record structure.
226   --
227   Return(l_rec);
228 --
229 End convert_args;
230 --
231 end pay_gbe_shd;