DBA Data[Home] [Help]

PACKAGE: APPS.INV_QUANTITY_TREE_PVT

Source


1 PACKAGE inv_quantity_tree_pvt as
2 /* $Header: INVVQTTS.pls 120.1.12010000.2 2008/07/29 13:49:36 ptkumar ship $*/
3 
4 -- synonyms used in this program
5 --     qoh          quantity on hand
6 --     rqoh         reservable quantity on hand
7 --     qr           quantity reserved
8 --     qs           quantity suggested
9 --     att          available to transact
10 --     atr          available to reserve
11 --    sqoh          secondary quantity on hand                  -- invConv change
12 --    srqoh         secondary reservable quantity on hand       -- invConv change
13 --    sqr           secondary quantity reserved                 -- invConv change
14 --    sqs           secondare quantity suggested                -- invConv change
15 --    satt          secondary available to transact             -- invConv change
16 --    satr          secondary available to reserve              -- invConv change
17 
18 /******************************************************************
19  *
20  * Using the Quantity Tree
21  *
22  * Here's some general instructions and guidelines on using the
23  * quantity tree. This section also mentions the C code equivalents
24  * of the pl/sql procedures.
25  * 1. Create_Tree
26  *    call create_tree to build the tree for a given organization and
27  *    item.  The tree can be built in two modes: reservation mode
28  *    and transaction mode.  Reservation mode is used to determine
29  *    the available to reserve (atr) quantity (for reservations).
30  *    Transaction mode is used to determine the availabe to transact
31  *    (att) quantity, used in transactions.  The onhand_source passed
32  *    to the create tree function help define which subs and locators
33  *    will be used to determine onhand quantity.  If Onhand_source is 1,
34  *    then only the quantity in ATPable subs will be used to
35  *    determine quantity.  If onhand_source is 2, then only
36  *    the quantity in nettable subs is considered.  If onhand_source is 3,
37  *    the subs are not limited based on the nettable and ATPable flags.
38  *    Pick_release should be 0 except if called from the inventory or
39  *    wms detailing engines.
40  *    The create_tree procedure returns tree_id, which must be used
41  *    to query or update the tree.
42  *    The equivalent function in the C code is CreateTree.
43  *
44  * 2. Query_Tree
45  *    This procedure is used to find the values for quantity onhand,
46  *    reservable quantity on hand, quantity reserved, quantity suggested,
47  *    availabe to transact, and available to reserve. This procedure
48  *    takes the place of 2 C functions: QtyQuery and SubXQuery.  If
49  *    tree is being queried in transaction mode, and
50  *    the transaction is a subinventory
51  *    transfer, then pass the subinventory code of the destination
52  *    sub in the p_transfer_subinventory_code parameter.  In all other
53  *    cases, set the p_transfer_subinventory_code parameter to NULL.
54  *    ATT and ATR are calculated differently depending on whether
55  *    the transaction is a subinventory transfer or some other
56  *    transaction.
57  *
58  * 3. Update_Quantities
59  *    The update procedure changes the quantity in the quantity tree
60  *    for a given item/org/revision/lot/sub/locator.  The quantity
61  *    updated depends on the quantity type parameter. If the quantity
62  *    type is g_qoh, then the p_primary_quantity value is added
63  *    to the quantity onhand.  If the quantity type is g_qs_txn,
64  *    then the quantity suggested value is updated. Reservations
65  *    work the same way. Update_quantities does not update the
66  *    database - it only updates the local version of the qty tree.
67  *    The database must be updated separately.
68  *          There are a couple of important things to keep in mind.
69  *    First, the quantity passed in to update_quantities is important.
70  *    The quantity is always added to the appropriate node qty.  So,
71  *    for a receipt txn, the quantity passed in should be
72  *    positive.  For an issue txn,  the quantity passed in
73  *    should have a negative sign (to decrement
74  *    on hand quantity).  For reserving items or suggesting
75  *    an issue, the value passed in should be positive (incrementing
76  *    quantity reserved or quantity suggested). Do not update the
77  *    tree with suggested receipts; including suggested receipts
78  *    could lead to missing inventory if the suggestion is not
79  *    transacted.
80  *          Second, this function is the same as the C function
81  *    QtyAvail.  There is no pl/sql equivalent of the C function
82  *    SubXFer.  For a subinventory transfer transaction which
83  *    updates both the destination location and the source location,
84  *    update_quantities must be called twice.  First, add the quantity to
85  *    the destination sub/locator.  Then decrement the quantity from the
86  *    source sub/locator.  Order is important - this ordering assures
87  *    that higher level att/atr are not made negative. The updates
88  *    to both the destination and source should only happen for actual
89  *    transactions, not suggested transfers.
90  *
91  * 4. Do_check
92  *    This procedure should be called before committing quantity
93  *    updates to the database. There can be multiple quantity trees
94  *    for each item and organization.  Updates in a quantity tree
95  *    are not reflected in other quantity trees of the same org/item.
96  *    Thus, it would be possible for two different sessions to try
97  *    to reserve or transact the same quantity, which would led
98  *    to negative quantity, a big no-no. To solve this problem, call
99  *    do_check before commiting.  This procedure will rebuild the
100  *    quantity tree with the current info in the database.  If your
101  *    updates would drive the quantity negative (and if negative
102  *    quantities are not allowed), then x_no_violation will be false.
103  *    You should then rollback your updates.
104  *
105  ***********************************************************************/
106 -- Constant Definition
107 --
108 -- Source Type ID Constants
109 --
110 -- The following constants are valid demand source type ids and
111 -- supply source type ids.
112 -- They are the same as TRANSACTION_SOURCE_TYPE_ID
113 -- in table MTL_TXN_SOURCE_TYPES.
114 g_source_type_po             CONSTANT NUMBER := 1 ;
115 g_source_type_oe             CONSTANT NUMBER := 2 ;
116 g_source_type_account        CONSTANT NUMBER := 3 ;
117 g_source_type_trans_order    CONSTANT NUMBER := 4 ;
118 g_source_type_wip            CONSTANT NUMBER := 5 ;
119 g_source_type_account_alias  CONSTANT NUMBER := 6 ;
120 g_source_type_internal_req   CONSTANT NUMBER := 7 ;
121 g_source_type_internal_ord   CONSTANT NUMBER := 8 ;
122 g_source_type_cycle_count    CONSTANT NUMBER := 9 ;
123 g_source_type_physical_inv   CONSTANT NUMBER := 10;
124 g_source_type_standard_cost  CONSTANT NUMBER := 11;
125 g_source_type_rma            CONSTANT NUMBER := 12;
126 g_source_type_inv            CONSTANT NUMBER := 13;
127 --
128 -- Tree mode constants
129 --   Users can call create_tree() in three modes, reservation mode,
130 --   transaction mode, and loose items only mode.  In loose items only
131 --   mode, only quantity not in containers is considered
132 g_reservation_mode CONSTANT INTEGER := 1;
133 g_transaction_mode CONSTANT INTEGER := 2;
134 g_loose_only_mode  CONSTANT INTEGER := 3;
135 g_no_lpn_rsvs_mode  CONSTANT INTEGER := 4;
136 --
137 -- Quantity type constants
138 --   User can call update_quantities to change quantities at a given level.
139 --   Quantity type constans should be used to specify which quantity the user
140 --   intents to change: quantity onhand, or quantity reserved
141 g_qoh             CONSTANT INTEGER := 1; -- quantity on hand
142 g_qr_same_demand  CONSTANT INTEGER := 2; -- quantity reserved for the same demand source
143 g_qr_other_demand CONSTANT INTEGER := 3; -- quantity reserved for other demand source
144 g_qs_rsv          CONSTANT INTEGER := 4; -- quantity for suggested reservation
145 g_qs_txn          CONSTANT INTEGER := 5; -- quantity for suggested transaction
146 
147 -- Onhand Source
148 --  Defined in mtl_onhand_source lookup
149 --  Used to determine which subs are included in calculation of
150 --  onhand qty
151 g_atpable_only	  CONSTANT NUMBER := 1;
152 g_nettable_only   CONSTANT NUMBER := 2;
153 g_all_subs	  CONSTANT NUMBER := 3;
154 g_atpable_nettable_only CONSTANT NUMBER := 4;
155 
156 -- Containerized
157 --  Used to indicate packed quantities for use in quantity calculations
158 --  If 0, then record is not packed in container.
159 --  If 1, then record is packed in containter.
160 g_containerized_true	  CONSTANT NUMBER := 1;
161 g_containerized_false	  CONSTANT NUMBER := 0;
162 
163 -- Exclusive
164 --  Used to indicate if tree should be build in exclusive mode
165 --  If 0, then tree is not locked when it is built.
166 --  If 1, then tree is locked when built.
167 g_exclusive	  CONSTANT NUMBER := 1;
168 g_non_exclusive	  CONSTANT NUMBER := 0;
169 
170 -- Pick Release
171 --  Used to indicate if the tree is being called from the pick release
172 --  process.  When the tree is built during pick release, we should
173 --  consider all reservations that have a staged flag, even if the
174 --  reservation is for the same transaction.  This way, quantity in
175 --  staging lanes never appears to be available, and the pick
176 --  release process will not allocate from staging locations.  All
177 --  other times, the tree should not consider reservations which are
178 --  for this current transactions.
179 --  If 0, then tree is built normally (ignoring reservations for current
180 --     transaction)
181 --  If 1, then tree is built in pick release (considering staged
182 --     reservations for the current transaction)
183 g_pick_release_yes  	CONSTANT NUMBER := 1;
184 g_pick_release_no 	CONSTANT NUMBER := 0;
185 
186 -- invConv: need to set this variable... in order to stop populating the TOP nodes when the first QT is complete after a CT :
187 g_is_populating_top_node BOOLEAN := TRUE;
188 /* Jalaj Srivastava Bug 5590287
189    set the value of global var g_is_mat_status_used from the profile INV_MATERIAL_STATUS
190    in create_tree procedure body. no value should be defaulted here.
191    This variable detemines whether reservations allowed flag derived from
192    material status definition is used for lots and locators while computing atr
193    INV_MATERIAL_STATUS == 1 == YES
194    INV_MATERIAL_STATUS == 2 == NO   */
195 g_is_mat_status_used  NUMBER;
196 -- invConv changes end.
197 
198 -- Function
199 --   demand_source_equals
200 -- Description
201 --   Compare whether two demand sources are the same.
202 -- Return Value
203 --   'Y' if the two demand sources are the same; 'N' otherwise
204 Function demand_source_equals
205   (  p_demand_source_type_id1   NUMBER
206     ,p_demand_source_header_id1 NUMBER
207     ,p_demand_source_line_id1   NUMBER
208     ,p_demand_source_delivery1  NUMBER
209     ,p_demand_source_name1      VARCHAR2
210     ,p_demand_source_type_id2   NUMBER
211     ,p_demand_source_header_id2 NUMBER
212     ,p_demand_source_line_id2   NUMBER
213     ,p_demand_source_delivery2  NUMBER
214     ,p_demand_source_name2      VARCHAR2
215      ) RETURN VARCHAR2;
216 PRAGMA restrict_references(demand_source_equals, wnds, wnps, rnds);
217 --
218 -- Procedure
219 --   clear_quantity_cache
220 -- Description
221 --   Delete all quantity trees in the memory. Should be called when you call
222 --   rollback. Otherwise the trees in memory may not be in sync with the data
223 --   in the corresponding database tables
224 PROCEDURE clear_quantity_cache;
225 
226 --
227 -- Procedure
228 --   create_tree
229 -- Description
230 --   Create a quantity tree
231 --
232 --  Version
233 --   Current version           1.0
234 --   Initial version           1.0
235 --
236 -- Input parameters:
237 --   p_api_version_number      standard input parameter
238 --   p_init_msg_lst            standard input parameter
239 --   p_organization_id         organzation id
240 --   p_inventory_item_id       inventory_item_id
241 --   p_tree_mode               tree mode, either g_reservation_mode
242 --                             or g_transaction_mode
243 --   p_is_revision_control
244 --   p_is_lot_control
245 --   p_is_serial_control
246 --   p_asset_sub_only
247 --   p_include_suggestion      should be true only for pick/put engine
248 --   p_demand_source_type_id   demand_source_type_id
249 --   p_demand_source_header_id demand_source_header_id
250 --   p_demand_source_line_id   demand_source_line_id
251 --   p_demand_source_name      demand_source_name
252 --   p_demand_source_delivery  demand_source_delivery
253 --   p_onhand_source	       describes subinventories in which to search
254 --				for onhand - nettable, ATPable, all
255 --
256 -- Output parameters:
260 --   x_tree_id                 used later to refer to the same tree
257 --   x_return_status           standard output parameter
258 --   x_msg_count               standard output parameter
259 --   x_msg_data                standard output parameter
261 --
262 PROCEDURE create_tree
263   (   p_api_version_number       IN  NUMBER
264    ,  p_init_msg_lst             IN  VARCHAR2 DEFAULT fnd_api.g_false
265    ,  x_return_status            OUT NOCOPY VARCHAR2
266    ,  x_msg_count                OUT NOCOPY NUMBER
267    ,  x_msg_data                 OUT NOCOPY VARCHAR2
268    ,  p_organization_id          IN  NUMBER
269    ,  p_inventory_item_id        IN  NUMBER
270    ,  p_tree_mode                IN  INTEGER
271    ,  p_is_revision_control      IN  BOOLEAN
272    ,  p_is_lot_control           IN  BOOLEAN
273    ,  p_is_serial_control        IN  BOOLEAN
274    ,  p_asset_sub_only           IN  BOOLEAN  DEFAULT FALSE
275    ,  p_include_suggestion       IN  BOOLEAN  DEFAULT FALSE
276    ,  p_demand_source_type_id    IN  NUMBER   DEFAULT -9999
277    ,  p_demand_source_header_id  IN  NUMBER   DEFAULT -9999
278    ,  p_demand_source_line_id    IN  NUMBER   DEFAULT -9999
279    ,  p_demand_source_name       IN  VARCHAR2 DEFAULT NULL
280    ,  p_demand_source_delivery   IN  NUMBER   DEFAULT NULL
281    ,  p_lot_expiration_date      IN  DATE     DEFAULT NULL
282    ,  x_tree_id                  OUT NOCOPY INTEGER
283    ,  p_onhand_source		 IN  NUMBER   DEFAULT 3  --g_all_subs
284    ,  p_exclusive		 IN  NUMBER   DEFAULT 0  --g_non_exclusive
285    ,  p_pick_release		 IN  NUMBER   DEFAULT 0  --g_pick_release_no
286    );
287 
288 -- invConv changes begin : OVERLOAD ANYWAY.
289 PROCEDURE create_tree
290   (   p_api_version_number       IN  NUMBER
291    ,  p_init_msg_lst             IN  VARCHAR2 DEFAULT fnd_api.g_false
292    ,  x_return_status            OUT NOCOPY VARCHAR2
293    ,  x_msg_count                OUT NOCOPY NUMBER
294    ,  x_msg_data                 OUT NOCOPY VARCHAR2
295    ,  p_organization_id          IN  NUMBER
296    ,  p_inventory_item_id        IN  NUMBER
297    ,  p_tree_mode                IN  INTEGER
298    ,  p_is_revision_control      IN  BOOLEAN
299    ,  p_is_lot_control           IN  BOOLEAN
300    ,  p_is_serial_control        IN  BOOLEAN
301    ,  p_grade_code               IN  VARCHAR2                       -- invConv change
302    ,  p_asset_sub_only           IN  BOOLEAN  DEFAULT FALSE
303    ,  p_include_suggestion       IN  BOOLEAN  DEFAULT FALSE
304    ,  p_demand_source_type_id    IN  NUMBER   DEFAULT -9999
305    ,  p_demand_source_header_id  IN  NUMBER   DEFAULT -9999
306    ,  p_demand_source_line_id    IN  NUMBER   DEFAULT -9999
307    ,  p_demand_source_name       IN  VARCHAR2 DEFAULT NULL
308    ,  p_demand_source_delivery   IN  NUMBER   DEFAULT NULL
309    ,  p_lot_expiration_date      IN  DATE     DEFAULT NULL
310    ,  x_tree_id                  OUT NOCOPY INTEGER
311    ,  p_onhand_source		 IN  NUMBER   DEFAULT 3  --g_all_subs
312    ,  p_exclusive		 IN  NUMBER   DEFAULT 0  --g_non_exclusive
313    ,  p_pick_release		 IN  NUMBER   DEFAULT 0  --g_pick_release_no
314    );
315 -- invConv changes end.
316 
317 -- Procedure
318 --   query tree
319 --
320 --  Version
321 --   Current version       1.0
322 --   Initial version       1.0
323 --
324 -- Input parameters:
325 --   p_api_version_number   standard input parameter
326 --   p_init_msg_lst         standard input parameter
327 --   p_tree_id              tree_id
328 --   p_revision             revision
329 --   p_lot_number           lot_number
330 --   p_subinventory_code    subinventory code
331 --   p_locator_id           locator_id
332 --   p_to_subinventory_code destination subinventory for subinventory transfer
333 --			    transactions.  Should be NULL otherwise.
334 --
335 -- Output parameters:
336 --   x_return_status       standard output parameter
337 --   x_msg_count           standard output parameter
338 --   x_msg_data            standard output parameter
339 --   x_qoh                 qoh
340 --   x_rqoh                rqoh
341 --   x_qr                  qr
342 --   x_qs                  qs
343 --   x_att                 att
344 --   x_atr                 atr
345 --
346 PROCEDURE query_tree
347   (   p_api_version_number   IN  NUMBER
348    ,  p_init_msg_lst         IN  VARCHAR2 DEFAULT fnd_api.g_false
349    ,  x_return_status        OUT NOCOPY VARCHAR2
350    ,  x_msg_count            OUT NOCOPY NUMBER
351    ,  x_msg_data             OUT NOCOPY VARCHAR2
352    ,  p_tree_id              IN  INTEGER
353    ,  p_revision             IN  VARCHAR2
354    ,  p_lot_number           IN  VARCHAR2
355    ,  p_subinventory_code    IN  VARCHAR2
356    ,  p_locator_id           IN  NUMBER
357    ,  x_qoh                  OUT NOCOPY NUMBER
358    ,  x_rqoh                 OUT NOCOPY NUMBER
359    ,  x_qr                   OUT NOCOPY NUMBER
360    ,  x_qs                   OUT NOCOPY NUMBER
361    ,  x_att                  OUT NOCOPY NUMBER
362    ,  x_atr                  OUT NOCOPY NUMBER
363    ,  p_transfer_subinventory_code IN  VARCHAR2 DEFAULT NULL
364    ,  p_cost_group_id	     IN  NUMBER DEFAULT NULL
365    ,  p_lpn_id	             IN  NUMBER DEFAULT NULL
366    ,  p_transfer_locator_id  IN  NUMBER DEFAULT NULL
367    );
368 
369 -- invConv changes begin : overload
370 PROCEDURE query_tree
371   (   p_api_version_number   IN  NUMBER
372    ,  p_init_msg_lst         IN  VARCHAR2 DEFAULT fnd_api.g_false
373    ,  x_return_status        OUT NOCOPY VARCHAR2
377    ,  p_revision             IN  VARCHAR2
374    ,  x_msg_count            OUT NOCOPY NUMBER
375    ,  x_msg_data             OUT NOCOPY VARCHAR2
376    ,  p_tree_id              IN  INTEGER
378    ,  p_lot_number           IN  VARCHAR2
379    ,  p_subinventory_code    IN  VARCHAR2
380    ,  p_locator_id           IN  NUMBER
381    ,  x_qoh                  OUT NOCOPY NUMBER
382    ,  x_rqoh                 OUT NOCOPY NUMBER
383    ,  x_qr                   OUT NOCOPY NUMBER
384    ,  x_qs                   OUT NOCOPY NUMBER
385    ,  x_att                  OUT NOCOPY NUMBER
386    ,  x_atr                  OUT NOCOPY NUMBER
387    ,  x_sqoh                 OUT NOCOPY NUMBER       -- invConv change
388    ,  x_srqoh                OUT NOCOPY NUMBER       -- invConv change
389    ,  x_sqr                  OUT NOCOPY NUMBER       -- invConv change
390    ,  x_sqs                  OUT NOCOPY NUMBER       -- invConv change
391    ,  x_satt                 OUT NOCOPY NUMBER       -- invConv change
392    ,  x_satr                 OUT NOCOPY NUMBER       -- invConv change
393    ,  p_transfer_subinventory_code IN  VARCHAR2 DEFAULT NULL
394    ,  p_cost_group_id	     IN  NUMBER DEFAULT NULL
395    ,  p_lpn_id	             IN  NUMBER DEFAULT NULL
396    ,  p_transfer_locator_id  IN  NUMBER DEFAULT NULL
397    );
398 -- invConv changes end.
399 
400 --Query_Tree
401 --  Use this query_tree to return the packed quantity on hand.
402 --  The Packed Quantity On Hand is the total on hand sitting in
403 --  LPNs.
404 --  PQOH is populated only if the tree is created in loose_only_mode.
405 --  If tree is not created in loose_only_mode, this API will return
406 --  PQOH of 0.
407 
408 PROCEDURE query_tree
409   (   p_api_version_number   IN  NUMBER
410    ,  p_init_msg_lst         IN  VARCHAR2 DEFAULT fnd_api.g_false
411    ,  x_return_status        OUT NOCOPY VARCHAR2
412    ,  x_msg_count            OUT NOCOPY NUMBER
413    ,  x_msg_data             OUT NOCOPY VARCHAR2
414    ,  p_tree_id              IN  INTEGER
415    ,  p_revision             IN  VARCHAR2
416    ,  p_lot_number           IN  VARCHAR2
417    ,  p_subinventory_code    IN  VARCHAR2
418    ,  p_locator_id           IN  NUMBER
419    ,  x_qoh                  OUT NOCOPY NUMBER
420    ,  x_rqoh                 OUT NOCOPY NUMBER
421    ,  x_pqoh                 OUT NOCOPY NUMBER
422    ,  x_qr                   OUT NOCOPY NUMBER
423    ,  x_qs                   OUT NOCOPY NUMBER
424    ,  x_att                  OUT NOCOPY NUMBER
425    ,  x_atr                  OUT NOCOPY NUMBER
426    ,  p_transfer_subinventory_code IN  VARCHAR2 DEFAULT NULL
427    ,  p_cost_group_id	     IN  NUMBER DEFAULT NULL
428    ,  p_lpn_id	             IN  NUMBER DEFAULT NULL
429    ,  p_transfer_locator_id  IN  NUMBER DEFAULT NULL
430    );
431 
432 -- invConv changes begin: overload
433 PROCEDURE query_tree
434   (   p_api_version_number   IN  NUMBER
435    ,  p_init_msg_lst         IN  VARCHAR2 DEFAULT fnd_api.g_false
436    ,  x_return_status        OUT NOCOPY VARCHAR2
437    ,  x_msg_count            OUT NOCOPY NUMBER
438    ,  x_msg_data             OUT NOCOPY VARCHAR2
439    ,  p_tree_id              IN  INTEGER
440    ,  p_revision             IN  VARCHAR2
441    ,  p_lot_number           IN  VARCHAR2
442    ,  p_subinventory_code    IN  VARCHAR2
443    ,  p_locator_id           IN  NUMBER
444    ,  x_qoh                  OUT NOCOPY NUMBER
445    ,  x_rqoh                 OUT NOCOPY NUMBER
446    ,  x_pqoh                 OUT NOCOPY NUMBER
447    ,  x_qr                   OUT NOCOPY NUMBER
448    ,  x_qs                   OUT NOCOPY NUMBER
449    ,  x_att                  OUT NOCOPY NUMBER
450    ,  x_atr                  OUT NOCOPY NUMBER
451    ,  x_sqoh                 OUT NOCOPY NUMBER       -- invConv change
452    ,  x_srqoh                OUT NOCOPY NUMBER       -- invConv change
453    ,  x_spqoh                OUT NOCOPY NUMBER       -- invConv change
454    ,  x_sqr                  OUT NOCOPY NUMBER       -- invConv change
455    ,  x_sqs                  OUT NOCOPY NUMBER       -- invConv change
456    ,  x_satt                 OUT NOCOPY NUMBER       -- invConv change
457    ,  x_satr                 OUT NOCOPY NUMBER       -- invConv change
458    ,  p_transfer_subinventory_code IN  VARCHAR2 DEFAULT NULL
459    ,  p_cost_group_id	     IN  NUMBER DEFAULT NULL
460    ,  p_lpn_id	             IN  NUMBER DEFAULT NULL
461    ,  p_transfer_locator_id  IN  NUMBER DEFAULT NULL
462    );
463 -- invConv changes end.
464 
465 --
466 -- Procedure
467 --   update_quantities
468 -- Description
469 --   update a quantity tree
470 --
471 --  Version
472 --   Current version        1.0
473 --   Initial version        1.0
474 --
475 -- Input parameters:
476 --   p_api_version_number   standard input parameter
477 --   p_init_msg_lst         standard input parameter
478 --   p_tree_id              tree_id
479 --   p_revision             revision
480 --   p_lot_number           lot_number
481 --   p_subinventory_code    subinventory_code
482 --   p_locator_id           locator_id
483 --   p_primary_quantity     primary_quantity
484 --   p_quantity_type
485 --   p_containerized	    set to g_containerized_true if
486 --			     quantity is in container
487 -- Output parameters:
488 --   x_return_status       standard output parameter
489 --   x_msg_count           standard output parameter
493 --   x_rqoh                rqoh  after the update
490 --   x_msg_data            standard output parameter
491 --   x_tree_id             used later to refer to the same tree
492 --   x_qoh                 qoh   after the update
494 --   x_qr                  qr    after the update
495 --   x_qs                  qs    after the update
496 --   x_att                 att   after the update
497 --   x_atr                 atr   after the update
498 PROCEDURE update_quantities
499   (  p_api_version_number    IN  NUMBER
500    , p_init_msg_lst          IN  VARCHAR2 DEFAULT fnd_api.g_false
501    , x_return_status         OUT NOCOPY VARCHAR2
502    , x_msg_count             OUT NOCOPY NUMBER
503    , x_msg_data              OUT NOCOPY VARCHAR2
504    , p_tree_id               IN  INTEGER
505    , p_revision              IN  VARCHAR2 DEFAULT NULL
506    , p_lot_number            IN  VARCHAR2 DEFAULT NULL
507    , p_subinventory_code     IN  VARCHAR2 DEFAULT NULL
508    , p_locator_id            IN  NUMBER   DEFAULT NULL
509    , p_primary_quantity      IN  NUMBER
510    , p_quantity_type         IN  INTEGER
511    , x_qoh                   OUT NOCOPY NUMBER
512    , x_rqoh                  OUT NOCOPY NUMBER
513    , x_qr                    OUT NOCOPY NUMBER
514    , x_qs                    OUT NOCOPY NUMBER
515    , x_att                   OUT NOCOPY NUMBER
516    , x_atr                   OUT NOCOPY NUMBER
517    , p_transfer_subinventory_code IN  VARCHAR2 DEFAULT NULL
518    , p_cost_group_id	     IN  NUMBER DEFAULT NULL
519    , p_containerized         IN  NUMBER DEFAULT g_containerized_false
520    , p_lpn_id	             IN  NUMBER DEFAULT NULL
521    , p_transfer_locator_id   IN  NUMBER DEFAULT NULL
522    ) ;
523 
524 -- invConv changes begin: overload
525 PROCEDURE update_quantities
526   (  p_api_version_number    IN  NUMBER
527    , p_init_msg_lst          IN  VARCHAR2 DEFAULT fnd_api.g_false
528    , x_return_status         OUT NOCOPY VARCHAR2
529    , x_msg_count             OUT NOCOPY NUMBER
530    , x_msg_data              OUT NOCOPY VARCHAR2
531    , p_tree_id               IN  INTEGER
532    , p_revision              IN  VARCHAR2 DEFAULT NULL
533    , p_lot_number            IN  VARCHAR2 DEFAULT NULL
534    , p_subinventory_code     IN  VARCHAR2 DEFAULT NULL
535    , p_locator_id            IN  NUMBER   DEFAULT NULL
536    , p_primary_quantity      IN  NUMBER
537    , p_secondary_quantity    IN  NUMBER          -- invConv change
538    , p_quantity_type         IN  INTEGER
539    , x_qoh                   OUT NOCOPY NUMBER
540    , x_rqoh                  OUT NOCOPY NUMBER
541    , x_qr                    OUT NOCOPY NUMBER
542    , x_qs                    OUT NOCOPY NUMBER
543    , x_att                   OUT NOCOPY NUMBER
544    , x_atr                   OUT NOCOPY NUMBER
545    , x_sqoh                  OUT NOCOPY NUMBER            -- invConv change
546    , x_srqoh                 OUT NOCOPY NUMBER            -- invConv change
547    , x_sqr                   OUT NOCOPY NUMBER            -- invConv change
548    , x_sqs                   OUT NOCOPY NUMBER            -- invConv change
549    , x_satt                  OUT NOCOPY NUMBER            -- invConv change
550    , x_satr                  OUT NOCOPY NUMBER            -- invConv change
551    , p_transfer_subinventory_code IN  VARCHAR2 DEFAULT NULL
552    , p_cost_group_id	     IN  NUMBER DEFAULT NULL
553    , p_containerized         IN  NUMBER DEFAULT g_containerized_false
554    , p_lpn_id	             IN  NUMBER DEFAULT NULL
555    , p_transfer_locator_id   IN  NUMBER DEFAULT NULL
556    ) ;
557 -- invConv changes end.
558 
559 --
560 -- Procedure
561 --   do_check
562 -- Description
563 --   Check quantity violation
564 --
565 --  Version
566 --   Current version           1.0
567 --   Initial version           1.0
568 --
569 -- Input parameters:
570 --   p_api_version_number      standard input parameter
571 --   p_init_msg_lst            standard input parameter
572 --   p_tree_id                 tree id
573 --
574 -- Output parameters:
575 --   x_return_status           standard output parameter
576 --   x_msg_count               standard output parameter
577 --   x_msg_data                standard output parameter
578 --   x_no_violation            true if no violation, false otherwise
579 --
580 PROCEDURE do_check
581   (  p_api_version_number  IN  NUMBER
582    , p_init_msg_lst        IN  VARCHAR2 DEFAULT fnd_api.g_false
583    , x_return_status       OUT NOCOPY VARCHAR2
584    , x_msg_count           OUT NOCOPY NUMBER
585    , x_msg_data            OUT NOCOPY VARCHAR2
586    , p_tree_id             IN  INTEGER
587    , x_no_violation        OUT NOCOPY BOOLEAN
588    );
589 
590 --
591 -- Procedure
592 --   do_check
593 -- Description
594 --   Check quantity violation
595 --
596 --  Version
597 --   Current version           1.0
598 --   Initial version           1.0
599 --
600 -- Input parameters:
601 --   p_api_version_number      standard input parameter
602 --   p_init_msg_lst            standard input parameter
603 --
604 -- Output parameters:
605 --   x_return_status           standard output parameter
606 --   x_msg_count               standard output parameter
607 --   x_msg_data                standard output parameter
608 --   x_no_violation            true if no violation, false otherwise
612    , p_init_msg_lst        IN  VARCHAR2 DEFAULT fnd_api.g_false
609 --
610 PROCEDURE do_check
611   (  p_api_version_number  IN  NUMBER
613    , x_return_status       OUT NOCOPY VARCHAR2
614    , x_msg_count           OUT NOCOPY NUMBER
615    , x_msg_data            OUT NOCOPY VARCHAR2
616    , x_no_violation        OUT NOCOPY BOOLEAN
617    );
618 
619 --
620 -- Procedure
621 --   free_tree
622 -- Description
623 --   free the tree when it is no longer needed
624 --
625 --  Version
626 --   Current version           1.0
627 --   Initial version           1.0
628 --
629 -- Input parameters:
630 --   p_api_version_number      standard input parameter
631 --   p_init_msg_lst            standard input parameter
632 --   p_tree_id                 tree id
633 --
634 -- Output parameters:
635 --   x_return_status           standard output parameter
636 --   x_msg_count               standard output parameter
637 --   x_msg_data                standard output parameter
638 --
639 PROCEDURE free_tree
640   (  p_api_version_number  IN  NUMBER
641    , p_init_msg_lst        IN  VARCHAR2 DEFAULT fnd_api.g_false
642    , x_return_status       OUT NOCOPY VARCHAR2
643    , x_msg_count           OUT NOCOPY NUMBER
644    , x_msg_data            OUT NOCOPY VARCHAR2
645    , p_tree_id             IN  INTEGER
646    );
647 
648 --
649 -- Procedure
650 --   free_all
651 -- Description
652 --   free all the trees
653 --
654 --  Version
655 --   Current version           1.0
656 --   Initial version           1.0
657 --
658 -- Input parameters:
659 --   p_api_version_number      standard input parameter
660 --   p_init_msg_lst            standard input parameter
661 --
662 -- Output parameters:
663 --   x_return_status           standard output parameter
664 --   x_msg_count               standard output parameter
665 --   x_msg_data                standard output parameter
666 --
667 PROCEDURE free_all
668   (  p_api_version_number  IN  NUMBER
669    , p_init_msg_lst        IN  VARCHAR2 DEFAULT fnd_api.g_false
670    , x_return_status       OUT NOCOPY VARCHAR2
671    , x_msg_count           OUT NOCOPY NUMBER
672    , x_msg_data            OUT NOCOPY VARCHAR2
673    );
674 
675 --
676 -- Procedure
677 --   mark_all_for_refresh
678 -- Description
679 --   marks all existing trees as needing to be rebuilt. Unlike
680 --   free_tree and clear_quantity_cache, no quantity trees are deleted.
681 --
682 --   This API is needed so that the do_check_for_commit procedure in
683 --   INVRSV3B.pls will still work.  That procedure stores tree_ids in a
684 --   temp table. When clear_quantity_cache is called, these tree_ids are
685 --   no longer valid. When this is called instead of clear_quantity_cache,
686 --   the tree_ids are still valid to be passed to do_check.
687 --
688 --
689 --  Version
690 --   Current version           1.0
691 --   Initial version           1.0
692 --
693 -- Input parameters:
694 --   p_api_version_number      standard input parameter
695 --   p_init_msg_lst            standard input parameter
696 --
697 -- Output parameters:
698 --   x_return_status           standard output parameter
699 --   x_msg_count               standard output parameter
700 --   x_msg_data                standard output parameter
701 --
702 PROCEDURE mark_all_for_refresh
703   (  p_api_version_number  IN  NUMBER
704    , p_init_msg_lst        IN  VARCHAR2
705    , x_return_status       OUT NOCOPY VARCHAR2
706    , x_msg_count           OUT NOCOPY NUMBER
707    , x_msg_data            OUT NOCOPY VARCHAR2
708    );
709 
710 
711 --
712 -- Procedure
713 --    find_rootinfo
714 -- Description
715 --    find a rootinfo record based on input parameters
716 -- Version
717 --  Current Version 	1.0
718 --  Initial Version 	1.0
719 --
720 -- Input Parameters
721 --   p_api_version_number      standard input parameter
722 --   p_init_msg_lst            standard input parameter
723 --
724 -- Output parameters:
725 --   x_return_status           standard output parameter
726 --   x_msg_count               standard output parameter
727 --   x_msg_data                standard output parameter
728 --
729 --  Return
730 --    0                          if rootinfo not found
731 --    >0                         index for the rootinfo in the rootinfo array
732 --
733 FUNCTION find_rootinfo
734   (   x_return_status            OUT NOCOPY VARCHAR2
735    ,  p_organization_id          IN  NUMBER
736    ,  p_inventory_item_id        IN  NUMBER
737    ,  p_tree_mode                IN  INTEGER
738    ,  p_is_revision_control      IN  BOOLEAN
739    ,  p_is_lot_control           IN  BOOLEAN
740    ,  p_is_serial_control        IN  BOOLEAN
741    ,  p_asset_sub_only           IN  BOOLEAN
742    ,  p_include_suggestion       IN  BOOLEAN
743    ,  p_demand_source_type_id    IN  NUMBER
744    ,  p_demand_source_header_id  IN  NUMBER
745    ,  p_demand_source_line_id    IN  NUMBER
746    ,  p_demand_source_name       IN  VARCHAR2
747    ,  p_demand_source_delivery   IN  NUMBER
748    ,  p_lot_expiration_date      IN  DATE
749    ,  p_onhand_source            IN  NUMBER
750    ,  p_pick_release             IN  NUMBER DEFAULT 0 --g_pick_release_no
751    ) RETURN INTEGER;
752 
753 -- Procedure
757 -- Note
754 --   backup_tree
755 -- Description
756 --   backup the current state of a tree
758 --   This is only a one level backup. Calling it twice will
759 --   overwrite the previous backup
760 PROCEDURE backup_tree
761   (
762      x_return_status OUT NOCOPY VARCHAR2
763    , p_tree_id       IN  INTEGER
764    );
765 
766 -- Procedure
767 --   restore_tree
768 -- Description
769 --   restore the current state of a tree to the state
770 --   at the last time when savepoint_tree is called
771 -- Note
772 --   This is only a one level restore. Calling it more than once
773 --   has the same effect as calling it once.
774 PROCEDURE restore_tree
775   (
776      x_return_status OUT NOCOPY VARCHAR2
777    , p_tree_id       IN  INTEGER
778    );
779 
780 -- **NEW BACKUP/RESTORE PROCEDURES**
781 -- Bug 2788807
782 --    We now need to support multi-level backup and restore capability
783 -- for the quantity tree.  We'll overload the existing procedures.
784 
785 -- Procedure
786 --   backup_tree
787 -- Description
788 --   backup the current state of a tree.  This procedure returns a backup_id
789 --   which needs to be passed to restore_tree in order to restore the correct
790 --   version of the quantity tree.  Unlike the older version of backup_tree,
791 --   this can be called multiple times without overwriting previous backups.
792 --   The backups dissappear when clear_quantity_cache is called.
793 --
794 PROCEDURE backup_tree
795   (
796      x_return_status OUT NOCOPY VARCHAR2
797    , p_tree_id       IN  INTEGER
798    , x_backup_id     OUT NOCOPY NUMBER
799    );
800 
801 -- Procedure
802 --   restore_tree
803 -- Description
804 --   Restores the quantity tree to the point indicated by the backup_id.
805 --   Tree_id is not strictly needed here, but is kept for overloading and
806 --   error checking purposes.  Restore_tree can be called multiple times for
807 --   the same backup_id - a saved quantity tree is not deleted until
808 --   clear_quantity_cahce is called.
809 PROCEDURE restore_tree
810   (
811      x_return_status OUT NOCOPY VARCHAR2
812    , p_tree_id       IN  INTEGER
813    , p_backup_id     IN  NUMBER
814    );
815 
816 
817 -- Procedure
818 --   lock_tree
819 -- Description
820 --   this function places a user lock on an item/organization
821 --   combination.  Once this lock is placed, no other sessions
822 --   can lock the same item/org combo.  Users who call lock_tree
823 --   do not always have to call release_lock explicitly.  The lock is
824 --   released automatically at commit, rollback, or session loss.
825 PROCEDURE lock_tree(
826      p_api_version_number   IN  NUMBER
827    , p_init_msg_lst         IN  VARCHAR2 DEFAULT fnd_api.g_false
828    , x_return_status        OUT NOCOPY VARCHAR2
829    , x_msg_count            OUT NOCOPY NUMBER
830    , x_msg_data             OUT NOCOPY VARCHAR2
831    , p_organization_id      IN  NUMBER
832    , p_inventory_item_id    IN  NUMBER);
833 
834 
835 
836 -- Procedure
837 --   release_lock
838 -- Description
839 --   this function releases the user lock on an item/organization
840 --   combination created by this session.  Users who call lock_tree
841 --   do not always have to call release_lock explicitly.  The lock is
842 --   released automatically at commit, rollback, or session loss.
843 
844 PROCEDURE release_lock(
845      p_api_version_number   IN  NUMBER
846    , p_init_msg_lst         IN  VARCHAR2 DEFAULT fnd_api.g_false
847    , x_return_status        OUT NOCOPY VARCHAR2
848    , x_msg_count            OUT NOCOPY NUMBER
849    , x_msg_data             OUT NOCOPY VARCHAR2
850    , p_organization_id      IN  NUMBER
851    , p_inventory_item_id    IN  NUMBER);
852 
853 -- Procedure
854 --   prepare_reservation_quantities
855 -- Description
856 --	This procedure is called from the reservation form to
857 -- initialize the table used for the LOVs in that form.
858 -- The tree passed to this procedure should have been created in
859 -- reservation_mode.
860 PROCEDURE prepare_reservation_quantities(
861     x_return_status        OUT NOCOPY VARCHAR2
862    , p_tree_id              IN  NUMBER
863    );
864 
865 
866 -- Get_Total_QOH
867 --   This API returns the TQOH, or total quantity on hand.
868 --   This value reflects any negative balances for this
869 --   item in the organization.  The Total QOH is the minimum
870 --   of the current node's QOH and all ancestor nodes' QOH.
871 --   For example,
872 --   Consider 2 locators in the EACH subinventory:
873 --   E.1.1 has 10 onhand
874 --   E.1.2 has -20 onhand
875 --   Thus, the subinventory Each has -10 onhand.
876 --
877 --   Where calling query_tree, qoh for E.1.1 = 10.
878 --   However, when calling get_total_qoh, the TQOH
879 --   for E.1.1 = -10, reflecting the value at the subinventory level.
880 --
881 --   This procedure is used by the inventory transaction forms.
882 
883 PROCEDURE get_total_qoh
884    (  x_return_status        OUT NOCOPY VARCHAR2
885    ,  x_msg_count            OUT NOCOPY NUMBER
886    ,  x_msg_data             OUT NOCOPY VARCHAR2
887    ,  p_tree_id              IN  INTEGER
888    ,  p_revision             IN  VARCHAR2
889    ,  p_lot_number           IN  VARCHAR2
890    ,  p_subinventory_code    IN  VARCHAR2
894    ,  p_lpn_id	             IN  NUMBER DEFAULT NULL
891    ,  p_locator_id           IN  NUMBER
892    ,  p_cost_group_id	     IN  NUMBER DEFAULT NULL
893    ,  x_tqoh                 OUT NOCOPY NUMBER
895    );
896 
897 -- invConv changes begin : overload.
898 PROCEDURE get_total_qoh
899    (  x_return_status        OUT NOCOPY VARCHAR2
900    ,  x_msg_count            OUT NOCOPY NUMBER
901    ,  x_msg_data             OUT NOCOPY VARCHAR2
902    ,  p_tree_id              IN  INTEGER
903    ,  p_revision             IN  VARCHAR2
904    ,  p_lot_number           IN  VARCHAR2
905    ,  p_subinventory_code    IN  VARCHAR2
906    ,  p_locator_id           IN  NUMBER
907    ,  p_cost_group_id	     IN  NUMBER DEFAULT NULL
908    ,  x_tqoh                 OUT NOCOPY NUMBER
909    ,  x_stqoh                OUT NOCOPY NUMBER           -- invConv change
910    ,  p_lpn_id	             IN  NUMBER DEFAULT NULL
911    );
912 -- invConv changes end.
913 
914 
915 
916 
917 -------------------------------------------------------------------------------
918 -- Procedure                                                                 --
919 --   build_sql                                                               --
920 --                                                                           --
921 -- Description                                                               --
922 --   build the sql statement for the tree creation                           --
923 --                                                                           --
924 -- Notes                                                                     --
925 --   This procedure is also used by the pick and put away engine to build    --
926 --   the picking base sql                                                    --
927 --                                                                           --
928 -- Input Parameters                                                          --
929 --   p_mode                                                                  --
930 --     equals inv_quantity_tree_pvt.g_reservation_mode or                    --
931 --     inv_quantity_tree_pvt.g_transaction_mode                              --
932 --   p_is_lot_control                                                        --
933 --     true or false                                                         --
934 --   p_asset_sub_only                                                        --
935 --     true or false                                                         --
936 --   p_include_suggestion                                                    --
937 --     true or false                                                         --
938 --   p_lot_expiration_date                                                   --
939 --     if not null, only consider lots that will not expire at the date      --
940 --     or ealier                                                             --
941 --   p_pick_release                                                          --
942 --     outside APIS (not quantity tree) should call build_sql                --
943 --     with value of g_pick_release_no					     --
944 -- Output Parameters                                                         --
945 --   x_return_status                                                         --
946 --     standard output parameter. Possible values are                        --
947 --     1. fnd_api.g_ret_sts_success     for success                          --
948 --     2. fnd_api.g_ret_sts_exc_error   for expected error                   --
949 --     3. fnd_api.g_ret_sts_unexp_error for unexpected error                 --
950 -------------------------------------------------------------------------------
951 PROCEDURE build_sql
952   (
953      x_return_status       OUT NOCOPY VARCHAR2
954    , p_mode                IN  INTEGER
955    , p_is_lot_control      IN  BOOLEAN
956    , p_asset_sub_only      IN  BOOLEAN
957    , p_include_suggestion  IN  BOOLEAN
958    , p_lot_expiration_date IN  DATE
959    , p_onhand_source	   IN  NUMBER DEFAULT g_all_subs
960    , p_pick_release	   IN  NUMBER DEFAULT 0 --g_pick_release_no
961    , x_sql_statement       OUT NOCOPY long
962    , p_is_revision_control IN  BOOLEAN DEFAULT TRUE
963    );
964 
965 -------------------------------------------------------------------------------
966 -- Procedure                                                                 --
967 --   test_build_sql                                                          --
968 --                                                                           --
969 -- Description                                                               --
970 --   This is a server side test procedure for build_sql. It calls            --
971 --   build_sql with the input values to build a sql statement. Then          --
972 --   it execute the statement to print out query result to dbms_output.      --
973 --   You should turn on serveroutput to see the output.                      --
974 --                                                                           --
975 -- Input Parameters                                                          --
976 --   p_mode                                                                  --
977 --     equals inv_quantity_tree_pvt.g_reservation_mode or                    --
978 --     inv_quantity_tree_pvt.g_transaction_mode                              --
979 --   p_organization_id                                                       --
980 --     organization_id                                                       --
984 --     true or false                                                         --
981 --   p_inventory_item_id                                                     --
982 --     inventory_item_id                                                     --
983 --   p_is_lot_control                                                        --
985 --   p_asset_sub_only                                                        --
986 --     true or false                                                         --
987 --   p_include_suggestion                                                    --
988 --     true or false     should be true only for pick/put engine             --
989 --   p_lot_expiration_date                                                   --
990 --     if not null, only consider lots that will not expire before           --
991 --     or at the date                                                        --
992 --   p_demand_source_type_id                                                 --
993 --     demand_source_type_id                                                 --
994 --   p_demand_source_header_id                                               --
995 --     demand_source_header_id                                               --
996 --   p_demand_source_line_id                                                 --
997 --     demand_source_line_id                                                 --
998 --   p_demand_source_name                                                    --
999 --     demand_source_name                                                    --
1000 -------------------------------------------------------------------------------
1001 PROCEDURE test_build_sql
1002   (
1003      p_organization_id          IN  NUMBER
1004    , p_inventory_item_id        IN  NUMBER
1005    , p_mode                     IN  INTEGER
1006    , p_is_lot_control           IN  BOOLEAN
1007    , p_asset_sub_only           IN  BOOLEAN
1008    , p_include_suggestion       IN  BOOLEAN
1009    , p_lot_expiration_date      IN  DATE
1010    , p_demand_source_type_id    IN  NUMBER
1011    , p_demand_source_header_id  IN  NUMBER
1012    , p_demand_source_line_id    IN  NUMBER
1013    , p_demand_source_name       IN  VARCHAR2
1014    , p_demand_source_delivery   IN  NUMBER
1015    , p_onhand_source		IN  NUMBER DEFAULT g_all_subs
1016    );
1017 
1018 --
1019 -- Debugging procedures
1020 --   The procedures followed are for testing purpose
1021 --   only
1022 --
1023 
1024 -- Procedure
1025 --   print_tree
1026 -- Description
1027 --   print the information in a tree to dbms_output
1028 PROCEDURE print_tree
1029   (
1030    p_tree_id IN INTEGER
1031    );
1032 
1033 PROCEDURE test;
1034 
1035 FUNCTION receive
1036   (  p_pipename      IN  VARCHAR2
1037    , x_message       OUT NOCOPY VARCHAR2
1038    ) RETURN NUMBER;
1039 
1040 -- Procedure
1041 --   dump_tree_to_db_pipe
1042 -- Description
1043 --   Generate a XML document for the specified tree and send the document
1044 --   to a dbms_pipe. We have a Java Application that reads from the pipe
1045 --   to monitor the changes in the quantity tree.
1046 PROCEDURE dump_tree_to_db_pipe
1047   (
1048      x_return_status OUT NOCOPY VARCHAR2
1049    , p_pipename      IN  VARCHAR2
1050    , p_tree_id       IN  INTEGER
1051    );
1052 
1053 -- Procedure
1054 --   dump_tree_to_db_pipe
1055 -- Description
1056 --   Generate a XML document for all valid trees and send the document
1057 --   to a dbms_pipe. We have a Java Application that reads from the pipe
1058 --   to monitor the changes in the quantity tree.
1059 PROCEDURE dump_tree_to_db_pipe
1060   (
1061      x_return_status OUT NOCOPY VARCHAR2
1062    , p_pipename      IN  VARCHAR2
1063    );
1064 
1065 --
1066 -- Bug 2486318. The do check does not work. Trasactions get committed
1067 -- even if there is a node violation. Added p_check_mark_node_only to mark
1068 -- the nodes. A new procedure was added to bve called from inldqc.ppc
1069 -- Procedure
1070 --   update_quantities_for_form
1071 -- Description
1072 --   update a quantity tree
1073 --
1074 --  Version
1075 --   Current version        1.0
1076 --   Initial version        1.0
1077 --
1078 -- Input parameters:
1079 --   p_api_version_number   standard input parameter
1080 --   p_init_msg_lst         standard input parameter
1081 --   p_tree_id              tree_id
1082 --   p_revision             revision
1083 --   p_lot_number           lot_number
1084 --   p_subinventory_code    subinventory_code
1085 --   p_locator_id           locator_id
1086 --   p_primary_quantity     primary_quantity
1087 --   p_quantity_type
1088 --   p_containerized        set to g_containerized_true if
1089 --                           quantity is in container
1090 --   p_call_for_form       chek if procedure called from form
1091 -- Output parameters:
1092 --   x_return_status       standard output parameter
1093 --   x_msg_count           standard output parameter
1094 --   x_msg_data            standard output parameter
1095 --   x_tree_id             used later to refer to the same tree
1096 --   x_qoh                 qoh   after the update
1097 --   x_rqoh                rqoh  after the update
1098 --   x_qr                  qr    after the update
1099 --   x_qs                  qs    after the update
1100 --   x_att                 att   after the update
1101 --   x_atr                 atr   after the update
1105    , x_return_status         OUT NOCOPY VARCHAR2
1102 PROCEDURE update_quantities_for_form
1103   (  p_api_version_number    IN  NUMBER
1104    , p_init_msg_lst          IN  VARCHAR2 DEFAULT fnd_api.g_false
1106    , x_msg_count             OUT NOCOPY NUMBER
1107    , x_msg_data              OUT NOCOPY VARCHAR2
1108    , p_tree_id               IN  INTEGER
1109    , p_revision              IN  VARCHAR2 DEFAULT NULL
1110    , p_lot_number            IN  VARCHAR2 DEFAULT NULL
1111    , p_subinventory_code     IN  VARCHAR2 DEFAULT NULL
1112    , p_locator_id            IN  NUMBER   DEFAULT NULL
1113    , p_primary_quantity      IN  NUMBER
1114    , p_quantity_type         IN  INTEGER
1115    , x_qoh                   OUT NOCOPY NUMBER
1116    , x_rqoh                  OUT NOCOPY NUMBER
1117    , x_qr                    OUT NOCOPY NUMBER
1118    , x_qs                    OUT NOCOPY NUMBER
1119    , x_att                   OUT NOCOPY NUMBER
1120    , x_atr                   OUT NOCOPY NUMBER
1121    , p_transfer_subinventory_code IN  VARCHAR2 DEFAULT NULL
1122    , p_cost_group_id         IN  NUMBER DEFAULT NULL
1123    , p_containerized         IN  NUMBER DEFAULT g_containerized_false
1124    , p_call_for_form        IN  VARCHAR2 DEFAULT fnd_api.g_true
1125    ) ;
1126 
1127 -- invConv changes begin: overload
1128 PROCEDURE update_quantities_for_form
1129   (  p_api_version_number    IN  NUMBER
1130    , p_init_msg_lst          IN  VARCHAR2 DEFAULT fnd_api.g_false
1131    , x_return_status         OUT NOCOPY VARCHAR2
1132    , x_msg_count             OUT NOCOPY NUMBER
1133    , x_msg_data              OUT NOCOPY VARCHAR2
1134    , p_tree_id               IN  INTEGER
1135    , p_revision              IN  VARCHAR2 DEFAULT NULL
1136    , p_lot_number            IN  VARCHAR2 DEFAULT NULL
1137    , p_subinventory_code     IN  VARCHAR2 DEFAULT NULL
1138    , p_locator_id            IN  NUMBER   DEFAULT NULL
1139    , p_primary_quantity      IN  NUMBER
1140    , p_secondary_quantity    IN  NUMBER        -- invConv change
1141    , p_quantity_type         IN  INTEGER
1142    , x_qoh                   OUT NOCOPY NUMBER
1143    , x_rqoh                  OUT NOCOPY NUMBER
1144    , x_qr                    OUT NOCOPY NUMBER
1145    , x_qs                    OUT NOCOPY NUMBER
1146    , x_att                   OUT NOCOPY NUMBER
1147    , x_atr                   OUT NOCOPY NUMBER
1148    , x_sqoh                  OUT NOCOPY NUMBER       -- invConv change
1149    , x_srqoh                 OUT NOCOPY NUMBER       -- invConv change
1150    , x_sqr                   OUT NOCOPY NUMBER       -- invConv change
1151    , x_sqs                   OUT NOCOPY NUMBER       -- invConv change
1152    , x_satt                  OUT NOCOPY NUMBER       -- invConv change
1153    , x_satr                  OUT NOCOPY NUMBER       -- invConv change
1154    , p_transfer_subinventory_code IN  VARCHAR2 DEFAULT NULL
1155    , p_cost_group_id         IN  NUMBER DEFAULT NULL
1156    , p_containerized         IN  NUMBER DEFAULT g_containerized_false
1157    , p_call_for_form        IN  VARCHAR2 DEFAULT fnd_api.g_true
1158    ) ;
1159 -- invConv changes end.
1160 
1161 function do_check_release_locks return boolean;
1162 
1163 END inv_quantity_tree_pvt;