DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_CBA_SHD

Source


1 Package Body ghr_cba_shd as
2 /* $Header: ghcbarhi.pkb 115.1 2003/01/30 19:25:00 asubrahm noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ghr_cba_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_BASES_FK') 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_BASES_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_basis_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_basis_id
55       ,compl_claim_id
56       ,basis
57       ,value
58       ,statute
59       ,agency_finding
60       ,aj_finding
61       ,object_version_number
62     from        ghr_compl_bases
63     where       compl_basis_id = p_compl_basis_id;
64   --
65   l_fct_ret     boolean;
66   --
67 Begin
68   --
69   If (p_compl_basis_id is null and
70       p_object_version_number is null
71      ) Then
72     --
73     -- One of the primary key arguments is null therefore we must
74     -- set the returning function value to false
75     --
76     l_fct_ret := false;
77   Else
78     If (p_compl_basis_id
79         = ghr_cba_shd.g_old_rec.compl_basis_id and
80         p_object_version_number
81         = ghr_cba_shd.g_old_rec.object_version_number
82        ) Then
83       --
84       -- The g_old_rec is current therefore we must
85       -- set the returning function to true
86       --
87       l_fct_ret := true;
88     Else
89       --
90       -- Select the current row into g_old_rec
91       --
92       Open C_Sel1;
93       Fetch C_Sel1 Into ghr_cba_shd.g_old_rec;
94       If C_Sel1%notfound Then
95         Close C_Sel1;
96         --
97         -- The primary key is invalid therefore we must error
98         --
99         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
100         fnd_message.raise_error;
101       End If;
102       Close C_Sel1;
103       If (p_object_version_number
104           <> ghr_cba_shd.g_old_rec.object_version_number) Then
105         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
106         fnd_message.raise_error;
107       End If;
108       l_fct_ret := true;
109     End If;
110   End If;
111   Return (l_fct_ret);
112 --
113 End api_updating;
114 --
115 -- ----------------------------------------------------------------------------
116 -- |---------------------------------< lck >----------------------------------|
117 -- ----------------------------------------------------------------------------
118 Procedure lck
119   (p_compl_basis_id                       in     number
120   ,p_object_version_number                in     number
121   ) is
122 --
123 -- Cursor selects the 'current' row from the HR Schema
124 --
125   Cursor C_Sel1 is
126     select
127        compl_basis_id
128       ,compl_claim_id
129       ,basis
130       ,value
131       ,statute
132       ,agency_finding
133       ,aj_finding
134       ,object_version_number
135     from        ghr_compl_bases
136     where       compl_basis_id = p_compl_basis_id
137     for update nowait;
138 --
139   l_proc        varchar2(72) := g_package||'lck';
140 --
141 Begin
142   hr_utility.set_location('Entering:'||l_proc, 5);
143   --
144   hr_api.mandatory_arg_error
145     (p_api_name           => l_proc
146     ,p_argument           => 'COMPL_BASIS_ID'
147     ,p_argument_value     => p_compl_basis_id
148     );
149   hr_utility.set_location(l_proc,6);
150   hr_api.mandatory_arg_error
151     (p_api_name           => l_proc
152     ,p_argument           => 'OBJECT_VERSION_NUMBER'
153     ,p_argument_value     => p_object_version_number
154     );
155   --
156   Open  C_Sel1;
157   Fetch C_Sel1 Into ghr_cba_shd.g_old_rec;
158   If C_Sel1%notfound then
159     Close C_Sel1;
160     --
161     -- The primary key is invalid therefore we must error
162     --
163     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
164     fnd_message.raise_error;
165   End If;
166   Close C_Sel1;
167   If (p_object_version_number
168       <> ghr_cba_shd.g_old_rec.object_version_number) Then
169         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
170         fnd_message.raise_error;
171   End If;
172   --
173   hr_utility.set_location(' Leaving:'||l_proc, 10);
174   --
175   -- We need to trap the ORA LOCK exception
176   --
177 Exception
178   When HR_Api.Object_Locked then
179     --
180     -- The object is locked therefore we need to supply a meaningful
181     -- error message.
182     --
183     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
184     fnd_message.set_token('TABLE_NAME', 'ghr_compl_bases');
185     fnd_message.raise_error;
186 End lck;
187 --
188 -- ----------------------------------------------------------------------------
189 -- |-----------------------------< convert_args >-----------------------------|
190 -- ----------------------------------------------------------------------------
191 Function convert_args
192   (p_compl_basis_id                 in number
193   ,p_compl_claim_id                 in number
194   ,p_basis                          in varchar2
195   ,p_value                          in varchar2
196   ,p_statute                        in varchar2
197   ,p_agency_finding                 in varchar2
198   ,p_aj_finding                     in varchar2
199   ,p_object_version_number          in number
200   )
201   Return g_rec_type is
202 --
203   l_rec   g_rec_type;
204 --
205 Begin
206   --
207   -- Convert arguments into local l_rec structure.
208   --
209   l_rec.compl_basis_id                   := p_compl_basis_id;
210   l_rec.compl_claim_id                   := p_compl_claim_id;
211   l_rec.basis                            := p_basis;
212   l_rec.value                            := p_value;
213   l_rec.statute                          := p_statute;
214   l_rec.agency_finding                   := p_agency_finding;
215   l_rec.aj_finding                       := p_aj_finding;
216   l_rec.object_version_number            := p_object_version_number;
217   --
218   -- Return the plsql record structure.
219   --
220   Return(l_rec);
221 --
222 End convert_args;
223 --
224 end ghr_cba_shd;