DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SSB_SHD

Source


1 Package Body per_ssb_shd as
2 /* $Header: pessbrhi.pkb 115.1 2003/08/06 01:25:57 kavenkat noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ssb_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 = 'PER_RI_SETUP_SUB_TASKS_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_setup_sub_task_code                  in     varchar2
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        setup_sub_task_code
50       ,setup_task_code
51       ,setup_sub_task_sequence
52       ,setup_sub_task_status
53       ,setup_sub_task_type
54       ,setup_sub_task_data_pump_link
55       ,setup_sub_task_action
56       ,setup_sub_task_creation_date
57       ,setup_sub_task_last_mod_date
58       ,legislation_code
59       ,object_version_number
60     from        per_ri_setup_sub_tasks
61     where       setup_sub_task_code = p_setup_sub_task_code;
62   --
63   l_fct_ret     boolean;
64   --
65 Begin
66   --
67   If (p_setup_sub_task_code is null and
68       p_object_version_number is null
69      ) Then
70     --
71     -- One of the primary key arguments is null therefore we must
72     -- set the returning function value to false
73     --
74     l_fct_ret := false;
75   Else
76     If (p_setup_sub_task_code
77         = per_ssb_shd.g_old_rec.setup_sub_task_code and
78         p_object_version_number
79         = per_ssb_shd.g_old_rec.object_version_number
80        ) Then
81       --
82       -- The g_old_rec is current therefore we must
83       -- set the returning function to true
84       --
85       l_fct_ret := true;
86     Else
87       --
88       -- Select the current row into g_old_rec
89       --
90       Open C_Sel1;
91       Fetch C_Sel1 Into per_ssb_shd.g_old_rec;
92       If C_Sel1%notfound Then
93         Close C_Sel1;
94         --
95         -- The primary key is invalid therefore we must error
96         --
97         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
98         fnd_message.raise_error;
99       End If;
100       Close C_Sel1;
101       If (p_object_version_number
102           <> per_ssb_shd.g_old_rec.object_version_number) Then
103         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
104         fnd_message.raise_error;
105       End If;
106       l_fct_ret := true;
107     End If;
108   End If;
109   Return (l_fct_ret);
110 --
111 End api_updating;
112 --
113 -- ----------------------------------------------------------------------------
114 -- |---------------------------------< lck >----------------------------------|
115 -- ----------------------------------------------------------------------------
116 Procedure lck
117   (p_setup_sub_task_code                  in     varchar2
118   ,p_object_version_number                in     number
119   ) is
120 --
121 -- Cursor selects the 'current' row from the HR Schema
122 --
123   Cursor C_Sel1 is
124     select
125        setup_sub_task_code
126       ,setup_task_code
127       ,setup_sub_task_sequence
128       ,setup_sub_task_status
129       ,setup_sub_task_type
130       ,setup_sub_task_data_pump_link
131       ,setup_sub_task_action
132       ,setup_sub_task_creation_date
133       ,setup_sub_task_last_mod_date
134       ,legislation_code
135       ,object_version_number
136     from        per_ri_setup_sub_tasks
137     where       setup_sub_task_code = p_setup_sub_task_code
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           => 'SETUP_SUB_TASK_CODE'
148     ,p_argument_value     => p_setup_sub_task_code
149     );
150   hr_utility.set_location(l_proc,6);
151   hr_api.mandatory_arg_error
152     (p_api_name           => l_proc
153     ,p_argument           => 'OBJECT_VERSION_NUMBER'
154     ,p_argument_value     => p_object_version_number
155     );
156   --
157   Open  C_Sel1;
158   Fetch C_Sel1 Into per_ssb_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   If (p_object_version_number
169       <> per_ssb_shd.g_old_rec.object_version_number) Then
173   --
170         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
171         fnd_message.raise_error;
172   End If;
174   hr_utility.set_location(' Leaving:'||l_proc, 10);
175   --
176   -- We need to trap the ORA LOCK exception
177   --
178 Exception
179   When HR_Api.Object_Locked then
180     --
181     -- The object is locked therefore we need to supply a meaningful
182     -- error message.
183     --
184     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
185     fnd_message.set_token('TABLE_NAME', 'per_ri_setup_sub_tasks');
186     fnd_message.raise_error;
187 End lck;
188 --
189 -- ----------------------------------------------------------------------------
190 -- |-----------------------------< convert_args >-----------------------------|
191 -- ----------------------------------------------------------------------------
192 Function convert_args
193   (p_setup_sub_task_code            in varchar2
194   ,p_setup_task_code                in varchar2
195   ,p_setup_sub_task_sequence        in number
196   ,p_setup_sub_task_status          in varchar2
197   ,p_setup_sub_task_type            in varchar2
198   ,p_setup_sub_task_data_pump_lin   in varchar2
199   ,p_setup_sub_task_action          in varchar2
200   ,p_setup_sub_task_creation_date   in date
201   ,p_setup_sub_task_last_mod_date   in date
202   ,p_legislation_code               in varchar2
203   ,p_object_version_number          in number
204   )
205   Return g_rec_type is
206 --
207   l_rec   g_rec_type;
208 --
209 Begin
210   --
211   -- Convert arguments into local l_rec structure.
212   --
213   l_rec.setup_sub_task_code              := p_setup_sub_task_code;
214   l_rec.setup_task_code                  := p_setup_task_code;
215   l_rec.setup_sub_task_sequence          := p_setup_sub_task_sequence;
216   l_rec.setup_sub_task_status            := p_setup_sub_task_status;
217   l_rec.setup_sub_task_type              := p_setup_sub_task_type;
218   l_rec.setup_sub_task_data_pump_link    := p_setup_sub_task_data_pump_lin;
219   l_rec.setup_sub_task_action            := p_setup_sub_task_action;
220   l_rec.setup_sub_task_creation_date     := p_setup_sub_task_creation_date;
221   l_rec.setup_sub_task_last_mod_date     := p_setup_sub_task_last_mod_date;
222   l_rec.legislation_code                 := p_legislation_code;
223   l_rec.object_version_number            := p_object_version_number;
224   --
225   -- Return the plsql record structure.
226   --
227   Return(l_rec);
228 --
229 End convert_args;
230 --
231 end per_ssb_shd;