Monday, April 17, 2017

API to Create Item Categories

declare
l_category_rec    inv_item_category_pub .category_rec_type;
l_return_status   varchar2(80);
l_error_code      number;
l_msg_count       number;
l_msg_data        varchar2(80);
l_out_category_id number;
begin
  l_category_rec.segment1 := 'London';

  select f.id_flex_num
    into l_category_rec.structure_id
    from fnd_id_flex_structures f
   where f.id_flex_structure_code = 'CITY';

  l_category_rec.description := 'London is located in Uk';

  inv_item_category_pub.create_category
          (
          p_api_version   => 1.0,
          p_init_msg_list => fnd_api.g_false,
          p_commit        => fnd_api.g_true,
          x_return_status => l_return_status,
          x_errorcode     => l_error_code,
          x_msg_count     => l_msg_count,
          x_msg_data      => l_msg_data,
          p_category_rec  => l_category_rec,
          x_category_id   => l_out_category_id
          );
  if l_return_status = fnd_api.g_ret_sts_success then
    commit;
    dbms_output.put_line ('Creation of Item Category is Successful : '||l_out_category_id);
  else
    dbms_output.put_line ('Creation of Item Category Failed with the error :'||l_error_code);
    rollback;
  end if;
end ;

No comments:

Post a Comment