Saturday, April 23, 2011

API For Item On Hand Quantity

DECLARE
L_api_return_status VARCHAR2(1);
vn_qty_oh NUMBER;
vn_qty_res_oh NUMBER;
vn_qty_res NUMBER;
vn_qty_sug NUMBER;
vn_qty_att NUMBER;
vn_qty_atr NUMBER;
vn_msg_count NUMBER;
vv_msg_data VARCHAR2(1000);
BEGIN
apps.inv_quantity_tree_grp.clear_quantity_cache;
apps.INV_Quantity_Tree_PUB.Query_Quantities (
p_api_version_number => 1.0
, p_init_msg_lst => apps.fnd_api.g_false
, x_return_status => L_api_return_status
, x_msg_count => vn_msg_count
, x_msg_data => vv_msg_data
, p_organization_id => &organization_id
, p_inventory_item_id => &inventory_item_id
, p_tree_mode => apps.INV_Quantity_Tree_PUB.g_transaction_mode
, p_onhand_source => 3
, p_is_revision_control=> false
, p_is_lot_control => FALSE
, p_is_serial_control => FALSE
, p_revision => NULL
, p_lot_number => NULL
, p_subinventory_code => '&Subinventory_code'
, p_locator_id => NULL
, x_qoh => vn_qty_oh
, x_rqoh => vn_qty_res_oh
, x_qr => vn_qty_res
, x_qs => vn_qty_sug
, x_att => vn_qty_att
, x_atr => vn_qty_atr );

dbms_output.put_line('Quantity on hand :'||to_char(vn_qty_oh));
end;

Advance Shipment Notices (ASNs)

An Advance Shipment Notice (ASN) is transmitted via Electronic Data Interchange (EDI) from a supplier to let the receiving organization know that a shipment is coming. The ASN contains details including shipment date, time, and identification number; packing slip data; freight information; item detail including cumulative received quantities; purchase order number; and returnable container information.

ASN Process

The ASN process, shown in the next figure, includes the following:
    • A shipment authorization is made to the supplier in the form of a Purchase Order, Planning Schedule, or Shipping Schedule.
    • The supplier sends the ASN to the receiving organization at the time of shipment.
    • The ASN is verified in the Receiving Open Interface. Intransit and purchasing supplies are updated for ASN lines that are successfully validated. For each accepted line on the ASN, intransit supply is increased and purchasing supply is reduced. If the data isn't accepted or if there is an error or discrepancy in the data, an Application Advice, containing the most likely cause of the error, is sent to the supplier. The supplier can then send a corrected (New) ASN.
    • The goods arrive. You can use the ASN in the Receipts window to create receipts.
    • Shipment-vs.-receipt quantities are compared during the receipt transaction process. (As an optional step, CUM quantities can be compared if Oracle Supplier Scheduling is installed.) If discrepancies are detected in shipment-vs.-receipt or CUM quantity comparisons, an Application Advice is sent to the supplier.

ASN Receiving Options

There are two receiving options related to ASNs:
    • ASN Control option in the Receiving Options window - With this option, you can choose whether or not you receive an error message--or are prevented by Purchasing--when you attempt to receive against a purchase order shipment for which an ASN already exists.
    • RCV: Fail All ASN Lines if One Line Fails - With this profile option, you can choose to reject an entire ASN if any ASN line fails validation or processing, or to accept an ASN if at least one ASN line is successful.

Types of ASNs

There are three types of ASNs:
    • A New ASN is the initial ASN.
    • A Cancellation ASN, once validated, cancels the original (New) ASN if the original (New) ASN has not yet had a receipt created against it. The shipment number on the Cancellation ASN is matched to the shipment number on the validated, original (New) ASN.
    • A Test ASN is sent by the supplier usually to make sure the ASN transmission works between you and your supplier. A Test ASN is verified as if it were a New ASN and generates an outbound Application Advice if necessary. A Test ASN is not available for creating a receipt against it and is not visible as inbound supply. 

ASNs and Supply

For each accepted line on the accepted ASN, intransit supply quantity is automatically increased and purchasing supply quantity is automatically reduced by the shipment quantity specified in the ASN.

The table below shows, for each action you perform with an ASN, the movement of the quantity on the ASN between the various categories of supply.


ASNs and Supply
Accept ASN Purchasing Supply Intransit Supply Inventory
Accept the New ASN Reduced for accepted lines only Increased for accepted lines only  
Accept the Cancellation ASN Increased for all accepted lines on New ASN Reduced for all accepted lines on New ASN  
Receive Items Purchasing Supply Intransit Supply Inventory
Receive item when the item is indicated on an ASN line   Reduced Increased
Receive item when the item is not indicated on an ASN line Reduced   Increased
Change Receipt Quantities Purchasing Supply Intransit Supply Inventory
Increase receipt quantity before the ASN is closed   Reduced Increased
Increase receipt quantity after the ASN is closed Reduced   Increased
Decrease receipt quantity before the ASN is closed   Increased Reduced
Decrease receipt quantity after the ASN is closed Increased   Reduced
Return Items Purchasing Supply Intransit Supply Inventory
Return item(s) to the supplier before the ASN is closed   Increased Reduced
Return item(s) to the supplier after the ASN is closed Increased   Reduced
Close Corresponding Purchase Order Purchasing Supply Intransit Supply Inventory
Close the Purchase Order while an ASN for that purchase order is open Reduced Reduced