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