DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SGB_SHD

Source


1 Package Body pay_sgb_shd as
2 /* $Header: pysgbrhi.pkb 115.3 2003/02/05 17:11:07 arashid noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_sgb_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_SHADOW_GU_BAL_EXCLUSION_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_SHAD_GU_BAL_EXCLUSION_FK1') 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_SHAD_GU_BAL_EXCLUSION_FK2') 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_SHAD_GU_BAL_EXCLUSION_FK3') 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       ,source_id
66       ,source_type
67       ,balance_type_name
68       ,balance_type_id
69       ,exclusion_rule_id
70       ,object_version_number
71     from	pay_shadow_gu_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_sgb_shd.g_old_rec.grossup_balances_id and
89         p_object_version_number
90         = pay_sgb_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_sgb_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_sgb_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       ,source_id
138       ,source_type
139       ,balance_type_name
140       ,balance_type_id
141       ,exclusion_rule_id
142       ,object_version_number
143     from	pay_shadow_gu_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   hr_api.mandatory_arg_error
153     (p_api_name           => l_proc
154     ,p_argument           => 'GROSSUP_BALANCES_ID'
155     ,p_argument_value     => p_grossup_balances_id
156     );
157   --
158   Open  C_Sel1;
159   Fetch C_Sel1 Into pay_sgb_shd.g_old_rec;
160   If C_Sel1%notfound then
161     Close C_Sel1;
162     --
163     -- The primary key is invalid therefore we must error
164     --
165     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
166     fnd_message.raise_error;
167   End If;
168   Close C_Sel1;
169   If (p_object_version_number
170       <> pay_sgb_shd.g_old_rec.object_version_number) Then
171         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
172         fnd_message.raise_error;
173   End If;
174   --
175   hr_utility.set_location(' Leaving:'||l_proc, 10);
176   --
177   -- We need to trap the ORA LOCK exception
178   --
179 Exception
180   When HR_Api.Object_Locked then
181     --
182     -- The object is locked therefore we need to supply a meaningful
183     -- error message.
184     --
185     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
186     fnd_message.set_token('TABLE_NAME', 'pay_shadow_gu_bal_exclusions');
187     fnd_message.raise_error;
188 End lck;
189 --
190 -- ----------------------------------------------------------------------------
191 -- |-----------------------------< convert_args >-----------------------------|
192 -- ----------------------------------------------------------------------------
193 Function convert_args
194   (p_grossup_balances_id            in number
195   ,p_source_id                      in number
196   ,p_source_type                    in varchar2
197   ,p_balance_type_name              in varchar2
198   ,p_balance_type_id                in number
199   ,p_exclusion_rule_id              in number
200   ,p_object_version_number          in number
201   )
202   Return g_rec_type is
203 --
204   l_rec   g_rec_type;
205 --
206 Begin
207   --
208   -- Convert arguments into local l_rec structure.
209   --
210   l_rec.grossup_balances_id              := p_grossup_balances_id;
211   l_rec.source_id                        := p_source_id;
212   l_rec.source_type                      := p_source_type;
213   l_rec.balance_type_name                := p_balance_type_name;
214   l_rec.balance_type_id                  := p_balance_type_id;
215   l_rec.exclusion_rule_id                := p_exclusion_rule_id;
216   l_rec.object_version_number            := p_object_version_number;
217   --
218   -- Return the plsql record structure.
219   --
220   Return(l_rec);
221 --
222 End convert_args;
223 --
224 end pay_sgb_shd;