DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_TXH_SHD

Source


1 Package Body pqh_txh_shd as
2 /* $Header: pqtxhrhi.pkb 120.2 2005/12/21 11:29:59 hpandya noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_txh_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 = 'PQH_SS_TRANSACTION_HISTORY_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_transaction_history_id               in     number
40   )
41   Return Boolean Is
42   --
43   --
44   -- Cursor selects the 'current' row from the HR Schema
45   --
46   Cursor C_Sel1 is
47     select
48        transaction_history_id
49       ,creator_person_id
50       ,assignment_id
51       ,selected_person_id
52       ,item_type
53       ,item_key
54       ,process_name
55       ,approval_item_type
56       ,approval_item_key
57       ,function_id
58       ,rptg_grp_id
59       ,plan_id
60       ,transaction_group
61       ,transaction_identifier
62     from        pqh_ss_transaction_history
63     where       transaction_history_id = p_transaction_history_id;
64   --
65   l_fct_ret     boolean;
66   --
67 Begin
68   --
69   If (p_transaction_history_id is null
70      ) Then
71     --
72     -- One of the primary key arguments is null therefore we must
73     -- set the returning function value to false
74     --
75     l_fct_ret := false;
76   Else
77     If (p_transaction_history_id
78         = pqh_txh_shd.g_old_rec.transaction_history_id
79        ) Then
80       --
81       -- The g_old_rec is current therefore we must
82       -- set the returning function to true
83       --
84       l_fct_ret := true;
85     Else
86       --
87       -- Select the current row into g_old_rec
88       --
89       Open C_Sel1;
90       Fetch C_Sel1 Into pqh_txh_shd.g_old_rec;
91       If C_Sel1%notfound Then
92         Close C_Sel1;
93         --
94         -- The primary key is invalid therefore we must error
95         --
96         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
97         fnd_message.raise_error;
98       End If;
99       Close C_Sel1;
100       --
101       l_fct_ret := true;
102     End If;
103   End If;
104   Return (l_fct_ret);
105 --
106 End api_updating;
107 --
108 -- ----------------------------------------------------------------------------
109 -- |---------------------------------< lck >----------------------------------|
110 -- ----------------------------------------------------------------------------
111 Procedure lck
112   (p_transaction_history_id               in     number
113   ) is
114 --
115 -- Cursor selects the 'current' row from the HR Schema
116 --
117   Cursor C_Sel1 is
118     select
119        transaction_history_id
120       ,creator_person_id
121       ,assignment_id
122       ,selected_person_id
123       ,item_type
124       ,item_key
125       ,process_name
126       ,approval_item_type
127       ,approval_item_key
128       ,function_id
129       ,rptg_grp_id
130       ,plan_id
131       ,transaction_group
132       ,transaction_identifier
133     from        pqh_ss_transaction_history
134     where       transaction_history_id = p_transaction_history_id
135     for update nowait;
136 --
137   l_proc        varchar2(72) := g_package||'lck';
138 --
139 Begin
140   hr_utility.set_location('Entering:'||l_proc, 5);
141   --
142   hr_api.mandatory_arg_error
143     (p_api_name           => l_proc
144     ,p_argument           => 'TRANSACTION_HISTORY_ID'
145     ,p_argument_value     => p_transaction_history_id
146     );
147   --
148   Open  C_Sel1;
149   Fetch C_Sel1 Into pqh_txh_shd.g_old_rec;
150   If C_Sel1%notfound then
151     Close C_Sel1;
152     --
153     -- The primary key is invalid therefore we must error
154     --
155     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
156     fnd_message.raise_error;
157   End If;
158   Close C_Sel1;
159   --
160   --
161   hr_utility.set_location(' Leaving:'||l_proc, 10);
162   --
163   -- We need to trap the ORA LOCK exception
164   --
165 Exception
166   When HR_Api.Object_Locked then
167     --
168     -- The object is locked therefore we need to supply a meaningful
169     -- error message.
170     --
171     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
172     fnd_message.set_token('TABLE_NAME', 'pqh_ss_transaction_history');
173     fnd_message.raise_error;
174 End lck;
175 --
176 -- ----------------------------------------------------------------------------
177 -- |-----------------------------< convert_args >-----------------------------|
178 -- ----------------------------------------------------------------------------
179 Function convert_args
180   (p_transaction_history_id         in number
181   ,p_creator_person_id              in number
182   ,p_assignment_id                  in number
183   ,p_selected_person_id             in number
184   ,p_item_type                      in varchar2
185   ,p_item_key                       in varchar2
186   ,p_process_name                   in varchar2
187   ,p_approval_item_type             in varchar2
188   ,p_approval_item_key              in varchar2
189   ,p_function_id                    in number
190   ,p_rptg_grp_id                    in number
191   ,p_plan_id                        in number
192   ,p_transaction_group              in varchar2
193   ,p_transaction_identifier         in varchar2
194   )
195   Return g_rec_type is
196 --
197   l_rec   g_rec_type;
198 --
199 Begin
200   --
201   -- Convert arguments into local l_rec structure.
202   --
203   l_rec.transaction_history_id           := p_transaction_history_id;
204   l_rec.creator_person_id                := p_creator_person_id;
205   l_rec.assignment_id                    := p_assignment_id;
206   l_rec.selected_person_id               := p_selected_person_id;
207   l_rec.item_type                        := p_item_type;
208   l_rec.item_key                         := p_item_key;
209   l_rec.process_name                     := p_process_name;
210   l_rec.approval_item_type               := p_approval_item_type;
211   l_rec.approval_item_key                := p_approval_item_key;
212   l_rec.function_id                      := p_function_id;
213   l_rec.rptg_grp_id                      := p_rptg_grp_id;
214   l_rec.plan_id                          := p_plan_id;
215   l_rec.transaction_group                := p_transaction_group;
216   l_rec.transaction_identifier           := p_transaction_identifier;
217   --
218   -- Return the plsql record structure.
219   --
220   Return(l_rec);
221 --
222 End convert_args;
223 --
224 end pqh_txh_shd;