[Home] [Help]
PACKAGE BODY: APPS.PO_SETUP_S
Source
1 PACKAGE BODY PO_SETUP_S as
2 /* $Header: POXSES1B.pls 120.1.12010000.2 2008/11/11 11:23:55 bisdas ship $*/
3 /*============================= PO_SETUP_S ===============================*/
4
5 /*===========================================================================
6
7 FUNCTION NAME : get_flexbuilder_override
8
9 DESCRIPTION :
10
11 CLIENT/SERVER : SERVER
12
13 LIBRARY NAME :
14
15 OWNER : SUBHAJIT PURKAYASTHA
16
17 PARAMETERS :
18
19 ALGORITHM : Use fnd_profile.get function to get
20 'PA_ALLOW_FLEXBUILDER_OVERRIDE' status
21 if value is null then
22 set the value to 'N'
23
24 NOTES : Display pa_allow_flexbuilder_override is identified by
25 'PA_ALLOW_FLEXBUILDER_OVERRIDES'
26
27 Added sqlcode param in the call to po_message_s.sql_error
28 - SI 04/08
29
30 ===========================================================================*/
31 FUNCTION get_flexbuilder_override RETURN VARCHAR2 is
32 x_progress VARCHAR2(3) := NULL;
33 x_option_value VARCHAR2(1);
34 begin
35
36 x_progress := 10;
37
38 fnd_profile.get('PA_ALLOW_FLEXBUILDER_OVERRIDES',x_option_value);
39 if x_option_value is null then
40 x_option_value := 'N';
41 end if;
42
43 RETURN(x_option_value);
44
45 EXCEPTION
46 WHEN OTHERS THEN
47 po_message_s.sql_error('get_flexbuilder_override', x_progress, sqlcode);
48 RAISE;
49
50 end get_flexbuilder_override;
51 /*===========================================================================
52
53 FUNCTION NAME : get_display_inverse_rate
54
55 DESCRIPTION :
56
57 CLIENT/SERVER : SERVER
58
59 LIBRARY NAME :
60
61 OWNER : SUBHAJIT PURKAYASTHA
62
63 PARAMETERS :
64
65 ALGORITHM : Use fnd_profile.get function to get 'DISPLAY_INVERSE_RATE'
66 status
67 if value is null then
68 set the value to 'N'
69
70 NOTES : Display inverse rate is identified by 'DISPLAY_INVERSE_RATE'
71
72 ===========================================================================*/
73 FUNCTION get_display_inverse_rate RETURN VARCHAR2 is
74
75 x_progress VARCHAR2(3) := NULL;
76 x_option_value VARCHAR2(1);
77
78 begin
79
80 x_progress := 10;
81
82 fnd_profile.get('DISPLAY_INVERSE_RATE',x_option_value);
83 if x_option_value is null then
84 x_option_value := 'N';
85 end if;
86
87 RETURN(x_option_value);
88
89 EXCEPTION
90 WHEN OTHERS THEN
91 po_message_s.sql_error('get_display_inverse_rate', x_progress, sqlcode);
92 RAISE;
93
94 end get_display_inverse_rate;
95
96 /*==========================================================================
97 PROCEDURE NAME: get_startup_values()
98
99 ===========================================================================*/
100 PROCEDURE get_startup_values(x_sob_id IN OUT NOCOPY NUMBER,
101 x_inv_org_id IN OUT NOCOPY NUMBER,
102 x_ussgl_value OUT NOCOPY VARCHAR2 ,
103 x_flex_value OUT NOCOPY VARCHAR2,
104 x_inverse_rate_value OUT NOCOPY VARCHAR2,
105 x_period_name OUT NOCOPY VARCHAR2,
106 x_gl_date OUT NOCOPY DATE,
107 x_category_set_id OUT NOCOPY NUMBER,
108 x_structure_id OUT NOCOPY NUMBER,
109 x_user_id OUT NOCOPY NUMBER,
110 x_logonid OUT NOCOPY NUMBER,
111 x_creation_date OUT NOCOPY DATE,
112 x_update_date OUT NOCOPY DATE,
113 x_currency_code OUT NOCOPY VARCHAR2,
114 x_coa_id OUT NOCOPY NUMBER,
115 x_po_encumberance_flag OUT NOCOPY VARCHAR2,
116 x_req_encumberance_flag OUT NOCOPY VARCHAR2,
117 x_ship_to_location_id IN OUT NOCOPY NUMBER,
118 x_bill_to_location_id IN OUT NOCOPY NUMBER,
119 x_fob_lookup_code IN OUT NOCOPY VARCHAR2,
120 x_freight_terms_lookup_code IN OUT NOCOPY VARCHAR2,
121 x_terms_id IN OUT NOCOPY NUMBER,
122 x_default_rate_type IN OUT NOCOPY VARCHAR2,
123 x_taxable_flag OUT NOCOPY VARCHAR2,
124 x_receiving_flag OUT NOCOPY VARCHAR2,
125 x_enforce_buyer_name_flag OUT NOCOPY VARCHAR2,
126 x_enforce_buyer_auth_flag OUT NOCOPY VARCHAR2,
127 x_line_type_id IN OUT NOCOPY NUMBER,
128 x_manual_po_num_type OUT NOCOPY VARCHAR2,
129 x_po_num_code OUT NOCOPY VARCHAR2,
130 x_price_lookup_code OUT NOCOPY VARCHAR2,
131 x_invoice_close_tolerance OUT NOCOPY NUMBER,
132 x_receive_close_tolerance OUT NOCOPY NUMBER,
133 x_security_structure_id OUT NOCOPY NUMBER,
134 x_expense_accrual_code OUT NOCOPY VARCHAR2,
135 x_rev_sort_ordering OUT NOCOPY NUMBER,
136 x_min_rel_amount OUT NOCOPY NUMBER,
137 x_notify_blanket_flag OUT NOCOPY VARCHAR2,
138 x_budgetary_control_flag OUT NOCOPY VARCHAR2,
139 x_user_defined_req_num_code OUT NOCOPY VARCHAR2,
140 x_rfq_required_flag OUT NOCOPY VARCHAR2,
141 x_manual_req_num_type OUT NOCOPY VARCHAR2,
142 x_enforce_full_lot_qty OUT NOCOPY VARCHAR2,
143 x_disposition_warning_flag OUT NOCOPY VARCHAR2,
144 x_reserve_at_completion_flag OUT NOCOPY VARCHAR2,
145 x_user_defined_rcpt_num_code OUT NOCOPY VARCHAR2,
146 x_manual_rcpt_num_type OUT NOCOPY VARCHAR2,
147 x_use_positions_flag OUT NOCOPY VARCHAR2,
148 x_default_quote_warning_delay OUT NOCOPY NUMBER,
149 x_inspection_required_flag OUT NOCOPY VARCHAR2,
150 x_user_defined_quote_num_code OUT NOCOPY VARCHAR2,
151 x_manual_quote_num_type OUT NOCOPY VARCHAR2,
152 x_user_defined_rfq_num_code OUT NOCOPY VARCHAR2,
153 x_manual_rfq_num_type OUT NOCOPY VARCHAR2,
154 x_ship_via_lookup_code IN OUT NOCOPY VARCHAR2,
155 x_qty_rcv_tolerance OUT NOCOPY NUMBER,
156 x_line_type OUT NOCOPY VARCHAR2,
157 x_item_tax_override_popup OUT NOCOPY VARCHAR2,
158 x_item_account_override_popup OUT NOCOPY VARCHAR2,
159 x_curr_tax_override_popup OUT NOCOPY VARCHAR2,
160 x_curr_account_override_popup OUT NOCOPY VARCHAR2,
161 x_use_ap_accrual_account OUT NOCOPY VARCHAR2,
162 x_destination_expense OUT NOCOPY VARCHAR2,
163 x_destination_shop_floor OUT NOCOPY VARCHAR2,
164 x_legal_requisition_type OUT NOCOPY VARCHAR2,
165 x_req_source_internal OUT NOCOPY VARCHAR2,
166 x_req_source_purchase OUT NOCOPY VARCHAR2,
167 x_req_incomplete OUT NOCOPY VARCHAR2,
168 x_fob_disp OUT NOCOPY VARCHAR2,
169 x_freight_terms_disp OUT NOCOPY VARCHAR2,
170 x_internal_access OUT NOCOPY VARCHAR2,
171 x_purchase_access OUT NOCOPY VARCHAR2,
172 x_internal_security OUT NOCOPY VARCHAR2,
173 x_purchase_security OUT NOCOPY VARCHAR2,
174 x_employee_id OUT NOCOPY NUMBER,
175 x_employee_name OUT NOCOPY VARCHAR2,
176 x_employee_is_buyer_flag OUT NOCOPY VARCHAR2,
177 x_requestor_location_id IN OUT NOCOPY NUMBER,
178 x_bill_to_location IN OUT NOCOPY VARCHAR2,
179 x_ship_to_location IN OUT NOCOPY VARCHAR2,
180 x_ship_org_code IN OUT NOCOPY VARCHAR2,
181 x_ship_org_name IN OUT NOCOPY VARCHAR2,
182 x_default_rate_type_disp IN OUT NOCOPY VARCHAR2,
183 x_requestor_location IN OUT NOCOPY VARCHAR2,
184 x_requestor_org_id IN OUT NOCOPY NUMBER,
185 x_requestor_org IN OUT NOCOPY VARCHAR2,
186 x_requestor_org_code IN OUT NOCOPY VARCHAR2,
187 x_destination_inventory OUT NOCOPY VARCHAR2,
188 x_gl_set_of_bks_id OUT NOCOPY VARCHAR2,
189 x_acceptance_required_flag OUT NOCOPY VARCHAR2) is /* Bug 7518967 : Default Acceptance Required Check ER */
190
191 x_progress VARCHAR2(3) := NULL;
192 x_use_ap_disp_field VARCHAR2(80) := NULL;
193 x_fob_desc VARCHAR2(240) := NULL;
194 x_freight_terms_desc VARCHAR2(240) := NULL;
195 x_temp_terms_id NUMBER := NULL;
196 x_temp_ship_via_lookup_code VARCHAR2(25) := NULL;
197 x_is_emp BOOLEAN := NULL;
198 x_employee_is_buyer BOOLEAN := NULL;
199
200 /** PO UTF8 Column Expansion Project 9/18/2002 tpoon **/
201 /** Changed X_location_code to use %TYPE **/
202 -- x_location_code VARCHAR2(20) := NULL;
203 x_location_code hr_locations_all.location_code%TYPE := NULL;
204
205 x_org_id NUMBER := NULL;
206 x_rate_type VARCHAR2(30) := NULL;
207
208 BEGIN
209 x_progress := '5';
210 po_core_s.get_po_parameters(x_currency_code ,
211 x_coa_id ,
212 x_po_encumberance_flag ,
213 x_req_encumberance_flag ,
214 x_sob_id ,
215 x_ship_to_location_id ,
216 x_bill_to_location_id ,
217 x_fob_lookup_code ,
218 x_freight_terms_lookup_code,
219 x_temp_terms_id ,
220 x_default_rate_type ,
221 x_taxable_flag ,
222 x_receiving_flag ,
223 x_enforce_buyer_name_flag,
224 x_enforce_buyer_auth_flag,
225 x_line_type_id ,
226 x_manual_po_num_type ,
227 x_po_num_code ,
228 x_price_lookup_code ,
229 x_invoice_close_tolerance,
230 x_receive_close_tolerance,
231 x_security_structure_id,
232 x_expense_accrual_code,
233 x_inv_org_id ,
234 x_rev_sort_ordering,
235 x_min_rel_amount ,
236 x_notify_blanket_flag,
237 x_budgetary_control_flag,
238 x_user_defined_req_num_code,
239 x_rfq_required_flag,
240 x_manual_req_num_type,
241 x_enforce_full_lot_qty,
242 x_disposition_warning_flag,
243 x_reserve_at_completion_flag,
244 x_user_defined_rcpt_num_code,
245 x_manual_rcpt_num_type,
246 x_use_positions_flag,
247 x_default_quote_warning_delay,
248 x_inspection_required_flag,
249 x_user_defined_quote_num_code,
250 x_manual_quote_num_type,
251 x_user_defined_rfq_num_code,
252 x_manual_rfq_num_type,
253 x_temp_ship_via_lookup_code,
254 x_qty_rcv_tolerance,
255 x_acceptance_required_flag); /* Bug 7518967 : Default Acceptance Required Check ER */
256
257
258 -- dbms_output.put_line('Before Prog 10');
259
260 x_progress := '10';
261 x_ussgl_value := PO_CORE_S.Check_Federal_Instance(PO_MOAC_UTILS_PVT.Get_Current_Org_Id); --<R12 SLA>
262
263 -- dbms_output.put_line('Before Prog 20');
264
265 x_progress := '20';
266 x_flex_value := get_flexbuilder_override;
267
268 -- dbms_output.put_line('Before Prog 30');
269
270 x_progress := '30';
271 x_inverse_rate_value := get_display_inverse_rate;
272
273 -- dbms_output.put_line('Before Prog 40');
274
275 x_progress := '40';
276 po_core_s.get_period_name(x_sob_id,
277 x_period_name,
278 x_gl_date);
279
280 -- dbms_output.put_line('Before Prog 50');
281
282 x_progress := '50';
283 po_core_s.get_item_category_structure(x_category_set_id,x_structure_id);
284
285 -- dbms_output.put_line('Before Prog 60');
286
287 x_progress := '60';
288 po_core_s.get_global_values(x_user_id,x_logonid,x_update_date,x_creation_date);
289
290
291 x_progress := '70';
292 x_line_type := po_line_types_sv.get_line_type (x_line_type_id);
293
294
295 x_progress := '80';
296 po_core_s.get_displayed_value ('OVERRIDE DEFAULTS',
297 'ITEM',
298 x_item_tax_override_popup,
299 x_item_account_override_popup);
300
301 x_progress := '90';
302 po_core_s.get_displayed_value ('OVERRIDE DEFAULTS',
303 'CURRENT',
304 x_curr_tax_override_popup,
305 x_curr_account_override_popup);
306
307
308 x_progress := '100';
309 po_core_s.get_displayed_value ('OVERRIDE DEFAULTS',
310 'AP ACCRUAL',
311 x_use_ap_disp_field,
312 x_use_ap_accrual_account);
313
314
315 x_progress := '110';
316 po_core_s.get_displayed_value ('DESTINATION TYPE',
317 'EXPENSE',
318 x_destination_expense);
319
320
321 x_progress := '120';
322 po_core_s.get_displayed_value ('RCV DESTINATION TYPE',
323 'SHOP FLOOR',
324 x_destination_shop_floor);
325
326
327 x_progress := '130';
328 fnd_profile.get ('REQUISITION_TYPE', x_legal_requisition_type);
329
330
331 x_progress := '140';
332 po_core_s.get_displayed_value ('AUTHORIZATION STATUS',
333 'INCOMPLETE',
334 x_req_incomplete);
335
336 x_progress := '150';
337 po_documents_sv.get_doc_type_info ('REQUISITION',
338 'INTERNAL',
339 x_req_source_internal);
340
341 x_progress := '160';
342 po_documents_sv.get_doc_type_info ('REQUISITION',
343 'PURCHASE',
344 x_req_source_purchase);
345
346 x_progress := '170';
347 po_core_s.get_displayed_value('FOB',
348 x_fob_lookup_code,
349 x_fob_disp,
350 x_fob_desc,
351 TRUE);
352
353
354 x_progress := '180';
355 po_core_s.get_displayed_value('FREIGHT TERMS',
356 x_freight_terms_lookup_code,
357 x_freight_terms_disp,
358 x_freight_terms_desc,
359 TRUE);
360
361 x_progress := '190';
362 po_terms_sv.val_ap_terms(X_temp_terms_id, X_terms_id);
363
364 x_progress := '200';
365 po_vendors_sv.val_freight_carrier(X_temp_ship_via_lookup_code,
366 X_inv_org_id,
367 X_ship_via_lookup_code);
368
369 x_progress := '210';
370 po_documents_sv.get_doc_security_level('REQUISITION',
371 'PURCHASE',
372 x_purchase_security);
373
374
375 x_progress := '220';
376 po_documents_sv.get_doc_security_level('REQUISITION',
377 'INTERNAL',
378 x_internal_security);
379
380
381 x_progress := '230';
382 po_documents_sv.get_doc_access_level('REQUISITION',
383 'INTERNAL',
384 x_internal_access);
385
386 x_progress := '240';
387 po_documents_sv.get_doc_access_level('REQUISITION',
388 'PURCHASE',
389 x_purchase_access);
390
391 x_progress := '250';
392 IF( po_employees_sv.get_employee(x_employee_id,
393 x_employee_name,
394 x_requestor_location_id,
395 x_location_code,
396 x_employee_is_buyer,
397 x_is_emp) = TRUE) THEN
398
399
400 IF (x_employee_is_buyer = TRUE) THEN
401 x_employee_is_buyer_flag := 'Y';
402
403 ELSE
404 x_employee_is_buyer_flag := 'N';
405
406 END IF;
407 END IF;
408
409 x_progress := '260';
410 po_vendors_sv.get_ship_to_loc_attributes(x_ship_to_location_id,
411 x_ship_to_location,
412 x_ship_org_code,
413 x_ship_org_name,
414 x_org_id,
415 x_sob_id);
416
417 x_progress := '270';
418 po_locations_s.get_loc_attributes(x_bill_to_location_id,
419 x_bill_to_location,
420 x_org_id);
421
422
423
424 x_progress := '280';
425 po_core_s.get_displayed_value ('DESTINATION TYPE',
426 'INVENTORY',
427 x_destination_inventory);
428
429 x_progress := '290';
430 po_locations_s.get_loc_org (x_requestor_location_id,
431 x_sob_id,
432 x_requestor_org_id,
433 x_requestor_org_code,
434 x_requestor_org);
435
436 x_progress := '300';
437 po_currency_sv.get_rate_type_disp (x_default_rate_type,
438 x_default_rate_type_disp);
439
440 x_progress := '310';
441 po_locations_s.get_location_code (x_requestor_location_id,
442 x_requestor_location);
443
444
445 -- dbms_output.put_line('Before Prog 320');
446
447 x_progress := '320';
448 x_gl_set_of_bks_id := po_core_s.get_gl_set_of_bks_id;
449
450 EXCEPTION
451 WHEN OTHERS THEN
452 -- dbms_output.put_line('After Prog ' || X_progress );
453 po_message_s.sql_error('po_setup_s.get_startup_values', x_progress, sqlcode);
454 raise;
455
456 END get_startup_values;
457
458
459 END PO_SETUP_S;