Monday, May 31, 2010

Item categories creation through API in Oracle Apps (INV_ITEM_CATEGORY_PUB.CREATE_CATEGORY)

Below script will help you create a category through API INV_ITEM_CATEGORY_PUB.CREATE_CATEGORY

This script was tested in R12.1.1 

SET SERVEROUTPUT ON;
DECLARE
  v_return_status  VARCHAR2(1)   := NULL;
  v_msg_count      NUMBER        := 0;
  v_msg_data       VARCHAR2(2000);
  v_errorcode      VARCHAR2(1000);
  v_category_rec   INV_ITEM_CATEGORY_PUB.CATEGORY_REC_TYPE;
  v_category_id    NUMBER;
 
  v_context         VARCHAR2 (2);

  FUNCTION set_context( i_user_name    IN  VARCHAR2
                     ,i_resp_name    IN  VARCHAR2
                     ,i_org_id       IN  NUMBER)
  RETURN VARCHAR2
  IS
  BEGIN
  NULL;
  -- Inorder to reduce the content of the post I moved the implementation part of this function to another post and it is available here 
  END set_context;
 
BEGIN

-- Setting the context ----

v_context := set_context ('&user', '&responsibility', 2038);
IF v_context = 'F'
   THEN
   DBMS_OUTPUT.put_line ('Error while setting the context');
END IF;

--- context done ------------

v_category_rec              := NULL;
v_category_rec.structure_id := 50415;
v_category_rec.summary_flag := 'N';
v_category_rec.enabled_flag := 'Y';
v_category_rec.segment1     := 'ENGINEERING';
v_category_rec.segment2     := 'BAG';
v_category_rec.segment3     :=  'DEFAULT';

-- Calling the api to create category --

INV_ITEM_CATEGORY_PUB.CREATE_CATEGORY
  (
  p_api_version   => 1.0,
  p_init_msg_list => fnd_api.g_true,
  p_commit        => fnd_api.g_false,
  x_return_status => v_return_status,
  x_errorcode     => v_errorcode,
  x_msg_count     => v_msg_count,
  x_msg_data      => v_msg_data,
  p_category_rec  => v_category_rec,
  x_category_id   => v_category_id --returns category id
);

 IF v_return_status = fnd_api.g_ret_sts_success THEN
    COMMIT;
    DBMS_OUTPUT.put_line ('Creation of Item Category is Successful : '||v_CATEGORY_ID);
 ELSE
    DBMS_OUTPUT.put_line ('Creation of Item Category Failed with the error :'||v_ERRORCODE);
    ROLLBACK;
    FOR i IN 1 .. v_msg_count
     LOOP
        v_msg_data := oe_msg_pub.get( p_msg_index => i, p_encoded => 'F');
        dbms_output.put_line( i|| ') '|| v_msg_data);
     END LOOP;
 END IF;
END;
 

Monday, May 31, 2010 by Team search · 1

Wednesday, May 26, 2010

GET ONHAND QUANTITIES THROUGH API in Oracle Apps R12 (INV_QUANTITY_TREE_PUB.QUERY_QUANTITIES)

Below script will be useful in getting On hand quantity via API INV_QUANTITY_TREE_PUB.QUERY_QUANTITIES. This script was tested in R12.1.1 instance.


SET SERVEROUTPUT ON;
DECLARE

v_api_return_status  VARCHAR2 (1);
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_msg_count          NUMBER;
v_msg_data           VARCHAR2(1000);
v_inventory_item_id  VARCHAR2(250) := '1234';
v_organization_id    VARCHAR2(10)  := '567';

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,
 p_subinventory_code   => NULL,
 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 ('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);

END;

Wednesday, May 26, 2010 by Team search · 3

Disclaimer

The ideas, thoughts and concepts expressed here are my own. They, in no way reflect those of my employer or any other organization/client that I am associated. The articles presented doesn't imply to any particular organization or client and are meant only for knowledge Sharing purpose. The articles can't be reproduced or copied without the Owner's knowledge or permission.