DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_DTY_SHD

Source


1 Package Body hr_dty_shd as
2 /* $Header: hrdtyrhi.pkb 120.0.12010000.2 2008/08/06 08:36:25 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_dty_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_DOCUMENT_TYPES_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_document_type_id                     in     number
40   ,p_object_version_number                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        document_type_id
50       ,system_document_type
51       ,category_code
52       ,sub_category_code
53       ,active_inactive_flag
54       ,multiple_occurences_flag
55       ,legislation_code
56       ,authorization_required
57       ,warning_period
58       ,request_id
59       ,program_application_id
60       ,program_id
61       ,program_update_date
62       ,object_version_number
63     from        hr_document_types
64     where       document_type_id = p_document_type_id;
65   --
66   l_fct_ret     boolean;
67   --
68 Begin
69   --
70   If (p_document_type_id 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_document_type_id
80         = hr_dty_shd.g_old_rec.document_type_id and
81         p_object_version_number
82         = hr_dty_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_dty_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_dty_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_document_type_id                     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        document_type_id
129       ,system_document_type
130       ,category_code
131       ,sub_category_code
132       ,active_inactive_flag
133       ,multiple_occurences_flag
134       ,legislation_code
135       ,authorization_required
136       ,warning_period
137       ,request_id
138       ,program_application_id
139       ,program_id
140       ,program_update_date
141       ,object_version_number
142     from        hr_document_types
143     where       document_type_id = p_document_type_id
144     for update nowait;
145 --
146   l_proc        varchar2(72) := g_package||'lck';
147 --
148 Begin
149   hr_utility.set_location('Entering:'||l_proc, 5);
150   --
151   hr_api.mandatory_arg_error
152     (p_api_name           => l_proc
153     ,p_argument           => 'DOCUMENT_TYPE_ID'
154     ,p_argument_value     => p_document_type_id
155     );
156   hr_utility.set_location(l_proc,6);
157   hr_api.mandatory_arg_error
158     (p_api_name           => l_proc
159     ,p_argument           => 'OBJECT_VERSION_NUMBER'
160     ,p_argument_value     => p_object_version_number
161     );
162   --
163   Open  C_Sel1;
164   Fetch C_Sel1 Into hr_dty_shd.g_old_rec;
165   If C_Sel1%notfound then
166     Close C_Sel1;
167     --
168     -- The primary key is invalid therefore we must error
169     --
170     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
171     fnd_message.raise_error;
172   End If;
173   Close C_Sel1;
174   If (p_object_version_number
175       <> hr_dty_shd.g_old_rec.object_version_number) Then
176         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
177         fnd_message.raise_error;
178   End If;
179   --
180   hr_utility.set_location(' Leaving:'||l_proc, 10);
181   --
182   -- We need to trap the ORA LOCK exception
183   --
184 Exception
185   When HR_Api.Object_Locked then
186     --
187     -- The object is locked therefore we need to supply a meaningful
188     -- error message.
189     --
190     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
191     fnd_message.set_token('TABLE_NAME', 'hr_document_types');
192     fnd_message.raise_error;
193 End lck;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< convert_args >-----------------------------|
197 -- ----------------------------------------------------------------------------
198 Function convert_args
199   (p_document_type_id               in number
200   ,p_system_document_type           in varchar2
201   ,p_category_code                  in varchar2
202   ,p_sub_category_code              in varchar2
203   ,p_active_inactive_flag           in varchar2
204   ,p_multiple_occurences_flag       in varchar2
205   ,p_legislation_code               in varchar2
206   ,p_authorization_required         in varchar2
207   ,p_warning_period                 in number
208   ,p_request_id                     in number
209   ,p_program_application_id         in number
210   ,p_program_id                     in number
211   ,p_program_update_date            in date
212   ,p_object_version_number          in number
213   )
214   Return g_rec_type is
215 --
216   l_rec   g_rec_type;
217 --
218 Begin
219   --
220   -- Convert arguments into local l_rec structure.
221   --
222   l_rec.document_type_id                 := p_document_type_id;
223   l_rec.system_document_type             := p_system_document_type;
224   l_rec.category_code                    := p_category_code;
225   l_rec.sub_category_code                := p_sub_category_code;
226   l_rec.active_inactive_flag             := p_active_inactive_flag;
227   l_rec.multiple_occurences_flag         := p_multiple_occurences_flag;
228   l_rec.legislation_code                 := p_legislation_code;
229   l_rec.authorization_required           := p_authorization_required;
230   l_rec.warning_period                   := p_warning_period;
231   l_rec.request_id                       := p_request_id;
232   l_rec.program_application_id           := p_program_application_id;
233   l_rec.program_id                       := p_program_id;
234   l_rec.program_update_date              := p_program_update_date;
235   l_rec.object_version_number            := p_object_version_number;
236   --
237   -- Return the plsql record structure.
238   --
239   Return(l_rec);
240 --
241 End convert_args;
242 --
243 end hr_dty_shd;