Monday, May 31, 2010

Item Categories Updation through API in Oracle Apps (INV_ITEM_CATEGORY_PUB.UPDATE_CATEGORY)

Below script will help you update a category through API INV_ITEM_CATEGORY_PUB.UPDATE_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_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.category_id  := 13124;
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 update category --

INV_ITEM_CATEGORY_PUB.UPDATE_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
);

 IF v_return_status = fnd_api.g_ret_sts_success THEN
    COMMIT;
    DBMS_OUTPUT.put_line ('Updation of Item Category is Successful : '||v_category_rec.category_id);
 ELSE
    DBMS_OUTPUT.put_line ('Updation of Item Category Failed with the error:'||v_msg_data);
    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;

1 Responses to “Item Categories Updation through API in Oracle Apps (INV_ITEM_CATEGORY_PUB.UPDATE_CATEGORY)”

Anonymous said...
August 5, 2015 at 10:19 AM

I am trying to update a value of a segment, api always throw the unexpected error i.e status 'U'. any help ?


Post a Comment

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.