[Home] [Help]
PACKAGE BODY: APPS.PQH_TSH_SHD
Source
1 Package Body pqh_tsh_shd as
2 /* $Header: pqtshrhi.pkb 120.2 2005/12/21 11:28:58 hpandya noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_tsh_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_TRANS_STATE_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_transaction_history_id in number
40 ,p_approval_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 transaction_history_id
50 ,approval_history_id
51 ,creator_person_id
52 ,creator_role
53 ,status
54 ,transaction_state
55 ,effective_date
56 ,effective_date_option
57 ,last_update_role
58 ,parent_transaction_id
59 ,relaunch_function
60 ,transaction_document
61 from pqh_ss_trans_state_history
62 where transaction_history_id = p_transaction_history_id
63 and approval_history_id = p_approval_history_id;
64 --
65 l_fct_ret boolean;
66 --
67 Begin
68 --
69 If (p_transaction_history_id is null and
70 p_approval_history_id is null
71 ) Then
72 --
73 -- One of the primary key arguments is null therefore we must
74 -- set the returning function value to false
75 --
76 l_fct_ret := false;
77 Else
78 If (p_transaction_history_id
79 = pqh_tsh_shd.g_old_rec.transaction_history_id and
80 p_approval_history_id
81 = pqh_tsh_shd.g_old_rec.approval_history_id
82 ) Then
83 --
84 -- The g_old_rec is current therefore we must
85 -- set the returning function to true
86 --
87 l_fct_ret := true;
88 Else
89 --
90 -- Select the current row into g_old_rec
91 --
92 Open C_Sel1;
93 Fetch C_Sel1 Into pqh_tsh_shd.g_old_rec;
94 If C_Sel1%notfound Then
95 Close C_Sel1;
96 --
97 -- The primary key is invalid therefore we must error
98 --
99 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
100 fnd_message.raise_error;
101 End If;
102 Close C_Sel1;
103 --
104 l_fct_ret := true;
105 End If;
106 End If;
107 Return (l_fct_ret);
108 --
109 End api_updating;
110 --
111 -- ----------------------------------------------------------------------------
112 -- |---------------------------------< lck >----------------------------------|
113 -- ----------------------------------------------------------------------------
114 Procedure lck
115 (p_transaction_history_id in number
116 ,p_approval_history_id in number
117 ) is
118 --
119 -- Cursor selects the 'current' row from the HR Schema
120 --
121 Cursor C_Sel1 is
122 select
123 transaction_history_id
124 ,approval_history_id
125 ,creator_person_id
126 ,creator_role
127 ,status
128 ,transaction_state
129 ,effective_date
130 ,effective_date_option
131 ,last_update_role
132 ,parent_transaction_id
133 ,relaunch_function
134 ,transaction_document
135 from pqh_ss_trans_state_history
136 where transaction_history_id = p_transaction_history_id
137 and approval_history_id = p_approval_history_id
138 for update nowait;
139 --
140 l_proc varchar2(72) := g_package||'lck';
141 --
142 Begin
143 hr_utility.set_location('Entering:'||l_proc, 5);
144 --
145 hr_api.mandatory_arg_error
146 (p_api_name => l_proc
147 ,p_argument => 'TRANSACTION_HISTORY_ID'
148 ,p_argument_value => p_transaction_history_id
149 );
150 hr_utility.set_location(l_proc,6);
151 hr_api.mandatory_arg_error
152 (p_api_name => l_proc
153 ,p_argument => 'approval_history_id'
154 ,p_argument_value => p_approval_history_id
155 );
156 --
157 Open C_Sel1;
158 Fetch C_Sel1 Into pqh_tsh_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 --
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', 'pqh_ss_trans_state_history');
182 fnd_message.raise_error;
183 End lck;
184 --
185 -- ----------------------------------------------------------------------------
186 -- |-----------------------------< convert_args >-----------------------------|
187 -- ----------------------------------------------------------------------------
188 Function convert_args
189 (p_transaction_history_id in number
190 ,p_approval_history_id in number
191 ,p_creator_person_id in number
192 ,p_creator_role in varchar2
193 ,p_status in varchar2
194 ,p_transaction_state in varchar2
195 ,p_effective_date in date
196 ,p_effective_date_option in varchar2
197 ,p_last_update_role in varchar2
198 ,p_parent_transaction_id in number
199 ,p_relaunch_function in varchar2
200 ,p_transaction_document in CLOB
201 )
202 Return g_rec_type is
203 --
204 l_rec g_rec_type;
205 --
206 Begin
207 --
208 -- Convert arguments into local l_rec structure.
209 --
210 l_rec.transaction_history_id := p_transaction_history_id;
211 l_rec.approval_history_id := p_approval_history_id;
212 l_rec.creator_person_id := p_creator_person_id;
213 l_rec.creator_role := p_creator_role;
214 l_rec.status := p_status;
215 l_rec.transaction_state := p_transaction_state;
216 l_rec.effective_date := p_effective_date;
217 l_rec.effective_date_option := p_effective_date_option;
218 l_rec.last_update_role := p_last_update_role;
219 l_rec.parent_transaction_id := p_parent_transaction_id;
220 l_rec.relaunch_function := p_relaunch_function;
221 l_rec.transaction_document := p_transaction_document;
222 --
223 -- Return the plsql record structure.
224 --
225 Return(l_rec);
226 --
227 End convert_args;
228 --
229 end pqh_tsh_shd;