[Home] [Help]
PACKAGE BODY: APPS.PO_ACCOUNT_HELPER
Source
1 PACKAGE BODY PO_ACCOUNT_HELPER AS
2 -- $Header: PO_ACCOUNT_HELPER.plb 120.1 2005/08/31 16:57 jmellen noship $
3
4 -----------------------------------------------------------------------
5 -- Procedure: build_accounts
6 --
7 -- Wrapper around PO_WF_BUILD_ACCOUNT_INIT, which creates Award
8 -- Distributions through the GMS API when Grants is used. The
9 -- award distributions are temporary, and will be rolled back
10 -- after the workflow has run.
11 --
12 -- Params of note:
13 --
14 -- @param po_distribution_id
15 -- The distribution to generate accounts for.
16 --
17 -- @param p_award_number
18 -- The current displayed award number.
19 --
20 -- @return
21 -- See return value for PO_WF_BUILD_ACCOUNT_INIT.start_workflow.
22 --
23 -- @depends PO_GMS_INTEGRATION_PVT.maintain_po_adl(),
24 -- PO_WF_BUILD_ACCOUNT_INIT.start_workflow()
25 -----------------------------------------------------------------------
26 FUNCTION build_accounts(
27 x_purchasing_ou_id IN NUMBER -- POU's org ID
28 , x_transaction_flow_header_id IN NUMBER
29 , x_dest_charge_success IN OUT NOCOPY BOOLEAN
30 , x_dest_variance_success IN OUT NOCOPY BOOLEAN
31 , x_dest_charge_account_id IN OUT NOCOPY NUMBER
32 , x_dest_variance_account_id IN OUT NOCOPY NUMBER
33 , x_dest_charge_account_desc IN OUT NOCOPY VARCHAR2
34 , x_dest_variance_account_desc IN OUT NOCOPY VARCHAR2
35 , x_dest_charge_account_flex IN OUT NOCOPY VARCHAR2
36 , x_dest_variance_account_flex IN OUT NOCOPY VARCHAR2
37
38 , x_charge_success IN OUT NOCOPY BOOLEAN
39 , x_budget_success IN OUT NOCOPY BOOLEAN
40 , x_accrual_success IN OUT NOCOPY BOOLEAN
41 , x_variance_success IN OUT NOCOPY BOOLEAN
42 , x_code_combination_id IN OUT NOCOPY NUMBER
43 , x_budget_account_id IN OUT NOCOPY NUMBER
44 , x_accrual_account_id IN OUT NOCOPY NUMBER
45 , x_variance_account_id IN OUT NOCOPY NUMBER
46 , x_charge_account_flex IN OUT NOCOPY VARCHAR2
47 , x_budget_account_flex IN OUT NOCOPY VARCHAR2
48 , x_accrual_account_flex IN OUT NOCOPY VARCHAR2
49 , x_variance_account_flex IN OUT NOCOPY VARCHAR2
50 , x_charge_account_desc IN OUT NOCOPY VARCHAR2
51 , x_budget_account_desc IN OUT NOCOPY VARCHAR2
52 , x_accrual_account_desc IN OUT NOCOPY VARCHAR2
53 , x_variance_account_desc IN OUT NOCOPY VARCHAR2
54 , x_coa_id NUMBER
55 , x_bom_resource_id NUMBER
56 , x_bom_cost_element_id NUMBER
57 , x_category_id NUMBER
58 , x_destination_type_code VARCHAR2
59 , x_deliver_to_location_id NUMBER
60 , x_destination_organization_id NUMBER
61 , x_destination_subinventory VARCHAR2
62 , x_expenditure_type VARCHAR2
63 , x_expenditure_organization_id NUMBER
64 , x_expenditure_item_date DATE
65 , x_item_id NUMBER
66 , x_line_type_id NUMBER
67 , x_result_billable_flag VARCHAR2
68 , x_agent_id NUMBER
69 , x_project_id NUMBER
70 , x_from_type_lookup_code VARCHAR2
71 , x_from_header_id NUMBER
72 , x_from_line_id NUMBER
73 , x_task_id NUMBER
74 , x_deliver_to_person_id NUMBER
75 , x_type_lookup_code VARCHAR2
76 , x_vendor_id NUMBER
77 , x_wip_entity_id NUMBER
78 , x_wip_entity_type VARCHAR2
79 , x_wip_line_id NUMBER
80 , x_wip_repetitive_schedule_id NUMBER
81 , x_wip_operation_seq_num NUMBER
82 , x_wip_resource_seq_num NUMBER
83 , x_po_encumberance_flag VARCHAR2
84 , x_gl_encumbered_date DATE
85
86 , wf_itemkey IN OUT NOCOPY VARCHAR2
87 , x_new_combination IN OUT NOCOPY BOOLEAN
88
89 , header_att1 VARCHAR2
90 , header_att2 VARCHAR2
91 , header_att3 VARCHAR2
92 , header_att4 VARCHAR2
93 , header_att5 VARCHAR2
94 , header_att6 VARCHAR2
95 , header_att7 VARCHAR2
96 , header_att8 VARCHAR2
97 , header_att9 VARCHAR2
98 , header_att10 VARCHAR2
99 , header_att11 VARCHAR2
100 , header_att12 VARCHAR2
101 , header_att13 VARCHAR2
102 , header_att14 VARCHAR2
103 , header_att15 VARCHAR2
104
105 , line_att1 VARCHAR2
106 , line_att2 VARCHAR2
107 , line_att3 VARCHAR2
108 , line_att4 VARCHAR2
109 , line_att5 VARCHAR2
110 , line_att6 VARCHAR2
111 , line_att7 VARCHAR2
112 , line_att8 VARCHAR2
113 , line_att9 VARCHAR2
114 , line_att10 VARCHAR2
115 , line_att11 VARCHAR2
116 , line_att12 VARCHAR2
117 , line_att13 VARCHAR2
118 , line_att14 VARCHAR2
119 , line_att15 VARCHAR2
120
121 , shipment_att1 VARCHAR2
122 , shipment_att2 VARCHAR2
123 , shipment_att3 VARCHAR2
124 , shipment_att4 VARCHAR2
125 , shipment_att5 VARCHAR2
126 , shipment_att6 VARCHAR2
127 , shipment_att7 VARCHAR2
128 , shipment_att8 VARCHAR2
129 , shipment_att9 VARCHAR2
130 , shipment_att10 VARCHAR2
131 , shipment_att11 VARCHAR2
132 , shipment_att12 VARCHAR2
133 , shipment_att13 VARCHAR2
134 , shipment_att14 VARCHAR2
135 , shipment_att15 VARCHAR2
136
137 , distribution_att1 VARCHAR2
138 , distribution_att2 VARCHAR2
139 , distribution_att3 VARCHAR2
140 , distribution_att4 VARCHAR2
141 , distribution_att5 VARCHAR2
142 , distribution_att6 VARCHAR2
143 , distribution_att7 VARCHAR2
144 , distribution_att8 VARCHAR2
145 , distribution_att9 VARCHAR2
146 , distribution_att10 VARCHAR2
147 , distribution_att11 VARCHAR2
148 , distribution_att12 VARCHAR2
149 , distribution_att13 VARCHAR2
150 , distribution_att14 VARCHAR2
151 , distribution_att15 VARCHAR2
152
153 , FB_ERROR_MSG IN OUT NOCOPY VARCHAR2
154 , p_distribution_type IN VARCHAR2 DEFAULT NULL
155 , p_payment_type IN VARCHAR2 DEFAULT NULL
156 , x_award_id NUMBER DEFAULT NULL
157 , x_vendor_site_id NUMBER DEFAULT NULL
158 , p_func_unit_price IN NUMBER DEFAULT NULL
159 , p_distribution_id IN NUMBER --<HTML Orders/Agreements R12>
160 , p_award_number IN VARCHAR2 --<HTML Orders/Agreements R12>
161 ) RETURN BOOLEAN
162 IS
163 l_award_set_id NUMBER;
164 l_gms_processing_required BOOLEAN;
165 l_success BOOLEAN;
166
167 BEGIN
168
169 -- establish savepoint to roll back to (general exception)
170 SAVEPOINT PO_ACCOUNT_HELPER_BEGIN_SP;
171
172 l_gms_processing_required := (p_award_number IS NOT NULL);
173
174 IF l_gms_processing_required THEN
175
176 -- savepoint for award distribution creation
177 SAVEPOINT PO_ACCOUNT_HELPER_GMS_SP;
178
179 -- Create/update the Award Distributions before calling the Account
180 -- Generator.
181 PO_GMS_INTEGRATION_PVT.maintain_po_adl(
182 p_dml_operation => PO_GMS_INTEGRATION_PVT.c_DML_OPERATION_DELETE
183 , p_dist_id => p_distribution_id
184 , p_project_id => x_project_id
185 , p_task_id => x_task_id
186 , p_award_number => p_award_number
187 , x_award_set_id => l_award_set_id
188 );
189
190 END IF;
191
192 -- call the Account Generator; award_id set to l_award_set_id; all
193 -- other parameters same as input parameters
194 l_success :=
195 PO_WF_BUILD_ACCOUNT_INIT.start_workflow(
196 x_purchasing_ou_id => x_purchasing_ou_id
197 , x_transaction_flow_header_id => x_transaction_flow_header_id
198 , x_dest_charge_success => x_dest_charge_success
199 , x_dest_variance_success => x_dest_variance_success
200 , x_dest_charge_account_id => x_dest_charge_account_id
201 , x_dest_variance_account_id => x_dest_variance_account_id
202 , x_dest_charge_account_desc => x_dest_charge_account_desc
203 , x_dest_variance_account_desc => x_dest_variance_account_desc
204 , x_dest_charge_account_flex => x_dest_charge_account_flex
205 , x_dest_variance_account_flex => x_dest_variance_account_flex
206 , x_charge_success => x_charge_success
207 , x_budget_success => x_budget_success
208 , x_accrual_success => x_accrual_success
209 , x_variance_success => x_variance_success
210 , x_code_combination_id => x_code_combination_id
211 , x_budget_account_id => x_budget_account_id
212 , x_accrual_account_id => x_accrual_account_id
213 , x_variance_account_id => x_variance_account_id
214 , x_charge_account_flex => x_charge_account_flex
215 , x_budget_account_flex => x_budget_account_flex
216 , x_accrual_account_flex => x_accrual_account_flex
217 , x_variance_account_flex => x_variance_account_flex
218 , x_charge_account_desc => x_charge_account_desc
219 , x_budget_account_desc => x_budget_account_desc
220 , x_accrual_account_desc => x_accrual_account_desc
221 , x_variance_account_desc => x_variance_account_desc
222 , x_coa_id => x_coa_id
223 , x_bom_resource_id => x_bom_resource_id
224 , x_bom_cost_element_id => x_bom_cost_element_id
225 , x_category_id => x_category_id
226 , x_destination_type_code => x_destination_type_code
227 , x_deliver_to_location_id => x_deliver_to_location_id
228 , x_destination_organization_id => x_destination_organization_id
229 , x_destination_subinventory => x_destination_subinventory
230 , x_expenditure_type => x_expenditure_type
231 , x_expenditure_organization_id => x_expenditure_organization_id
232 , x_expenditure_item_date => x_expenditure_item_date
233 , x_item_id => x_item_id
234 , x_line_type_id => x_line_type_id
235 , x_result_billable_flag => x_result_billable_flag
236 , x_agent_id => x_agent_id
237 , x_project_id => x_project_id
238 , x_from_type_lookup_code => x_from_type_lookup_code
239 , x_from_header_id => x_from_header_id
240 , x_from_line_id => x_from_line_id
241 , x_task_id => x_task_id
242 , x_deliver_to_person_id => x_deliver_to_person_id
243 , x_type_lookup_code => x_type_lookup_code
244 , x_vendor_id => x_vendor_id
245 , x_wip_entity_id => x_wip_entity_id
246 , x_wip_entity_type => x_wip_entity_type
247 , x_wip_line_id => x_wip_line_id
248 , x_wip_repetitive_schedule_id => x_wip_repetitive_schedule_id
249 , x_wip_operation_seq_num => x_wip_operation_seq_num
250 , x_wip_resource_seq_num => x_wip_resource_seq_num
251 , x_po_encumberance_flag => x_po_encumberance_flag
252 , x_gl_encumbered_date => x_gl_encumbered_date
253 , wf_itemkey => wf_itemkey
254 , x_new_combination => x_new_combination
255 , header_att1 => header_att1
256 , header_att2 => header_att2
257 , header_att3 => header_att3
258 , header_att4 => header_att4
259 , header_att5 => header_att5
260 , header_att6 => header_att6
261 , header_att7 => header_att7
262 , header_att8 => header_att8
263 , header_att9 => header_att9
264 , header_att10 => header_att10
265 , header_att11 => header_att11
266 , header_att12 => header_att12
267 , header_att13 => header_att13
268 , header_att14 => header_att14
269 , header_att15 => header_att15
270 , line_att1 => line_att1
271 , line_att2 => line_att2
272 , line_att3 => line_att3
273 , line_att4 => line_att4
274 , line_att5 => line_att5
275 , line_att6 => line_att6
276 , line_att7 => line_att7
277 , line_att8 => line_att8
278 , line_att9 => line_att9
279 , line_att10 => line_att10
280 , line_att11 => line_att11
281 , line_att12 => line_att12
282 , line_att13 => line_att13
283 , line_att14 => line_att14
284 , line_att15 => line_att15
285 , shipment_att1 => shipment_att1
286 , shipment_att2 => shipment_att2
287 , shipment_att3 => shipment_att3
288 , shipment_att4 => shipment_att4
289 , shipment_att5 => shipment_att5
290 , shipment_att6 => shipment_att6
291 , shipment_att7 => shipment_att7
292 , shipment_att8 => shipment_att8
293 , shipment_att9 => shipment_att9
294 , shipment_att10 => shipment_att10
295 , shipment_att11 => shipment_att11
296 , shipment_att12 => shipment_att12
297 , shipment_att13 => shipment_att13
298 , shipment_att14 => shipment_att14
299 , shipment_att15 => shipment_att15
300 , distribution_att1 => distribution_att1
301 , distribution_att2 => distribution_att2
302 , distribution_att3 => distribution_att3
303 , distribution_att4 => distribution_att4
304 , distribution_att5 => distribution_att5
305 , distribution_att6 => distribution_att6
306 , distribution_att7 => distribution_att7
307 , distribution_att8 => distribution_att8
308 , distribution_att9 => distribution_att9
309 , distribution_att10 => distribution_att10
310 , distribution_att11 => distribution_att11
311 , distribution_att12 => distribution_att12
312 , distribution_att13 => distribution_att13
313 , distribution_att14 => distribution_att14
314 , distribution_att15 => distribution_att15
315 , FB_ERROR_MSG => FB_ERROR_MSG
316 , p_distribution_type => p_distribution_type
317 , p_payment_type => p_payment_type
318 , x_award_id => l_award_set_id
319 , x_vendor_site_id => x_vendor_site_id
320 , p_func_unit_price => p_func_unit_price
321 );
322
323 IF l_gms_processing_required THEN
324 -- Revert the Award Distribution changes back to the saved state.
325 ROLLBACK TO PO_ACCOUNT_HELPER_GMS_SP;
326 END IF;
327
328 RETURN(l_success);
329
330 EXCEPTION
331 WHEN OTHERS THEN
332 ROLLBACK TO PO_ACCOUNT_HELPER_BEGIN_SP;
333 RAISE;
334
335 END build_accounts;
336
337 END PO_ACCOUNT_HELPER;