Get On Hand Quantities Through API

6
API To Calculate Onhand, Reservable and Transactable Quantity Before going to the API, let us see the Functional Side in Oracle for the Onhand Availability. Log on to Inventory, Vision Operations (USA) ResponsibilitySelect On-hand Quantity Under On-hand, Availability As soon as you log in the following screen pops up to select the organization in which you would like to see the Onhand Information. As soon as you select the Organization from the list. The material workbench screen opens up as follows:

description

API to calculate the On hand,Reservable and Transactable Quantity in Oracle APPS.

Transcript of Get On Hand Quantities Through API

Page 1: Get On Hand Quantities Through API

API To Calculate Onhand, Reservable and Transactable Quantity

Before going to the API, let us see the Functional Side in Oracle for the Onhand Availability.

Log on to Inventory, Vision Operations (USA) Responsibility…

Select On-hand Quantity Under On-hand, Availability

As soon as you log in the following screen pops up to select the organization in which you would like to see the Onhand Information.

As soon as you select the Organization from the list. The material workbench screen opens up as follows:

Page 2: Get On Hand Quantities Through API

You can see from above figure,the Organization is selected is ‘M1’,a point to note is that we are calculating the on-hand for item in the sub inventory level here.

Enter the item number and the subinventory in which you want to check its quantity and press the Find button .You will see the below screen:

Press the Availability button to view the quantity information as shown below:

Page 3: Get On Hand Quantities Through API

The thing to be observed here is the onhand, reserve and Transact quantities are for item ‘CM11911’ in subinventory ‘RIP’ and in organization ‘M1’….This is how subinventory level calculation is done whereas for organization level you do not need to give the subinventory.

Now, let’s get back to the technical part how these figures are getting populated on the forms in front end.

Package Body:

CREATE OR REPLACE PACKAGE BODY ONHAND_QTY_CALC ASPROCEDURE QTY_CALC_RSV( v_api_return_status OUT NOCOPY VARCHAR2 , v_msg_count OUT NOCOPY NUMBER , v_msg_data OUT NOCOPY VARCHAR2 , v_organization_id IN NUMBER , v_inventory_item_id IN NUMBER , v_qty_oh OUT NOCOPY NUMBER , v_qty_res_oh OUT NOCOPY NUMBER , v_qty_res OUT NOCOPY NUMBER , v_qty_sug OUT NOCOPY NUMBER , v_qty_att OUT NOCOPY NUMBER ,v_qty_atr OUT NOCOPY NUMBER ,v_subinv IN VARCHAR2 )IS

BEGIN

inv_quantity_tree_grp.clear_quantity_cache;

DBMS_OUTPUT.put_line ('Transaction Mode');DBMS_OUTPUT.put_line ('Onhand For the Item :'|| v_inventory_item_id );DBMS_OUTPUT.put_line ('Organization :'|| v_organization_id);

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 => v_api_return_status, x_msg_count => v_msg_count, x_msg_data => v_msg_data, p_organization_id => v_organization_id, p_inventory_item_id => v_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,

Page 4: Get On Hand Quantities Through API

p_subinventory_code => v_subinv, p_locator_id => NULL, x_qoh => v_qty_oh, x_rqoh => v_qty_res_oh, x_qr => v_qty_res, x_qs => v_qty_sug, x_att => v_qty_att, x_atr => v_qty_atr);

DBMS_OUTPUT.put_line ('User_id :'|| gn_user_id);DBMS_OUTPUT.put_line ('Responsibility Id :'|| gn_resp_id);DBMS_OUTPUT.put_line ('Responsibility application id :'|| gn_resp_appl_id);DBMS_OUTPUT.put_line ('on hand Quantity :'|| v_qty_oh);DBMS_OUTPUT.put_line ('Reservable quantity on hand :'|| v_qty_res_oh);DBMS_OUTPUT.put_line ('Quantity reserved :'|| v_qty_res);DBMS_OUTPUT.put_line ('Quantity suggested :'|| v_qty_sug);DBMS_OUTPUT.put_line ('Quantity Available To Transact :'|| v_qty_att);DBMS_OUTPUT.put_line ('Quantity Available To Reserve :'|| v_qty_atr);DBMS_OUTPUT.put_line ('Subinventory :'|| v_subinv);

END QTY_CALC_RSV;

END ONHAND_QTY_CALC;

Package Spec:

CREATE OR REPLACE PACKAGE ONHAND_QTY_CALCAS

PROCEDURE QTY_CALC_RSV( v_api_return_status OUT NOCOPY VARCHAR2 , v_msg_count OUT NOCOPY NUMBER , v_msg_data OUT NOCOPY VARCHAR2 , v_organization_id IN NUMBER , v_inventory_item_id IN NUMBER , v_qty_oh OUT NOCOPY NUMBER , v_qty_res_oh OUT NOCOPY NUMBER , v_qty_res OUT NOCOPY NUMBER , v_qty_sug OUT NOCOPY NUMBER , v_qty_att OUT NOCOPY NUMBER ,v_qty_atr OUT NOCOPY NUMBER ,v_subinv IN VARCHAR2 );END ONHAND_QTY_CALC;

Page 5: Get On Hand Quantities Through API

Compile the Package Spec and Body and then Run the following Script:

DECLAREv_api_return_status VARCHAR2(20);v_msg_count NUMBER(20);v_msg_data VARCHAR2(200);v_organization_id NUMBER:=207;v_inventory_item_id NUMBER:=4442;v_qty_oh NUMBER;v_qty_res_oh NUMBER;v_qty_res NUMBER;v_qty_sug NUMBER;v_qty_att NUMBER;v_qty_atr NUMBER;v_subinv VARCHAR2(20):='RIP';BEGINONHAND_QTY_CALC.QTY_CALC_RSV(v_api_return_status,v_msg_count,v_msg_data,v_organization_id,v_inventory_item_id, v_qty_oh,v_qty_res_oh,v_qty_res,v_qty_sug,v_qty_att,v_qty_atr,v_subinv);END;

You would View this in the DBMS Output Window:

So, this is how you would calculate the quantities on the subinventory Level.