DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PPE_SHD

Source


1 Package Body pay_ppe_shd as
2 /* $Header: pypperhi.pkb 115.2 2000/10/10 04:48:04 pkm ship        $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_ppe_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 = 'PROCESS_EVENT_ID_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_process_event_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        process_event_id
50       ,assignment_id
51       ,effective_date
52       ,change_type
53       ,status
54       ,description
55       ,object_version_number
56     from        pay_process_events
57     where       process_event_id = p_process_event_id;
58 --
59   l_fct_ret     boolean;
60 --
61 Begin
62   --
63   If (p_process_event_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_process_event_id
73         = pay_ppe_shd.g_old_rec.process_event_id and
74         p_object_version_number
75         = pay_ppe_shd.g_old_rec.object_version_number
76        ) Then
77       --
78       -- The g_old_rec is current therefore we must
79       -- set the returning function to true
80       --
81       l_fct_ret := true;
82     Else
83       --
84       -- Select the current row into g_old_rec
85       --
86       Open C_Sel1;
87       Fetch C_Sel1 Into pay_ppe_shd.g_old_rec;
88       If C_Sel1%notfound Then
89         Close C_Sel1;
90         --
91         -- The primary key is invalid therefore we must error
92         --
93         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
94         fnd_message.raise_error;
95       End If;
96       Close C_Sel1;
97       If (p_object_version_number
98           <> pay_ppe_shd.g_old_rec.object_version_number) Then
99         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
100         fnd_message.raise_error;
101       End If;
102       l_fct_ret := true;
103     End If;
104   End If;
105   Return (l_fct_ret);
106 --
107 End api_updating;
108 --
109 -- ----------------------------------------------------------------------------
110 -- |---------------------------------< lck >----------------------------------|
111 -- ----------------------------------------------------------------------------
112 Procedure lck
113   (p_process_event_id                     in     number
114   ,p_object_version_number                in     number
115   ) is
116 --
117 -- Cursor selects the 'current' row from the HR Schema
118 --
119   Cursor C_Sel1 is
120     select
121        process_event_id
122       ,assignment_id
123       ,effective_date
124       ,change_type
125       ,status
126       ,description
127       ,object_version_number
128     from        pay_process_events
129     where       process_event_id = p_process_event_id
130     for update nowait;
131 --
132   l_proc        varchar2(72) := g_package||'lck';
133 --
134 Begin
135   hr_utility.set_location('Entering:'||l_proc, 5);
136   --
137   hr_api.mandatory_arg_error
138     (p_api_name           => l_proc
139     ,p_argument           => 'PROCESS_EVENT_ID'
140     ,p_argument_value     => p_process_event_id
141     );
142   --
143   Open  C_Sel1;
144   Fetch C_Sel1 Into pay_ppe_shd.g_old_rec;
145   If C_Sel1%notfound then
146     Close C_Sel1;
147     --
148     -- The primary key is invalid therefore we must error
149     --
150     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
151     fnd_message.raise_error;
152   End If;
153   Close C_Sel1;
154   If (p_object_version_number
155       <> pay_ppe_shd.g_old_rec.object_version_number) Then
156         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
157         fnd_message.raise_error;
158   End If;
159   --
160   hr_utility.set_location(' Leaving:'||l_proc, 10);
161   --
162   -- We need to trap the ORA LOCK exception
163   --
164 Exception
165   When HR_Api.Object_Locked then
166     --
167     -- The object is locked therefore we need to supply a meaningful
168     -- error message.
169     --
170     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
171     fnd_message.set_token('TABLE_NAME', 'pay_process_events');
172     fnd_message.raise_error;
173 End lck;
174 --
175 -- ----------------------------------------------------------------------------
176 -- |-----------------------------< convert_args >-----------------------------|
177 -- ----------------------------------------------------------------------------
178 Function convert_args
179   (p_process_event_id               in number
180   ,p_assignment_id                  in number
181   ,p_effective_date                 in date
182   ,p_change_type                    in varchar2
183   ,p_status                         in varchar2
184   ,p_description                    in varchar2
185   ,p_object_version_number          in number
186   )
187   Return g_rec_type is
188 --
189   l_rec   g_rec_type;
190 --
191 Begin
192   --
193   -- Convert arguments into local l_rec structure.
194   --
195   l_rec.process_event_id                 := p_process_event_id;
196   l_rec.assignment_id                    := p_assignment_id;
197   l_rec.effective_date                   := p_effective_date;
198   l_rec.change_type                      := p_change_type;
199   l_rec.status                           := p_status;
200   l_rec.description                      := p_description;
201   l_rec.object_version_number            := p_object_version_number;
202   --
203   -- Return the plsql record structure.
204   --
205   Return(l_rec);
206 --
207 End convert_args;
208 --
209 end pay_ppe_shd;