DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_CDT_SHD

Source


1 Package Body ghr_cdt_shd as
2 /* $Header: ghcdtrhi.pkb 115.4 2003/01/30 19:25:13 asubrahm noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ghr_cdt_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 = 'GHR_COMPL_CA_DETAILS_FK1') 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   ElsIf (p_constraint_name = 'GHR_COMPL_CA_DETAILS_PK') Then
27     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('STEP','10');
30     fnd_message.raise_error;
31   Else
32     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33     fnd_message.set_token('PROCEDURE', l_proc);
34     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35     fnd_message.raise_error;
36   End If;
37   --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44   (p_compl_ca_detail_id                   in     number
45   ,p_object_version_number                in     number
46   )
47   Return Boolean Is
48   --
49   --
50   -- Cursor selects the 'current' row from the HR Schema
51   --
52   Cursor C_Sel1 is
53     select
54        compl_ca_detail_id
55       ,compl_ca_header_id
56       --,action
57       ,amount
58       ,order_date
59       ,due_date
60       ,request_date
61       ,complete_date
62       ,category
63       --,type
64       ,phase
65       ,action_type
66       ,payment_type
67       ,object_version_number
68       ,description
69     from        ghr_compl_ca_details
70     where       compl_ca_detail_id = p_compl_ca_detail_id;
71   --
72   l_fct_ret     boolean;
73   --
74 Begin
75   --
76   If (p_compl_ca_detail_id is null and
77       p_object_version_number is null
78      ) Then
79     --
80     -- One of the primary key arguments is null therefore we must
81     -- set the returning function value to false
82     --
83     l_fct_ret := false;
84   Else
85     If (p_compl_ca_detail_id
86         = ghr_cdt_shd.g_old_rec.compl_ca_detail_id and
87         p_object_version_number
88         = ghr_cdt_shd.g_old_rec.object_version_number
89        ) Then
90       --
91       -- The g_old_rec is current therefore we must
92       -- set the returning function to true
93       --
94       l_fct_ret := true;
95     Else
96       --
97       -- Select the current row into g_old_rec
98       --
99       Open C_Sel1;
100       Fetch C_Sel1 Into ghr_cdt_shd.g_old_rec;
101       If C_Sel1%notfound Then
102         Close C_Sel1;
103         --
104         -- The primary key is invalid therefore we must error
105         --
106         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
107         fnd_message.raise_error;
108       End If;
109       Close C_Sel1;
110       If (p_object_version_number
111           <> ghr_cdt_shd.g_old_rec.object_version_number) Then
112         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
113         fnd_message.raise_error;
114       End If;
115       l_fct_ret := true;
116     End If;
117   End If;
118   Return (l_fct_ret);
119 --
120 End api_updating;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |---------------------------------< lck >----------------------------------|
124 -- ----------------------------------------------------------------------------
125 Procedure lck
126   (p_compl_ca_detail_id                   in     number
127   ,p_object_version_number                in     number
128   ) is
129 --
130 -- Cursor selects the 'current' row from the HR Schema
131 --
132   Cursor C_Sel1 is
133     select
134        compl_ca_detail_id
135       ,compl_ca_header_id
136       --,action
137       ,amount
138       ,order_date
139       ,due_date
140       ,request_date
141       ,complete_date
142       ,category
143       --,type
144       ,phase
145       ,action_type
146       ,payment_type
147       ,object_version_number
148       ,description
149     from        ghr_compl_ca_details
150     where       compl_ca_detail_id = p_compl_ca_detail_id
151     for update nowait;
152 --
153   l_proc        varchar2(72) := g_package||'lck';
154 --
155 Begin
156   hr_utility.set_location('Entering:'||l_proc, 5);
157   --
158   hr_api.mandatory_arg_error
159     (p_api_name           => l_proc
160     ,p_argument           => 'COMPL_CA_DETAIL_ID'
161     ,p_argument_value     => p_compl_ca_detail_id
162     );
163   hr_utility.set_location(l_proc,6);
164   hr_api.mandatory_arg_error
165     (p_api_name           => l_proc
166     ,p_argument           => 'OBJECT_VERSION_NUMBER'
167     ,p_argument_value     => p_object_version_number
168     );
169   --
170   Open  C_Sel1;
171   Fetch C_Sel1 Into ghr_cdt_shd.g_old_rec;
172   If C_Sel1%notfound then
173     Close C_Sel1;
174     --
175     -- The primary key is invalid therefore we must error
176     --
177     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
178     fnd_message.raise_error;
179   End If;
180   Close C_Sel1;
181   If (p_object_version_number
182       <> ghr_cdt_shd.g_old_rec.object_version_number) Then
183         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
184         fnd_message.raise_error;
185   End If;
186   --
187   hr_utility.set_location(' Leaving:'||l_proc, 10);
188   --
189   -- We need to trap the ORA LOCK exception
190   --
191 Exception
192   When HR_Api.Object_Locked then
193     --
194     -- The object is locked therefore we need to supply a meaningful
195     -- error message.
196     --
197     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
198     fnd_message.set_token('TABLE_NAME', 'ghr_compl_ca_details');
199     fnd_message.raise_error;
200 End lck;
201 --
202 -- ----------------------------------------------------------------------------
203 -- |-----------------------------< convert_args >-----------------------------|
204 -- ----------------------------------------------------------------------------
205 Function convert_args
206   (p_compl_ca_detail_id             in number
207   ,p_compl_ca_header_id             in number
208   --,p_action                         in varchar2
209   ,p_amount                         in number
210   ,p_order_date                     in date
211   ,p_due_date                       in date
212   ,p_request_date                   in date
213   ,p_complete_date                  in date
214   ,p_category                       in varchar2
215   --,p_type                           in varchar2
216   ,p_phase                          in varchar2
217   ,p_action_type                    in varchar2
218   ,p_payment_type                   in varchar2
219   ,p_object_version_number          in number
220   ,p_description                    in varchar2
221   )
222   Return g_rec_type is
223 --
224   l_rec   g_rec_type;
225 --
226 Begin
227   --
228   -- Convert arguments into local l_rec structure.
229   --
230   l_rec.compl_ca_detail_id               := p_compl_ca_detail_id;
231   l_rec.compl_ca_header_id               := p_compl_ca_header_id;
232   --l_rec.action                           := p_action;
233   l_rec.amount                           := p_amount;
234   l_rec.order_date                       := p_order_date;
235   l_rec.due_date                         := p_due_date;
236   l_rec.request_date                     := p_request_date;
237   l_rec.complete_date                    := p_complete_date;
238   l_rec.category                         := p_category;
239   --l_rec.type                             := p_type;
240   l_rec.phase                            := p_phase;
241   l_rec.action_type                      := p_action_type;
242   l_rec.payment_type                     := p_payment_type;
243   l_rec.object_version_number            := p_object_version_number;
244   l_rec.description                      := p_description;
245   --
246   -- Return the plsql record structure.
247   --
248   Return(l_rec);
249 --
250 End convert_args;
251 --
252 end ghr_cdt_shd;