DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SBA_SHD

Source


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