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