API to create Oracle Items Category Missing Combinations

/* Formatted on 12/7/2016 1:32:27 PM (QP5 v5.115.810.9015) */
declare
l_category_rec INV_ITEM_CATEGORY_PUB.CATEGORY_REC_TYPE;
l_return_status   VARCHAR2(80);
l_error_code      VARCHAR2(100);
l_msg_count       NUMBER;
l_msg_data        VARCHAR2(80);
l_out_category_id NUMBER;
CURSOR c_cat
IS
select  * from stm_cust.MISSING_CAT_SEG ;

begin
FOR lc_cat IN c_cat
LOOP
l_category_rec := NULL;
l_category_rec.structure_id := 51114;
--l_category_rec.structure_code := g_cat_flex_code;
l_category_rec.summary_flag := 'N';
l_category_rec.enabled_flag := 'Y';
l_category_rec.segment1 := lc_cat.segment1;
l_category_rec.segment2 := lc_cat.segment2;
l_category_rec.description := lc_Cat.des;
--l_category_rec.segment3 := lc_cat.segment3;
--l_category_rec.segment4 := lc_cat.segment4;
--
-- After the category record is loaded, then call the create_category api to
-- create the new mtl_categories record.
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 = 'S'
THEN
DBMS_OUTPUT.PUT_LINE('*****************');
DBMS_OUTPUT.PUT_LINE('Category successfully created. New Category Id = '||L_OUT_CATEGORY_ID);
DBMS_OUTPUT.PUT_LINE('Segment Combination = '||lc_cat.segment1||'.'||lc_cat.segment2);
DBMS_OUTPUT.PUT_LINE('*****************');
ELSE
l_error_code := Nvl(l_error_code,'') || 'CATCONV005,';
--l_error_desc := Nvl(l_error_desc,'') || '#API Error while creating Category';
--l_conv_status := 'ERROR';
DBMS_OUTPUT.PUT_LINE('*****************');
DBMS_OUTPUT.PUT_LINE('Segment Combination = '||lc_cat.segment1||'.'||lc_cat.segment2);
IF L_msg_count > 0
THEN
FOR i IN 1 .. L_msg_count
LOOP
DBMS_OUTPUT.PUT_LINE(i || '.' || SUBSTR(fnd_msg_pub.get(p_encoded => fnd_api.g_false), 1, 255))
      ;
END LOOP;
END IF;
END IF;
END LOOP;
END;

Comments

Popular posts from this blog

API Procedure to inactive Items in oracle apps

API To update Oracle Items

Graph Setting in Oracle Report Builder