[Home] [Help]
PACKAGE BODY: APPS.HR_SFT_SHD
Source
1 Package Body hr_sft_shd as
2 /* $Header: hrsftrhi.pkb 115.4 2003/10/23 01:45:00 bsubrama noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_sft_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 = 'HR_SOURCE_FORM_TEMPLATES_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 = 'HR_SOURCE_FORM_TEMPLATES_FK2') 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 = 'HR_SOURCE_FORM_TEMPLATES_PK') 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 = 'HR_SOURCE_FORM_TEMPLATES_UK') 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_source_form_template_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 source_form_template_id
65 ,object_version_number
66 ,form_template_id_to
67 ,form_template_id_from
68 from hr_source_form_templates
69 where source_form_template_id = p_source_form_template_id;
70 --
71 l_fct_ret boolean;
72 --
73 Begin
74 --
75 If (p_source_form_template_id is null and
76 p_object_version_number is null
77 ) Then
78 --
79 -- One of the primary key arguments is null therefore we must
80 -- set the returning function value to false
81 --
82 l_fct_ret := false;
83 Else
84 If (p_source_form_template_id
85 = hr_sft_shd.g_old_rec.source_form_template_id and
86 p_object_version_number
87 = hr_tdg_shd.g_old_rec.object_version_number
88 ) Then
89 --
90 -- The g_old_rec is current therefore we must
91 -- set the returning function to true
92 --
93 l_fct_ret := true;
94 Else
95 --
96 -- Select the current row into g_old_rec
97 --
98 Open C_Sel1;
99 Fetch C_Sel1 Into hr_sft_shd.g_old_rec;
100 If C_Sel1%notfound Then
101 Close C_Sel1;
102 --
103 -- The primary key is invalid therefore we must error
104 --
105 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
106 fnd_message.raise_error;
107 End If;
108 Close C_Sel1;
109 If (p_object_version_number
110 <> hr_tdg_shd.g_old_rec.object_version_number) Then
111 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
112 fnd_message.raise_error;
113 End If;
114 l_fct_ret := true;
115 End If;
116 End If;
117 Return (l_fct_ret);
118 --
119 End api_updating;
120 --
121 -- ----------------------------------------------------------------------------
122 -- |---------------------------------< lck >----------------------------------|
123 -- ----------------------------------------------------------------------------
124 Procedure lck
125 (p_source_form_template_id in number
126 ,p_object_version_number in number
127 ) is
128 --
129 -- Cursor selects the 'current' row from the HR Schema
130 --
131 Cursor C_Sel1 is
132 select
133 source_form_template_id
134 ,object_version_number
135 ,form_template_id_to
136 ,form_template_id_from
137 from hr_source_form_templates
138 where source_form_template_id = p_source_form_template_id
139 for update nowait;
140 --
141 l_proc varchar2(72) := g_package||'lck';
142 --
143 Begin
144 hr_utility.set_location('Entering:'||l_proc, 5);
145 --
146 hr_api.mandatory_arg_error
147 (p_api_name => l_proc
148 ,p_argument => 'SOURCE_FORM_TEMPLATE_ID'
149 ,p_argument_value => p_source_form_template_id
150 );
151 --
152 hr_api.mandatory_arg_error
153 (p_api_name => l_proc
154 ,p_argument => 'object_version_number'
155 ,p_argument_value => p_object_version_number
156 );
157 Open C_Sel1;
158 Fetch C_Sel1 Into hr_sft_shd.g_old_rec;
159 If C_Sel1%notfound then
160 Close C_Sel1;
161 --
162 -- The primary key is invalid therefore we must error
163 --
164 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
165 fnd_message.raise_error;
166 End If;
167 Close C_Sel1;
168 --
169 If (p_object_version_number
170 <> hr_tdg_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', 'hr_source_form_templates');
187 fnd_message.raise_error;
188 End lck;
189 --
190 -- ----------------------------------------------------------------------------
191 -- |-----------------------------< convert_args >-----------------------------|
192 -- ----------------------------------------------------------------------------
193 Function convert_args
194 (p_source_form_template_id in number
195 ,p_object_version_number in number
196 ,p_form_template_id_to in number
197 ,p_form_template_id_from in number
198 )
199 Return g_rec_type is
200 --
201 l_rec g_rec_type;
202 --
203 Begin
204 --
205 -- Convert arguments into local l_rec structure.
206 --
207 l_rec.source_form_template_id := p_source_form_template_id;
208 l_rec.object_version_number := p_object_version_number;
209 l_rec.form_template_id_to := p_form_template_id_to;
210 l_rec.form_template_id_from := p_form_template_id_from;
211 --
212 -- Return the plsql record structure.
213 --
214 Return(l_rec);
215 --
216 End convert_args;
217 --
218 end hr_sft_shd;