Pages

OracleEBSpro is purely for knowledge sharing and learning purpose, with the main focus on Oracle E-Business Suite Product and other related Oracle Technologies.

I'm NOT responsible for any damages in whatever form caused by the usage of the content of this blog.

I share my Oracle knowledge through this blog. All my posts in this blog are based on my experience, reading oracle websites, books, forums and other blogs. I invite people to read and suggest ways to improve this blog.


Tuesday, July 16, 2013

API for Updating Category Assignment of an item (NV_ITEM_CATEGORY_PUB.UPDATE_CATEGORY_ASSIGNMENT)

This script was tested in R12.1.3

DECLARE

  v_return_status      VARCHAR2(1) := NULL;
  v_msg_count          NUMBER      := 0;
  v_msg_data           VARCHAR2(2000);
  v_errorcode          VARCHAR2(1000);
  v_category_id        NUMBER; 
  v_old_category_id    NUMBER;
  v_category_set_id    NUMBER; 
  v_inventory_item_id  NUMBER; 
  v_organization_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;
  -- In order 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
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_old_category_id    := 9233;
v_category_id        := 13125; 
v_category_set_id    := 1;
v_inventory_item_id  := 66003;
v_organization_id    := 103;

INV_ITEM_CATEGORY_PUB.UPDATE_CATEGORY_ASSIGNMENT
        (  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_old_category_id    => v_old_category_id,
           p_category_id        => v_category_id, 
           p_category_set_id    => v_category_set_id, 
           p_inventory_item_id  => v_inventory_item_id, 
           p_organization_id    => v_organization_id);

IF v_return_status = fnd_api.g_ret_sts_success THEN
    COMMIT;
    DBMS_OUTPUT.put_line ('Updation of category assigment is Sucessfull : '||v_category_id);
ELSE
    DBMS_OUTPUT.put_line ('Updation of category assigment failed:'||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;

No comments:

Post a Comment