[Home] [Help]
PACKAGE BODY: APPS.PQH_TAH_SHD
Source
1 Package Body pqh_tah_shd as
2 /* $Header: pqtahrhi.pkb 120.2 2005/12/21 11:27:52 hpandya noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_tah_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 = 'PQH_SS_APPROVAL_HISTORY_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_approval_history_id in number
40 ,p_transaction_history_id 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 approval_history_id
50 ,transaction_history_id
51 ,transaction_effective_date
52 ,action
53 ,user_name
54 ,transaction_item_type
55 ,transaction_item_key
56 ,effective_date_option
57 ,orig_system
58 ,orig_system_id
59 ,notification_id
60 ,user_comment
61 from pqh_ss_approval_history
62 where
63 approval_history_id = p_approval_history_id
64 and transaction_history_id = p_transaction_history_id;
65 --
66 l_fct_ret boolean;
67 --
68 Begin
69 --
70 If (p_approval_history_id is null and
71 p_transaction_history_id 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_approval_history_id
80 = pqh_tah_shd.g_old_rec.approval_history_id and
81 p_transaction_history_id
82 = pqh_tah_shd.g_old_rec.transaction_history_id
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 pqh_tah_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 --
105 l_fct_ret := true;
106 End If;
107 End If;
108 Return (l_fct_ret);
109 --
110 End api_updating;
111 --
112 -- ----------------------------------------------------------------------------
113 -- |---------------------------------< lck >----------------------------------|
114 -- ----------------------------------------------------------------------------
115 Procedure lck
116 (p_approval_history_id in number
117 ,p_transaction_history_id in number
118 ) is
119 --
120 -- Cursor selects the 'current' row from the HR Schema
121 --
122 Cursor C_Sel1 is
123 select
124 approval_history_id
125 ,transaction_history_id
126 ,transaction_effective_date
127 ,action
128 ,user_name
129 ,transaction_item_type
130 ,transaction_item_key
131 ,effective_date_option
132 ,orig_system
133 ,orig_system_id
134 ,notification_id
135 ,user_comment
136 from pqh_ss_approval_history
137 where
138 approval_history_id = p_approval_history_id
139 and transaction_history_id = p_transaction_history_id
140 for update nowait;
141 --
142 l_proc varchar2(72) := g_package||'lck';
143 --
144 Begin
145 hr_utility.set_location('Entering:'||l_proc, 5);
146 --
147 hr_api.mandatory_arg_error
148 (p_api_name => l_proc
149 ,p_argument => 'APPROVAL_HISTORY_ID'
150 ,p_argument_value => p_approval_history_id
151 );
152 hr_utility.set_location(l_proc,6);
153 hr_api.mandatory_arg_error
154 (p_api_name => l_proc
155 ,p_argument => 'TRANSACTION_HISTORY_ID'
156 ,p_argument_value => p_transaction_history_id
157 );
158 --
159 Open C_Sel1;
160 Fetch C_Sel1 Into pqh_tah_shd.g_old_rec;
161 If C_Sel1%notfound then
162 Close C_Sel1;
163 --
164 -- The primary key is invalid therefore we must error
165 --
166 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
167 fnd_message.raise_error;
168 End If;
169 Close C_Sel1;
170 --
171 --
172 hr_utility.set_location(' Leaving:'||l_proc, 10);
173 --
174 -- We need to trap the ORA LOCK exception
175 --
176 Exception
177 When HR_Api.Object_Locked then
178 --
179 -- The object is locked therefore we need to supply a meaningful
180 -- error message.
181 --
182 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
183 fnd_message.set_token('TABLE_NAME', 'pqh_ss_approval_history');
184 fnd_message.raise_error;
185 End lck;
186 --
187 -- ----------------------------------------------------------------------------
188 -- |-----------------------------< convert_args >-----------------------------|
189 -- ----------------------------------------------------------------------------
190 Function convert_args
191 (p_approval_history_id in number
192 ,p_transaction_history_id in number
193 ,p_transaction_effective_date in date
194 ,p_action in varchar2
195 ,p_user_name in varchar2
196 ,p_transaction_item_type in varchar2
197 ,p_transaction_item_key in varchar2
198 ,p_effective_date_option in varchar2
199 ,p_orig_system in varchar2
200 ,p_orig_system_id in number
201 ,p_notification_id in number
202 ,p_user_comment in varchar2
203 )
204 Return g_rec_type is
205 --
206 l_rec g_rec_type;
207 --
208 Begin
209 --
210 -- Convert arguments into local l_rec structure.
211 --
212 l_rec.approval_history_id := p_approval_history_id;
213 l_rec.transaction_history_id := p_transaction_history_id;
214 l_rec.transaction_effective_date := p_transaction_effective_date;
215 l_rec.action := p_action;
216 l_rec.user_name := p_user_name;
217 l_rec.transaction_item_type := p_transaction_item_type;
218 l_rec.transaction_item_key := p_transaction_item_key;
219 l_rec.effective_date_option := p_effective_date_option;
220 l_rec.orig_system := p_orig_system;
221 l_rec.orig_system_id := p_orig_system_id;
222 l_rec.notification_id := p_notification_id;
223 l_rec.user_comment := p_user_comment;
224 --
225 -- Return the plsql record structure.
226 --
227 Return(l_rec);
228 --
229 End convert_args;
230 --
231 end pqh_tah_shd;