Tuesday, March 18, 2014

Get Item On Hand Quantities of the item through API in Oracle Inventory

This script can be used to get the below quantities.
1. On-hand Quantity
2. Available to Reserve
3. Quantity Reserved
4. Quantity Suggested
5. Available to Transact
6. Available to Reserve

You can also get the On-hand quantities from the table mtl_onhand_quantities

GET ON-HAND QUANTITIES API

DECLARE
   x_return_status         VARCHAR2 (50);
   x_msg_count             VARCHAR2 (50);
   x_msg_data              VARCHAR2 (50);
   v_item_id               NUMBER;
   v_org_id                NUMBER;
   v_qoh                   NUMBER;
   v_rqoh                  NUMBER;
   v_atr                   NUMBER;
   v_att                   NUMBER;
   v_qr                    NUMBER;
   v_qs                    NUMBER;

   v_lot_control_code      BOOLEAN;

   v_serial_control_code   BOOLEAN;

BEGIN

   -- Set the variable values

   v_item_id := '6566';

   v_org_id := 61;

   v_qoh := NULL;

   v_rqoh := NULL;

   v_atr := NULL;

   v_lot_control_code := FALSE;

   v_serial_control_code := FALSE;

   -- Set the org context

   fnd_client_info.set_org_context (1);

   -- Call API

   inv_quantity_tree_pub.query_quantities

   (p_api_version_number       => 1.0,

    p_init_msg_lst             => 'F',

    x_return_status            => x_return_status,

    x_msg_count                => x_msg_count,

    x_msg_data                 => x_msg_data,

    p_organization_id          => v_org_id,

    p_inventory_item_id        => v_item_id,

    p_tree_mode                => apps.inv_quantity_tree_pub.g_transaction_mode,

    -- or 3

    p_is_revision_control      => FALSE,

    p_is_lot_control           => v_lot_control_code,

    -- is_lot_control,

    p_is_serial_control        => v_serial_control_code,

    p_revision                 => NULL,        -- p_revision,

    p_lot_number               => NULL,           -- p_lot_number,

    p_lot_expiration_date      => SYSDATE,

    p_subinventory_code        => NULL,    -- p_subinventory_code,

    p_locator_id               => NULL,           -- p_locator_id,

    -- p_cost_group_id            => NULL,       -- cg_id,

    p_onhand_source            => 3,

    x_qoh                      => v_qoh,      -- Quantity on-hand

    x_rqoh                     => v_rqoh,           --reservable quantity on-hand

    x_qr                       => v_qr,

    x_qs                       => v_qs,

    x_att                      => v_att,  -- available to transact

    x_atr                      => v_atr    -- available to reserve

   );

   DBMS_OUTPUT.put_line ('On-Hand Quantity: ' || v_qoh);

   DBMS_OUTPUT.put_line ('Available to reserve: ' || v_atr);

   DBMS_OUTPUT.put_line ('Quantity Reserved: ' || v_qr);

   DBMS_OUTPUT.put_line ('Quantity Suggested: ' || v_qs);

   DBMS_OUTPUT.put_line ('Available to Transact: ' || v_att);

   DBMS_OUTPUT.put_line ('Available to Reserve: ' || v_atr);

EXCEPTION

   WHEN OTHERS

   THEN

      DBMS_OUTPUT.put_line ('ERROR: ' || SQLERRM);

END;




GET ON-HAND QUANTITIES FROM TABLE

SELECT * FROM MTL_ONHAND_QUANTITIES;

Monday, March 17, 2014

Service line in stuck with status "Awaiting Invoice Interface - Incomplete Data" in OM Oracle APPS R12

Environment
  • Module = Oracle Service Contracts
  • Release = R12i Oracle E-Business Suite
Steps to reproduce
  1. Create SO and two SO lines. The second SO line is a Service Line.
  2. You have given Service duration and Service Period, but the system didn't automatically populated Service Start Date and Service End Date fields.
  3. Run Pick Release and Ship Confirm. Then Workflow background process.
  4. First SO line (which contains the main item) got closed, and got an invoice generated. But the second SO line (service line) stuck in status "Awaiting Invoice Interface - Incomplete Data".
Root Cause of the issue
  1. The system didn't automatically populated 'Service Start Date' and 'Service End Date' fields associated with SO's Service Line.
Resolution
  1. Simply go back and query the SO. Go to the service line and manually give the 'Service Start Date'. The 'Service End Date' will be populated automatically.
  2. Now go to 'Actions' > 'Progress Order' > Choose 'Invoice Interface - Eligible'.
  3. Now the 'Autoinvoice Master Program' and 'Autoinvoice Import Program' will be launched automatically, and invoice will be generated.
  4. Check the invoice associated with the Service line.