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