DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BCM_SHD

Source


1 Package Body ben_bcm_shd as
2 /* $Header: bebcmrhi.pkb 115.2 2003/03/10 14:31:07 ssrayapu noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ben_bcm_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 = 'BEN_CWB_MATRIX_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_cwb_matrix_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        cwb_matrix_id
50       ,name
51       ,date_saved
52       ,plan_id
53       ,matrix_typ_cd
54       ,person_id
55       ,row_crit_cd
56       ,col_crit_cd
57       ,alct_by_cd
58       ,business_group_id
59       ,object_version_number
60     from        ben_cwb_matrix
61     where       cwb_matrix_id = p_cwb_matrix_id;
62   --
63   l_fct_ret     boolean;
64   --
65 Begin
66   --
67   If (p_cwb_matrix_id 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_cwb_matrix_id
77         = ben_bcm_shd.g_old_rec.cwb_matrix_id and
78         p_object_version_number
79         = ben_bcm_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 ben_bcm_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           <> ben_bcm_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_cwb_matrix_id                        in     number
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        cwb_matrix_id
126       ,name
127       ,date_saved
128       ,plan_id
129       ,matrix_typ_cd
130       ,person_id
131       ,row_crit_cd
132       ,col_crit_cd
133       ,alct_by_cd
134       ,business_group_id
135       ,object_version_number
136     from        ben_cwb_matrix
137     where       cwb_matrix_id = p_cwb_matrix_id
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           => 'CWB_MATRIX_ID'
148     ,p_argument_value     => p_cwb_matrix_id
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 ben_bcm_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       <> ben_bcm_shd.g_old_rec.object_version_number) Then
170         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
171         fnd_message.raise_error;
172   End If;
173   --
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', 'ben_cwb_matrix');
186     fnd_message.raise_error;
187 End lck;
188 --
189 -- ----------------------------------------------------------------------------
190 -- |-----------------------------< convert_args >-----------------------------|
191 -- ----------------------------------------------------------------------------
192 Function convert_args
193   (p_cwb_matrix_id                  in number
194   ,p_name                           in varchar2
195   ,p_date_saved                     in date
196   ,p_plan_id                        in number
197   ,p_matrix_typ_cd                  in varchar2
198   ,p_person_id                      in number
199   ,p_row_crit_cd                    in varchar2
200   ,p_col_crit_cd                    in varchar2
201   ,p_alct_by_cd                     in varchar2
202   ,p_business_group_id              in number
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.cwb_matrix_id                    := p_cwb_matrix_id;
214   l_rec.name                             := p_name;
215   l_rec.date_saved                       := p_date_saved;
216   l_rec.plan_id                          := p_plan_id;
217   l_rec.matrix_typ_cd                    := p_matrix_typ_cd;
218   l_rec.person_id                        := p_person_id;
219   l_rec.row_crit_cd                      := p_row_crit_cd;
220   l_rec.col_crit_cd                      := p_col_crit_cd;
221   l_rec.alct_by_cd                       := p_alct_by_cd;
222   l_rec.business_group_id                := p_business_group_id;
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 ben_bcm_shd;