[Home] [Help]
PACKAGE BODY: APPS.INV_PO_THIRD_PARTY_STOCK_MDTR
Source
1 PACKAGE BODY INV_PO_THIRD_PARTY_STOCK_MDTR AS
2 -- $Header: INVMPOXB.pls 120.5 2006/03/15 00:43:24 kdevadas noship $
3 --+=======================================================================+
4 --| Copyright (c) 2002 Oracle Corporation |
5 --| Redwood Shores, CA, USA |
6 --| All rights reserved. |
7 --+=======================================================================+
8 --| FILENAME |
9 --| INVMPOXB.pls |
10 --| |
11 --| DESCRIPTION |
12 --| Consigned inventory INV/PO dependency wrapper API |
13 --| |
14 --| PROCEDURE LIST |
15 --| Get_Blanket_Number |
16 --| Generate_Account |
17 --| Get_Asl_Info |
18 --| Create_Documents |
19 --| Get_Elapsed_Info |
20 --| Update_Asl |
21 --| Get_Price_Break |
22 --| Is_Global |
23 --| archive_po |
24 --| get_total |
25 --| |
26 --| HISTORY |
27 --| 12/01/02 pseshadr Created |
28 --| 12/01/02 dherring Created |
29 --| 09-Mar-06 kdevadas get_break_price API changed for Advanced |
30 --| Pricing updtake - bug 5076263 |
31 --+========================================================================
32
33 --===================
34 -- GLOBALS
35 --===================
36
37 G_PKG_NAME CONSTANT VARCHAR2(30) := 'INV_PO_THIRD_PARTY_STOCK_MDTR';
38
39
40 --===================
41 -- PROCEDURES AND FUNCTIONS
42 --===================
43
44
45 --========================================================================
46 -- PROCEDURE : Get_Blanket_Number PUBLIC
47 -- PARAMETERS: p_inventory_item_id Item
48 -- p_item_revision Item Revision
49 -- p_vendor_site_id Vendor Site
50 -- p_organization_id Inventory Organization
51 -- x_document_header_id PO header id
52 -- x_document_line_id PO line id
53 -- x_global_flag Flag to indicate if manual numb.
54 -- is set in case of GA
55 -- COMMENT : Return document if a valid blanket exists for item,
56 -- supplier site,organization combination.
57 -- This procedure is invoked when
58 -- performing a Transfer to regular stock transaction.
59 --========================================================================
60 PROCEDURE Get_Blanket_Number
61 ( p_inventory_item_id IN NUMBER
62 , p_item_revision IN VARCHAR2
63 , p_vendor_site_id IN NUMBER
64 , p_organization_id IN NUMBER
65 , p_transaction_date IN DATE
66 , x_document_header_id OUT NOCOPY NUMBER
67 , x_document_line_id OUT NOCOPY NUMBER
68 , x_global_flag OUT NOCOPY VARCHAR2
69 )
70 IS
71 l_vendor_id NUMBER;
72 l_vendor_site_id NUMBER;
73 l_org_id NUMBER;
74 l_po_num_code VARCHAR2(25);
75 x_document_type_code VARCHAR2(50);
76 x_document_line_num NUMBER;
77 x_vendor_contact_id NUMBER;
78 x_vendor_product_num VARCHAR2(25);
79 x_buyer_id NUMBER;
80 x_currency_code VARCHAR2(10);
81 x_item_rev NUMBER;
82 x_purchasing_uom VARCHAR2(25);
83 x_asl_id NUMBER ;
84 x_multi_org VARCHAR2(10) := 'N';
85 l_fp_org_id NUMBER;
86 l_vs_org_id NUMBER;
87 l_debug NUMBER := NVL(FND_PROFILE.VALUE('INV_DEBUG_TRACE'),0);
88
89
90 CURSOR c_fp IS
91 SELECT
92 NVL(org_id,-99)
93 FROM
94 financials_system_parameters;
95
96
97 BEGIN
98
99 -- Call the document sourcing API which returns the most recent
100 -- document type and document number for the item,supplier site
101 -- and organization.
102
103 -- Get the vendor id from vendor site;
104
105 l_vendor_site_id := p_vendor_site_id;
106
107 SELECT
108 vendor_id
109 , org_id
110 INTO
111 l_vendor_id
112 , l_vs_org_id
113 FROM
114 po_vendor_sites_all
115 WHERE vendor_site_id = l_vendor_site_id;
116
117 -- Get the most recent valid blanket PO for the item,supplier,org
118 -- combination.The document sourcing API sources from blankets and
119 -- quotations if destination_doc_type is REQ. However, if both a
120 -- blanket and quotation exists, it returns the blanket info always.
121
122 OPEN c_fp;
123 FETCH c_fp
124 INTO
125 l_fp_org_id;
126
127 IF c_fp%NOTFOUND
128 THEN
129 INV_LOG_UTIL.trace('No data in FSP :','INV_THIRD_PARTY_STOCK_PVT',9);
130 l_fp_org_id := NULL;
131 ELSE
132 INV_LOG_UTIL.trace('Org id set is :'||l_fp_org_id,'INV_THIRD_PARTY_STOCK_PVT',9);
133 END IF;
134 CLOSE c_fp;
135
136 IF (l_debug = 1)
137 THEN
138 INV_LOG_UTIL.trace('Values passed to Document Sourcing :','INV_THIRD_PARTY_STOCK_PVT',9);
139 INV_LOG_UTIL.trace('Item is : '||p_inventory_item_id,'INV_THIRD_PARTY_STOCK_PVT',9);
140 INV_LOG_UTIL.trace('Vendor is : '||l_vendor_id,'INV_THIRD_PARTY_STOCK_PVT',9);
141 INV_LOG_UTIL.trace('Organization is : '||p_organization_id,'INV_THIRD_PARTY_STOCK_PVT',9);
142 INV_LOG_UTIL.trace('Currency is : '||x_currency_code,'INV_THIRD_PARTY_STOCK_PVT',9);
143 INV_LOG_UTIL.trace('Rev is : '||p_item_revision,'INV_THIRD_PARTY_STOCK_PVT',9);
144 INV_LOG_UTIL.trace('Site is : '||l_vendor_site_id,'INV_THIRD_PARTY_STOCK_PVT',9);
145 INV_LOG_UTIL.trace('Multiorg is :N','INV_THIRD_PARTY_STOCK_PVT',9);
146 INV_LOG_UTIL.trace('Destination doc type is :REQ','INV_THIRD_PARTY_STOCK_PVT',9);
147 END IF;
148
149
150 IF NVL(l_vs_org_id,-99) <> NVL(l_fp_org_id,-99)
151 THEN
152 INV_LOG_UTIL.trace('Different operating unit :','INV_THIRD_PARTY_STOCK_PVT',9);
153 DBMS_APPLICATION_INFO.SET_CLIENT_INFO(l_vs_org_id);
154 --MO_GLOBAL.Init('PO');
155 MO_GLOBAL.set_policy_context('S',l_vs_org_id);
156
157 INV_LOG_UTIL.trace('Now setting OU to :'||l_vs_org_id,'INV_THIRD_PARTY_STOCK_PVT',9);
158 END IF;
159
160 MO_GLOBAL.set_policy_context('S',l_vs_org_id);
161
162 PO_AUTOSOURCE_SV.document_sourcing
163 ( x_item_id => p_inventory_item_id
164 , x_vendor_id => l_vendor_id
165 , x_destination_doc_type => 'REQ'
166 , x_organization_id => p_organization_id
167 , x_currency_code => x_currency_code
168 , x_item_rev => p_item_revision
169 , x_autosource_date => NVL(p_transaction_date,SYSDATE)
170 , x_vendor_site_id => l_vendor_site_id
171 , x_document_header_id => x_document_header_id
172 , x_document_type_code => x_document_type_code
173 , x_document_line_num => x_document_line_num
174 , x_document_line_id => x_document_line_id
175 , x_vendor_contact_id => x_vendor_contact_id
176 , x_vendor_product_num => x_vendor_product_num
177 , x_buyer_id => x_buyer_id
178 , x_purchasing_uom => x_purchasing_uom
179 , x_asl_id => x_asl_id
180 , x_multi_org => x_multi_org
181 );
182
183
184 -- Check if the doc type is blanket;
185
186 IF (x_document_type_code <> 'BLANKET') OR (x_document_header_id IS NULL)
187 THEN
188 x_document_header_id := NULL;
189 x_document_line_id := NULL;
190 x_global_flag := 'N';
191 ELSE
192 -- Check if the blanket is a global agreement
193
194 IF is_global(x_document_header_id)
195 THEN
196
197 SELECT
198 org_id
199 INTO
200 l_org_id
201 FROM
202 po_vendor_sites_all
203 WHERE vendor_site_id = l_vendor_site_id;
204
205 SELECT
206 user_defined_po_num_code
207 INTO
208 l_po_num_code
209 FROM
210 po_system_parameters_all
211 WHERE NVL(org_id,-99) = NVL(l_org_id,-99);
212
213 -- If the blanket is a GA, and automatic numbering is not set,
214 -- set the global flag to Y, so that we can fail the consumption
215 -- with the appropriate error message.
216
217 IF l_po_num_code <> 'AUTOMATIC'
218 THEN
219 x_document_header_id := NULL;
220 x_document_line_id := NULL;
221 x_global_flag := 'Y';
222 ELSE
223 x_global_flag := 'N';
224 END IF;
225
226 END IF;
227 END IF;
228 END Get_Blanket_Number;
229
230 --========================================================================
231 -- PROCEDURE : Get_Blanket_Number PUBLIC
232 -- PARAMETERS: p_inventory_item_id Item
233 -- p_item_revision Item Revision
234 -- p_vendor_site_id Vendor Site
235 -- p_organization_id Inventory Organization
236 -- x_document_header_id PO header id
237 -- x_document_line_id PO line id
238 -- x_global_flag Flag to indicate if manual numb.
239 -- is set in case of GA
240 -- COMMENT : Return document if a valid blanket exists for item,
241 -- supplier site,organization combination.
242 -- This procedure is invoked when
243 -- performing a Transfer to regular stock transaction.
244 --========================================================================
245 PROCEDURE Get_Blanket_Number
246 ( p_inventory_item_id IN NUMBER
247 , p_item_revision IN VARCHAR2
248 , p_vendor_site_id IN NUMBER
249 , p_organization_id IN NUMBER
250 , x_document_header_id OUT NOCOPY NUMBER
251 , x_document_line_id OUT NOCOPY NUMBER
252 , x_global_flag OUT NOCOPY VARCHAR2
253 )
254 IS
255 l_document_header_id NUMBER;
256 l_document_line_id NUMBER;
257 l_global_flag VARCHAR2(1);
258
259 BEGIN
260 INV_PO_THIRD_PARTY_STOCK_MDTR.Get_Blanket_Number
261 ( p_inventory_item_id => p_inventory_item_id
262 , p_item_revision => p_item_revision
263 , p_vendor_site_id => p_vendor_site_id
264 , p_organization_id => p_organization_id
265 , p_transaction_date => TRUNC(SYSDATE)
266 , x_document_header_id => l_document_header_id
267 , x_document_line_id => l_document_line_id
268 , x_global_flag => l_global_flag
269 );
270
271 x_document_header_id := l_document_header_id;
272 x_document_line_id := l_document_line_id;
273 x_global_flag := l_global_flag;
274
275 END Get_Blanket_Number;
276
277 --========================================================================
278 -- PROCEDURE : Generate_Account PUBLIC
279 -- PARAMETERS : p_coa_id Chart of Accounts Id
280 -- p_destination_type_code INVENTORY
281 -- p_type_lookup_code Document type
282 -- p_item_id Item
283 -- p_vendor_id Vendor
284 -- p_vendor_site_id Vendor Site
285 -- p_destination_organization_id Inventory Organization
286 -- p_po_encumberance_flag PO encumberance
287 -- p_accrual_account_id Accrual account
288 -- p_charge_account_id Charge Account
289 -- p_variance_account_id Variance Account
290 -- COMMENT : The above inputs are the only relevent parameters for
291 -- generation of accounts for consigned transaction. All
292 -- the other parameters that are required for the
296
293 -- procedure are passed in as NULL . This is a wrapper
294 -- to the PO Account builder
295 --========================================================================
297 PROCEDURE Generate_Account
298 ( p_charge_success IN OUT NOCOPY BOOLEAN
299 , p_budget_success IN OUT NOCOPY BOOLEAN
300 , p_accrual_success IN OUT NOCOPY BOOLEAN
301 , p_variance_success IN OUT NOCOPY BOOLEAN
302 , p_code_combination_id IN OUT NOCOPY NUMBER
303 , p_charge_account_id IN OUT NOCOPY NUMBER
304 , p_budget_account_id IN OUT NOCOPY NUMBER
305 , p_accrual_account_id IN OUT NOCOPY NUMBER
306 , p_variance_account_id IN OUT NOCOPY NUMBER
307 , p_charge_account_flex IN OUT NOCOPY VARCHAR2
308 , p_budget_account_flex IN OUT NOCOPY VARCHAR2
309 , p_accrual_account_flex IN OUT NOCOPY VARCHAR2
310 , p_variance_account_flex IN OUT NOCOPY VARCHAR2
311 , p_charge_account_desc IN OUT NOCOPY VARCHAR2
312 , p_budget_account_desc IN OUT NOCOPY VARCHAR2
313 , p_accrual_account_desc IN OUT NOCOPY VARCHAR2
314 , p_variance_account_desc IN OUT NOCOPY VARCHAR2
315 , p_coa_id IN NUMBER
316 , p_bom_resource_id IN NUMBER
317 , p_bom_cost_element_id IN NUMBER
318 , p_category_id IN NUMBER
319 , p_destination_type_code IN VARCHAR2
320 , p_deliver_to_location_id IN NUMBER
321 , p_destination_organization_id IN NUMBER
322 , p_destination_subinventory IN VARCHAR2
323 , p_expenditure_type IN VARCHAR2
324 , p_expenditure_organization_id IN NUMBER
325 , p_expenditure_item_date IN DATE
326 , p_item_id IN NUMBER
327 , p_line_type_id IN NUMBER
328 , p_result_billable_flag IN VARCHAR2
329 , p_agent_id IN NUMBER
330 , p_project_id IN NUMBER
331 , p_from_type_lookup_code IN VARCHAR2
332 , p_from_header_id IN NUMBER
333 , p_from_line_id IN NUMBER
334 , p_task_id IN NUMBER
335 , p_deliver_to_person_id IN NUMBER
336 , p_type_lookup_code IN VARCHAR2
337 , p_vendor_id IN NUMBER
338 , p_wip_entity_id IN NUMBER
339 , p_wip_entity_type IN VARCHAR2
340 , p_wip_line_id IN NUMBER
341 , p_wip_repetitive_schedule_id IN NUMBER
342 , p_wip_operation_seq_num IN NUMBER
343 , p_wip_resource_seq_num IN NUMBER
344 , p_po_encumberance_flag IN VARCHAR2
345 , p_gl_encumbered_date IN DATE
346 , p_wf_itemkey IN OUT NOCOPY VARCHAR2
347 , p_new_combination IN OUT NOCOPY BOOLEAN
348 , p_header_att1 IN VARCHAR2
349 , p_header_att2 IN VARCHAR2
350 , p_header_att3 IN VARCHAR2
351 , p_header_att4 IN VARCHAR2
352 , p_header_att5 IN VARCHAR2
353 , p_header_att6 IN VARCHAR2
354 , p_header_att7 IN VARCHAR2
355 , p_header_att8 IN VARCHAR2
356 , p_header_att9 IN VARCHAR2
357 , p_header_att10 IN VARCHAR2
358 , p_header_att11 IN VARCHAR2
359 , p_header_att12 IN VARCHAR2
360 , p_header_att13 IN VARCHAR2
361 , p_header_att14 IN VARCHAR2
362 , p_header_att15 IN VARCHAR2
363 , p_line_att1 IN VARCHAR2
364 , p_line_att2 IN VARCHAR2
365 , p_line_att3 IN VARCHAR2
366 , p_line_att4 IN VARCHAR2
367 , p_line_att5 IN VARCHAR2
368 , p_line_att6 IN VARCHAR2
369 , p_line_att7 IN VARCHAR2
370 , p_line_att8 IN VARCHAR2
371 , p_line_att9 IN VARCHAR2
372 , p_line_att10 IN VARCHAR2
373 , p_line_att11 IN VARCHAR2
374 , p_line_att12 IN VARCHAR2
375 , p_line_att13 IN VARCHAR2
376 , p_line_att14 IN VARCHAR2
377 , p_line_att15 IN VARCHAR2
378 , p_shipment_att1 IN VARCHAR2
379 , p_shipment_att2 IN VARCHAR2
380 , p_shipment_att3 IN VARCHAR2
381 , p_shipment_att4 IN VARCHAR2
382 , p_shipment_att5 IN VARCHAR2
383 , p_shipment_att6 IN VARCHAR2
384 , p_shipment_att7 IN VARCHAR2
385 , p_shipment_att8 IN VARCHAR2
386 , p_shipment_att9 IN VARCHAR2
387 , p_shipment_att10 IN VARCHAR2
388 , p_shipment_att11 IN VARCHAR2
389 , p_shipment_att12 IN VARCHAR2
390 , p_shipment_att13 IN VARCHAR2
391 , p_shipment_att14 IN VARCHAR2
392 , p_shipment_att15 IN VARCHAR2
393 , p_distribution_att1 IN VARCHAR2
394 , p_distribution_att2 IN VARCHAR2
395 , p_distribution_att3 IN VARCHAR2
396 , p_distribution_att4 IN VARCHAR2
397 , p_distribution_att5 IN VARCHAR2
398 , p_distribution_att6 IN VARCHAR2
399 , p_distribution_att7 IN VARCHAR2
400 , p_distribution_att8 IN VARCHAR2
401 , p_distribution_att9 IN VARCHAR2
405 , p_distribution_att13 IN VARCHAR2
402 , p_distribution_att10 IN VARCHAR2
403 , p_distribution_att11 IN VARCHAR2
404 , p_distribution_att12 IN VARCHAR2
406 , p_distribution_att14 IN VARCHAR2
407 , p_distribution_att15 IN VARCHAR2
408 , p_fb_error_msg IN OUT NOCOPY VARCHAR2
409 , p_Award_id IN NUMBER
410 , p_vendor_site_id IN NUMBER
411 )
412 IS
413 l_success BOOLEAN;
414 l_new_combination BOOLEAN;
415 l_charge_success BOOLEAN := TRUE;
416 l_budget_success BOOLEAN := TRUE;
417 l_accrual_success BOOLEAN := TRUE;
418 l_variance_success BOOLEAN := TRUE;
419 l_coa_id NUMBER;
420 l_bom_resource_id NUMBER;
421 l_bom_cost_element_id NUMBER;
422 l_category_id NUMBER;
423 l_destination_type_code VARCHAR2(50);
424 l_deliver_to_location_id NUMBER;
425 l_destination_organization_id NUMBER ;
426 l_destination_subinventory VARCHAR2(50);
427 l_expenditure_type VARCHAR2(50);
428 l_expenditure_organization_id NUMBER ;
429 l_expenditure_item_date DATE;
430 l_item_id NUMBER ;
431 l_line_type_id NUMBER ;
432 l_result_billable_flag VARCHAR2(50);
433 l_agent_id NUMBER ;
434 l_project_id NUMBER;
435 l_from_type_lookup_code VARCHAR2(50);
436 l_from_header_id NUMBER;
437 l_from_line_id NUMBER;
438 l_task_id NUMBER;
439 l_deliver_to_person_id NUMBER;
440 l_type_lookup_code VARCHAR2(50);
441 l_vendor_id NUMBER ;
442 l_vendor_site_id NUMBER ;
443 l_wip_entity_id NUMBER;
444 l_wip_entity_type VARCHAR2(50);
445 l_wip_line_id NUMBER;
446 l_wip_repetitive_schedule_id NUMBER;
447 l_wip_operation_seq_num NUMBER;
448 l_wip_resource_seq_num NUMBER;
449 l_gl_encumbered_date DATE;
450 l_code_combination_id NUMBER;
451 l_accrual_account_id NUMBER;
452 l_variance_account_id NUMBER;
453 l_charge_account_id NUMBER;
454 l_budget_account_id NUMBER;
455 l_award_id NUMBER;
456 l_charge_account_flex VARCHAR2(2000);
457 l_budget_account_flex VARCHAR2(2000);
458 l_accrual_account_flex VARCHAR2(2000);
459 l_variance_account_flex VARCHAR2(2000);
460 l_charge_account_desc VARCHAR2(2000);
461 l_budget_account_desc VARCHAR2(2000);
462 l_accrual_account_desc VARCHAR2(2000);
463 l_variance_account_desc VARCHAR2(2000);
464 l_charge_field_name VARCHAR2(60);
465 l_budget_field_name VARCHAR2(60);
466 l_accrual_field_name VARCHAR2(60);
467 l_variance_field_name VARCHAR2(60);
468 l_charge_desc_field_name VARCHAR2(60);
469 l_budget_desc_field_name VARCHAR2(60);
470 l_accrual_desc_field_name VARCHAR2(60);
471 l_variance_desc_field_name VARCHAR2(60);
472 l_progress VARCHAR2(3) := '001';
473 l_new_ccid NUMBER;
474 l_ccid_returned BOOLEAN := FALSE;
475 l_header_att1 VARCHAR2(150) := NULL;
476 l_header_att2 VARCHAR2(150) := NULL;
477 l_header_att3 VARCHAR2(150) := NULL;
478 l_header_att4 VARCHAR2(150) := NULL;
479 l_header_att5 VARCHAR2(150) := NULL;
480 l_header_att6 VARCHAR2(150) := NULL;
481 l_header_att7 VARCHAR2(150) := NULL;
482 l_header_att8 VARCHAR2(150) := NULL;
483 l_header_att9 VARCHAR2(150) := NULL;
484 l_header_att10 VARCHAR2(150) := NULL;
485 l_header_att11 VARCHAR2(150) := NULL;
486 l_header_att12 VARCHAR2(150) := NULL;
487 l_header_att13 VARCHAR2(150) := NULL;
488 l_header_att14 VARCHAR2(150) := NULL;
489 l_header_att15 VARCHAR2(150) := NULL;
490 l_line_att1 VARCHAR2(150) := NULL;
491 l_line_att2 VARCHAR2(150) := NULL;
492 l_line_att3 VARCHAR2(150) := NULL;
493 l_line_att4 VARCHAR2(150) := NULL;
494 l_line_att5 VARCHAR2(150) := NULL;
495 l_line_att6 VARCHAR2(150) := NULL;
496 l_line_att7 VARCHAR2(150) := NULL;
497 l_line_att8 VARCHAR2(150) := NULL;
498 l_line_att9 VARCHAR2(150) := NULL;
499 l_line_att10 VARCHAR2(150) := NULL;
500 l_line_att11 VARCHAR2(150) := NULL;
501 l_line_att12 VARCHAR2(150) := NULL;
502 l_line_att13 VARCHAR2(150) := NULL;
503 l_line_att14 VARCHAR2(150) := NULL;
504 l_line_att15 VARCHAR2(150) := NULL;
505 l_header_name VARCHAR2(20);
506 l_acc_field_name VARCHAR2(60);
507 l_concat_segs VARCHAR2(240);
508 l_concat_desc VARCHAR2(2000);
509 l_wf_itemkey VARCHAR2(80);
510 l_po_encumberance_flag VARCHAR2(2) ;
511 l_ccid_passed_in BOOLEAN := FALSE;
512 l_new_ccid_generated BOOLEAN := FALSE;
513 l_debug BOOLEAN := TRUE;
514 l_shipment_att1 VARCHAR2(150);
518 l_shipment_att5 VARCHAR2(150) ;
515 l_shipment_att2 VARCHAR2(150);
516 l_shipment_att3 VARCHAR2(150) ;
517 l_shipment_att4 VARCHAR2(150) ;
519 l_shipment_att6 VARCHAR2(150) ;
520 l_shipment_att7 VARCHAR2(150) ;
521 l_shipment_att8 VARCHAR2(150) ;
522 l_shipment_att9 VARCHAR2(150) ;
523 l_shipment_att10 VARCHAR2(150) ;
524 l_shipment_att11 VARCHAR2(150) ;
525 l_shipment_att12 VARCHAR2(150) ;
526 l_shipment_att13 VARCHAR2(150) ;
527 l_shipment_att14 VARCHAR2(150) ;
528 l_shipment_att15 VARCHAR2(150) ;
529 l_distribution_att1 VARCHAR2(150) ;
530 l_distribution_att2 VARCHAR2(150) ;
531 l_distribution_att3 VARCHAR2(150) ;
532 l_distribution_att4 VARCHAR2(150) ;
533 l_distribution_att5 VARCHAR2(150) ;
534 l_distribution_att6 VARCHAR2(150) ;
535 l_distribution_att7 VARCHAR2(150);
536 l_distribution_att8 VARCHAR2(150);
537 l_distribution_att9 VARCHAR2(150);
538 l_distribution_att10 VARCHAR2(150) ;
539 l_distribution_att11 VARCHAR2(150) ;
540 l_distribution_att12 VARCHAR2(150) ;
541 l_distribution_att13 VARCHAR2(150) ;
542 l_distribution_att14 VARCHAR2(150) ;
543 l_distribution_att15 VARCHAR2(150) ;
544 l_fb_error_msg VARCHAR2(2000);
545 l_dest_charge_success BOOLEAN;
546 l_dest_variance_success BOOLEAN;
547 l_dest_charge_account_id NUMBER;
548 l_dest_variance_account_id NUMBER;
549 l_dest_charge_account_desc VARCHAR2(2000);
550 l_dest_variance_account_desc VARCHAR2(2000);
551 l_dest_charge_account_flex VARCHAR2(2000);
552 l_dest_variance_account_flex VARCHAR2(2000);
553
554 BEGIN
555
556 l_charge_success := p_charge_success;
557 l_budget_success := p_budget_success;
558 l_accrual_success := p_accrual_success;
559 l_variance_success := p_variance_success;
560 l_code_combination_id := p_code_combination_id;
561 l_budget_account_id := p_budget_account_id;
562 l_accrual_account_id := p_accrual_account_id;
563 l_variance_account_id := p_variance_account_id;
564 l_charge_account_flex := p_charge_account_flex;
565 l_budget_account_flex := p_budget_account_flex;
566 l_accrual_account_flex := p_accrual_account_flex;
567 l_variance_account_flex := p_variance_account_flex;
568 l_charge_account_desc := p_charge_account_desc;
569 l_budget_account_desc := p_budget_account_desc;
570 l_accrual_account_desc := p_accrual_account_desc;
571 l_variance_account_desc := p_variance_account_desc;
572 l_coa_id := p_coa_id;
573 l_bom_resource_id := p_bom_resource_id;
574 l_bom_cost_element_id := p_bom_cost_element_id;
575 l_category_id := p_category_id;
576 l_destination_type_code := p_destination_type_code;
577 l_deliver_to_location_id := p_deliver_to_location_id;
578 l_destination_organization_id := p_destination_organization_id;
579 l_destination_subinventory := p_destination_subinventory;
580 l_expenditure_type := p_expenditure_type;
581 l_expenditure_organization_id := p_expenditure_organization_id;
582 l_expenditure_item_date := p_expenditure_item_date;
583 l_item_id := p_item_id;
584 l_line_type_id := p_line_type_id;
585 l_result_billable_flag := p_result_billable_flag;
586 l_agent_id := p_agent_id;
587 l_project_id := p_project_id;
588 l_from_type_lookup_code := p_from_type_lookup_code;
589 l_from_header_id := p_from_header_id;
590 l_from_line_id := p_from_line_id;
591 l_task_id := p_task_id;
592 l_deliver_to_person_id := p_deliver_to_person_id;
593 l_type_lookup_code := p_type_lookup_code;
594 l_vendor_id := p_vendor_id;
595 l_vendor_site_id := p_vendor_site_id;
596 l_wip_entity_id := p_wip_entity_id;
597 l_wip_entity_type := p_wip_entity_type;
598 l_wip_line_id := p_wip_line_id ;
599 l_wip_repetitive_schedule_id := p_wip_repetitive_schedule_id;
600 l_wip_operation_seq_num := p_wip_operation_seq_num;
601 l_wip_resource_seq_num := p_wip_resource_seq_num;
602 l_po_encumberance_flag := p_po_encumberance_flag;
603 l_gl_encumbered_date := p_gl_encumbered_date;
604 l_wf_itemkey := p_wf_itemkey;
605 l_new_combination := p_new_combination;
606 l_header_att1 := p_header_att1;
607 l_header_att2 := p_header_att2;
608 l_header_att3 := p_header_att3;
609 l_header_att4 := p_header_att4;
610 l_header_att5 := p_header_att5;
611 l_header_att6 := p_header_att6;
612 l_header_att7 := p_header_att7;
613 l_header_att8 := p_header_att8;
614 l_header_att9 := p_header_att9;
615 l_header_att10 := p_header_att10;
616 l_header_att11 := p_header_att11;
617 l_header_att12 := p_header_att12;
618 l_header_att13 := p_header_att13;
619 l_header_att14 := p_header_att14;
623 l_line_att3 := p_line_att3;
620 l_header_att15 := p_header_att15;
621 l_line_att1 := p_line_att1;
622 l_line_att2 := p_line_att2;
624 l_line_att4 := p_line_att4;
625 l_line_att5 := p_line_att5;
626 l_line_att6 := p_line_att6;
627 l_line_att7 := p_line_att7;
628 l_line_att8 := p_line_att8;
629 l_line_att9 := p_line_att9;
630 l_line_att10 := p_line_att10;
631 l_line_att11 := p_line_att11;
632 l_line_att12 := p_line_att12;
633 l_line_att13 := p_line_att13;
634 l_line_att14 := p_line_att14;
635 l_line_att15 := p_line_att15;
636 l_shipment_att1 := p_shipment_att1;
637 l_shipment_att2 := p_shipment_att2;
638 l_shipment_att3 := p_shipment_att3;
639 l_shipment_att4 := p_shipment_att4;
640 l_shipment_att5 := p_shipment_att5;
641 l_shipment_att6 := p_shipment_att6;
642 l_shipment_att7 := p_shipment_att7;
643 l_shipment_att8 := p_shipment_att8;
644 l_shipment_att9 := p_shipment_att9;
645 l_shipment_att10 := p_shipment_att10;
646 l_shipment_att11 := p_shipment_att11;
647 l_shipment_att12 := p_shipment_att12;
648 l_shipment_att13 := p_shipment_att13;
649 l_shipment_att14 := p_shipment_att14;
650 l_shipment_att15 := p_shipment_att15;
651 l_distribution_att1 := p_distribution_att1;
652 l_distribution_att2 := p_distribution_att2;
653 l_distribution_att3 := p_distribution_att3;
654 l_distribution_att4 := p_distribution_att4;
655 l_distribution_att5 := p_distribution_att5;
656 l_distribution_att6 := p_distribution_att6;
657 l_distribution_att7 := p_distribution_att7;
658 l_distribution_att8 := p_distribution_att8;
659 l_distribution_att9 := p_distribution_att9;
660 l_distribution_att10 := p_distribution_att10;
661 l_distribution_att11 := p_distribution_att11;
662 l_distribution_att12 := p_distribution_att12;
663 l_distribution_att13 := p_distribution_att13;
664 l_distribution_att14 := p_distribution_att14;
665 l_distribution_att15 := p_distribution_att15;
666 l_fb_error_msg := p_fb_error_msg;
667 l_award_id := p_award_id;
668
669 l_success := PO_WF_BUILD_ACCOUNT_INIT.Start_Workflow
670 ( x_charge_success => l_charge_success
671 , x_budget_success => l_budget_success
672 , x_accrual_success => l_accrual_success
673 , x_variance_success => l_variance_success
674 , x_code_combination_id => l_code_combination_id
675 , x_budget_account_id => l_budget_account_id
676 , x_accrual_account_id => l_accrual_account_id
677 , x_variance_account_id => l_variance_account_id
678 , x_charge_account_flex => l_charge_account_flex
679 , x_budget_account_flex => l_budget_account_flex
680 , x_accrual_account_flex => l_accrual_account_flex
681 , x_variance_account_flex => l_variance_account_flex
682 , x_charge_account_desc => l_charge_account_desc
683 , x_budget_account_desc => l_budget_account_desc
684 , x_accrual_account_desc => l_accrual_account_desc
685 , x_variance_account_desc => l_variance_account_desc
686 , x_coa_id => l_coa_id
687 , x_bom_resource_id => l_bom_resource_id
688 , x_bom_cost_element_id => l_bom_cost_element_id
689 , x_category_id => l_category_id
690 , x_destination_type_code => l_destination_type_code
691 , x_deliver_to_location_id => l_deliver_to_location_id
692 , x_destination_organization_id =>
693 l_destination_organization_id
694 , x_destination_subinventory =>
695 l_destination_subinventory
696 , x_expenditure_type => l_expenditure_type
697 , x_expenditure_organization_id =>
698 l_expenditure_organization_id
699 , x_expenditure_item_date => l_expenditure_item_date
700 , x_item_id => l_item_id
701 , x_line_type_id => l_line_type_id
702 , x_result_billable_flag => l_result_billable_flag
703 , x_agent_id => l_agent_id
704 , x_project_id => l_project_id
705 , x_from_type_lookup_code => l_from_type_lookup_code
706 , x_from_header_id => l_from_header_id
707 , x_from_line_id => l_from_line_id
708 , x_task_id => l_task_id
709 , x_deliver_to_person_id => l_deliver_to_person_id
710 , x_type_lookup_code => l_type_lookup_code
714 , x_wip_line_id => l_wip_line_id
711 , x_vendor_id => l_vendor_id
712 , x_wip_entity_id => l_wip_entity_id
713 , x_wip_entity_type => l_wip_entity_type
715 , x_wip_repetitive_schedule_id =>
716 l_wip_repetitive_schedule_id
717 , x_wip_operation_seq_num => l_wip_operation_seq_num
718 , x_wip_resource_seq_num => l_wip_resource_seq_num
719 , x_po_encumberance_flag => l_po_encumberance_flag
720 , x_gl_encumbered_date => l_gl_encumbered_date
721 , wf_itemkey => l_wf_itemkey
722 , x_new_combination => l_new_combination
723 , header_att1 => l_header_att1
724 , header_att2 => l_header_att2
725 , header_att3 => l_header_att3
726 , header_att4 => l_header_att4
727 , header_att5 => l_header_att5
728 , header_att6 => l_header_att6
729 , header_att7 => l_header_att7
730 , header_att8 => l_header_att8
731 , header_att9 => l_header_att9
732 , header_att10 => l_header_att10
733 , header_att11 => l_header_att11
734 , header_att12 => l_header_att12
735 , header_att13 => l_header_att13
736 , header_att14 => l_header_att14
737 , header_att15 => l_header_att15
738 , line_att1 => l_line_att1
739 , line_att2 => l_line_att2
740 , line_att3 => l_line_att3
741 , line_att4 => l_line_att4
742 , line_att5 => l_line_att5
743 , line_att6 => l_line_att6
744 , line_att7 => l_line_att7
745 , line_att8 => l_line_att8
746 , line_att9 => l_line_att9
747 , line_att10 => l_line_att10
748 , line_att11 => l_line_att11
749 , line_att12 => l_line_att12
750 , line_att13 => l_line_att13
751 , line_att14 => l_line_att14
752 , line_att15 => l_line_att15
753 , shipment_att1 => l_shipment_att1
754 , shipment_att2 => l_shipment_att2
755 , shipment_att3 => l_shipment_att3
756 , shipment_att4 => l_shipment_att4
757 , shipment_att5 => l_shipment_att5
758 , shipment_att6 => l_shipment_att6
759 , shipment_att7 => l_shipment_att7
760 , shipment_att8 => l_shipment_att8
761 , shipment_att9 => l_shipment_att9
762 , shipment_att10 => l_shipment_att10
763 , shipment_att11 => l_shipment_att11
764 , shipment_att12 => l_shipment_att12
765 , shipment_att13 => l_shipment_att13
766 , shipment_att14 => l_shipment_att14
767 , shipment_att15 => l_shipment_att15
768 , distribution_att1 => l_distribution_att1
769 , distribution_att2 => l_distribution_att2
770 , distribution_att3 => l_distribution_att3
771 , distribution_att4 => l_distribution_att4
772 , distribution_att5 => l_distribution_att5
773 , distribution_att6 => l_distribution_att6
774 , distribution_att7 => l_distribution_att7
775 , distribution_att8 => l_distribution_att8
776 , distribution_att9 => l_distribution_att9
777 , distribution_att10 => l_distribution_att10
778 , distribution_att11 => l_distribution_att11
779 , distribution_att12 => l_distribution_att12
780 , distribution_att13 => l_distribution_att13
781 , distribution_att14 => l_distribution_att14
782 , distribution_att15 => l_distribution_att15
783 , FB_ERROR_MSG => l_fb_error_msg
784 , x_Award_id => l_award_id
785 , x_vendor_site_id => l_vendor_site_id
786 );
787
788 p_charge_account_id := l_code_combination_id;
789 p_accrual_account_id := l_accrual_account_id;
790 p_variance_account_id := l_variance_account_id;
791
792 IF NOT l_success
793 THEN
797 ELSE
794 -- Pass the message back to the calling pgm so that
795 -- it is added to the message stack;
796 p_fb_error_msg := 'INV_CONS_SUP_GEN_ACCT';
798 p_fb_error_msg := NULL;
799 END IF;
800
801 END Generate_Account;
802
803 --========================================================================
804 -- PROCEDURE : Get_Asl_Info PUBLIC
805 -- PARAMETERS: p_item_id Item
806 -- p_vendor_id Vendor Id
807 -- p_vendor_site_id Vendor Site Id
808 -- p_using_organization_id organization
809 -- x_asl_id asl id
810 -- x_vendor_product_num vendor product num
811 -- x_purchasing_uom Purchasing UOM
812 -- COMMENT: Wrapper for get asl info procedure in purchasing
813 --========================================================================
814 PROCEDURE Get_Asl_Info
815 ( p_item_id IN NUMBER
816 , p_vendor_id IN NUMBER
817 , p_vendor_site_id IN NUMBER
818 , p_using_organization_id IN NUMBER
819 , x_asl_id OUT NOCOPY NUMBER
820 , x_vendor_product_num OUT NOCOPY VARCHAR2
821 , x_purchasing_uom OUT NOCOPY VARCHAR2
822 )
823 IS
824 l_asl_id NUMBER;
825 l_vendor_product_num VARCHAR2(25);
826 l_purchasing_uom VARCHAR2(25);
827 l_item_id NUMBER;
828 l_vendor_id NUMBER;
829 l_vendor_site_id NUMBER;
830 l_using_organization_id NUMBER;
831 l_cons_sup_flag VARCHAR2(1);
832 l_enable_vmi_flag VARCHAR2(1);
833 l_last_billing_date DATE;
834 l_consigned_billing_cycle NUMBER;
835 l_vmi_min_qty NUMBER;
836 l_vmi_max_qty NUMBER;
837 l_vmi_auto_replenish_flag VARCHAR2(1);
838 l_vmi_replenishment_approval VARCHAR2(40);
839
840 BEGIN
841
842 l_item_id := p_item_id;
843 l_vendor_id := p_vendor_id;
844 l_vendor_site_id := p_vendor_site_id;
845 l_using_organization_id := p_using_organization_id;
846
847 PO_AUTOSOURCE_SV.get_asl_info
848 ( x_item_id => l_item_id
849 , x_vendor_id => l_vendor_id
850 , x_vendor_site_id => l_vendor_site_id
851 , x_using_organization_id => l_using_organization_id
852 , x_asl_id => l_asl_id
853 , x_vendor_product_num => l_vendor_product_num
854 , x_purchasing_uom => l_purchasing_uom
855 , x_consigned_from_supplier_flag => l_cons_sup_flag
856 , x_enable_vmi_flag => l_enable_vmi_flag
857 , x_last_billing_date => l_last_billing_date
858 , x_consigned_billing_cycle => l_consigned_billing_cycle
859 , x_vmi_min_qty => l_vmi_min_qty
860 , x_vmi_max_qty => l_vmi_max_qty
861 , x_vmi_auto_replenish_flag => l_vmi_auto_replenish_flag
862 , x_vmi_replenishment_approval => l_vmi_replenishment_approval
863 );
864
865
866 IF l_asl_id IS NOT NULL AND NVL(l_cons_sup_flag, 'N') = 'N' THEN
867 l_asl_id := NULL;
868 END IF;
869
870 x_asl_id := l_asl_id;
871 x_vendor_product_num := l_vendor_product_num;
872 x_purchasing_uom := l_purchasing_uom;
873
874 END Get_Asl_Info;
875
876 --========================================================================
877 -- PROCEDURE : Get_Elapsed_Info PUBLIC
878 -- PARAMETERS: p_org_id org id
879 -- p_asl_id asl id
880 -- x_bill_date_elapsed indicates if txn can be processed
881 -- COMMENT: Wrapper for get asl info sql in purchasing
882 --========================================================================
883 PROCEDURE Get_Elapsed_Info
884 ( p_org_id IN NUMBER
885 , p_asl_id IN NUMBER
886 , x_bill_date_elapsed OUT NOCOPY NUMBER
887 )
888 IS
889 l_org_id NUMBER;
890 l_asl_id NUMBER;
891 l_bill_date_elapsed NUMBER;
892 BEGIN
893
894 l_org_id := p_org_id;
895 l_asl_id := p_asl_id;
896
897 SELECT COUNT(*)
898 INTO l_bill_date_elapsed
899 FROM po_asl_attributes
900 WHERE TRUNC(last_billing_date) +
901 NVL(consigned_billing_cycle,0) > TRUNC(SYSDATE)
902 AND asl_id = l_asl_id ;
903
904 x_bill_date_elapsed := l_bill_date_elapsed;
905
906 END Get_Elapsed_Info;
907
908 --========================================================================
909 -- PROCEDURE : Update_Asl PUBLIC
910 -- PARAMETERS : p_asl_id Asl Id
911 -- COMMENT : Update the billing date of the current asl
912 --========================================================================
913 PROCEDURE update_asl
914 ( p_asl_id IN NUMBER
915 )
916 IS
917 l_asl_id NUMBER;
918 BEGIN
919
920 l_asl_id := p_asl_id;
921
922 -- Update the billing date of the current asl
923
924 UPDATE
925 po_asl_attributes
926 SET last_billing_date = SYSDATE
927 WHERE asl_id = l_asl_id;
928
929 END update_asl;
930
931 --========================================================================
932 -- PROCEDURE : Create_Documents PUBLIC
933 -- PARAMETERS : p_batch_id Batch Id
934 -- p_document_id Document Id that was created
935 -- p_document_number Document number
936 -- p_line Number of lines created
937 -- x_error_code Return status
938 -- COMMENT : Wrapper to the PO autocreate to create document
939 -- This is invoked by Create Consumption Advice
940 --========================================================================
941 PROCEDURE create_documents
942 ( p_batch_id IN NUMBER
943 , p_document_id IN OUT NOCOPY NUMBER
944 , p_document_number IN OUT NOCOPY VARCHAR2
945 , p_line IN OUT NOCOPY NUMBER
946 , x_error_code OUT NOCOPY NUMBER
947 )
948 IS
949
950 BEGIN
951
952 -- Invoke the Autocreate to create the consumption advice
953
954 PO_INTERFACE_S.create_documents
955 ( x_batch_id => p_batch_id
956 , x_document_id => p_document_id
957 , x_document_number => p_document_number
958 , x_number_lines => p_line
959 , x_errorcode => x_error_code
960 );
961 END create_documents;
962
963 --========================================================================
964 -- PROCEDURE : Get_Break_Price PUBLIC
965 -- PARAMETERS: p_order_quantity Quantity
966 -- p_ship_to_org Ship to Org
967 -- p_ship_to_loc Ship to location
968 -- p_po_line_id PO Line Id
969 -- p_cum_flag Cumulative flag
970 -- p_need_by_date Need by Date
971 -- p_line_location_id Line location
972 -- x_po_price PO price without tax
973 -- COMMENT : Call the PO API to get price breaks
974 -- This is invoked by Get_PO_Info procedure to calculate
975 -- the PO price for the transaction.
976 --========================================================================
977 /* get break price API changed for Advanced Pricing Uptake - Bug 5076263 */
978 PROCEDURE get_break_price(
979 p_api_version IN NUMBER
980 , p_order_quantity IN NUMBER
981 , p_ship_to_org IN NUMBER
982 , p_ship_to_loc IN NUMBER
983 , p_po_line_id IN NUMBER
984 , p_cum_flag IN BOOLEAN
985 , p_need_by_date IN DATE
986 , p_line_location_id IN NUMBER
987 , p_contract_id IN NUMBER
988 , p_org_id IN NUMBER
989 , p_supplier_id IN NUMBER
990 , p_supplier_site_id IN NUMBER
991 , p_creation_date IN DATE
992 , p_order_header_id IN NUMBER
993 , p_order_line_id IN NUMBER
994 , p_line_type_id IN NUMBER
995 , p_item_revision IN VARCHAR2
996 , p_item_id IN NUMBER
997 , p_category_id IN NUMBER
998 , p_supplier_item_num IN VARCHAR2
999 , p_uom IN VARCHAR2
1000 , p_in_price IN NUMBER
1001 , p_currency_code IN VARCHAR2
1002 , x_base_unit_price OUT NOCOPY NUMBER
1003 , x_price_break_id OUT NOCOPY NUMBER
1004 , x_price OUT NOCOPY NUMBER
1005 , x_return_status OUT NOCOPY VARCHAR2 )
1006 IS
1007 BEGIN
1008 -- Call the price break API to calculate price breaks
1009 PO_SOURCING2_SV.get_break_price
1010 ( p_api_version => p_api_version
1011 , p_order_quantity => p_order_quantity
1012 , p_ship_to_org => p_ship_to_org
1016 , p_need_by_date => p_need_by_date
1013 , p_ship_to_loc => p_ship_to_loc
1014 , p_po_line_id => p_po_line_id
1015 , p_cum_flag => p_cum_flag
1017 , p_line_location_id => p_line_location_id
1018 , p_contract_id => p_contract_id
1019 , p_org_id => p_org_id
1020 , p_supplier_id => p_supplier_id
1021 , p_supplier_site_id => p_supplier_site_id
1022 , p_creation_date => p_creation_date
1023 , p_order_header_id => p_order_header_id
1024 , p_order_line_id => p_order_line_id
1025 , p_line_type_id => p_line_type_id
1026 , p_item_revision => p_item_revision
1027 , p_item_id => p_item_id
1028 , p_category_id => p_category_id
1029 , p_supplier_item_num=> p_supplier_item_num
1030 , p_uom => p_uom
1031 , p_in_price => p_in_price
1032 , p_currency_code => p_currency_code
1033 , x_base_unit_price => x_base_unit_price
1034 , x_price_break_id => x_price_break_id
1035 , x_price => x_price
1036 , x_return_status => x_return_status
1037 );
1038
1039
1040 END get_break_price;
1041
1042 --========================================================================
1043 -- FUNCTION : Is_Global PUBLIC
1044 -- PARAMETERS: p_order_quantity Quantity
1045 -- p_ship_to_org Ship to Org
1046 -- p_ship_to_loc Ship to location
1047 -- p_po_line_id PO Line Id
1048 -- p_cum_flag Cumulative flag
1049 -- p_need_by_date Need by Date
1050 -- p_line_location_id Line location
1051 -- x_po_price PO price without tax
1052 -- COMMENT : Call the PO API to check for Global Agreement
1053 --========================================================================
1054 FUNCTION is_global
1055 ( p_header_id IN NUMBER
1056 ) RETURN BOOLEAN
1057 IS
1058 l_global_flag BOOLEAN;
1059 BEGIN
1060 -- Invoke the PO API to check if it is a global agreement
1061 l_global_flag := PO_GA_COMMON_GRP.is_global(p_header_id);
1062
1063 RETURN NVL(l_global_flag,FALSE);
1064 END is_global;
1065
1066
1067 --========================================================================
1068 -- PROCEDURE : archive_po PUBLIC
1069 -- PARAMETERS : p_api_version API version
1070 -- p_document_id Document Id
1071 -- p_document_type Document Type
1072 -- p_document_subtype Document subtype
1073 -- x_return_status Return status
1074 -- x_msg_data Message
1075 -- COMMENT : Wrapper to the PO archiving to archive PO
1076 --========================================================================
1077 PROCEDURE archive_po
1078 ( p_api_version IN NUMBER
1079 , p_document_id IN NUMBER
1080 , p_document_type IN VARCHAR2
1081 , p_document_subtype IN VARCHAR2
1082 , x_return_status OUT NOCOPY VARCHAR2
1083 , x_msg_data OUT NOCOPY VARCHAR2
1084 )
1085 IS
1086 l_api_version NUMBER;
1087 l_document_id NUMBER;
1088 l_document_type VARCHAR2(30);
1089 l_document_subtype VARCHAR2(30);
1090 l_return_status VARCHAR2(1);
1091 l_msg_data VARCHAR2(2000);
1092 l_msg_count NUMBER;
1093 BEGIN
1094
1095 l_api_version := p_api_version;
1096 l_document_id := p_document_id;
1097 l_document_type := p_document_type;
1098 l_document_subtype := p_document_subtype;
1099
1100 PO_DOCUMENT_ARCHIVE_GRP.archive_po
1101 ( p_api_version => l_api_version
1102 , p_document_id => l_document_id
1103 , p_document_type => l_document_type
1104 , p_document_subtype => l_document_subtype
1105 , x_return_status => l_return_status
1106 , x_msg_data => l_msg_data
1107 );
1108
1109 x_return_status := l_return_status;
1110
1111 x_msg_data := l_msg_data;
1112
1113 END archive_po;
1114
1115 --========================================================================
1116 -- PROCEDURE : indicate_global PUBLIC
1117 -- PARAMETERS : p_transaction_source_id
1118 -- COMMENT : determine if records in mtl_consumption_transactions
1119 -- : as belonging to a global or local agreement
1120 --========================================================================
1121 PROCEDURE indicate_global
1122 ( p_transaction_source_id IN NUMBER
1123 , x_global_agreement_flag OUT NOCOPY VARCHAR2
1124 )
1125 IS
1126 l_global_agreement_flag VARCHAR2(1);
1127 l_transaction_source_id NUMBER;
1128 BEGIN
1129
1130 l_transaction_source_id := p_transaction_source_id;
1131
1132 SELECT
1133 NVL(global_agreement_flag,'N')
1134 INTO
1135 l_global_agreement_flag
1136 FROM
1137 po_headers_all
1138 WHERE
1139 po_header_id = l_transaction_source_id;
1140
1141 x_global_agreement_flag := l_global_agreement_flag;
1142
1143 END indicate_global;
1144
1145 --========================================================================
1146 -- FUNCTION : get_Total PUBLIC
1147 -- PARAMETERS: p_object_type Object
1148 -- p_header_id Header Id
1149 -- COMMENT : Call the PO API to check for total released amt for a blanket
1150 --========================================================================
1151 FUNCTION get_Total
1152 ( p_header_id IN NUMBER
1153 , p_object_type IN VARCHAR2
1154 ) RETURN NUMBER
1155 IS
1156 l_total_amt NUMBER;
1157 l_header_id NUMBER;
1158 l_object_type VARCHAR2(1);
1159
1160 BEGIN
1161 l_object_type := p_object_type;
1162 l_header_id := p_header_id;
1163
1164 -- Invoke the PO API to get the total released amounts
1165 l_total_amt := PO_CORE_S.get_total( x_object_type => l_object_type
1166 , x_object_id => l_header_id
1167 );
1168
1169 RETURN NVL(l_total_amt,0);
1170
1171 END get_Total;
1172
1173 END INV_PO_THIRD_PARTY_STOCK_MDTR;