通过EBS接口更新物料描述
Posted fjzsl
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过EBS接口更新物料描述相关的知识,希望对你有一定的参考价值。
一、撰写EBS接口
通过ebs提供的inv_item_grp.update_item接口,存储过程如下:
PROCEDURE auto_save_item_description(p_item_id IN NUMBER ,p_description IN VARCHAR2) IS l_item_rec inv_item_grp.item_rec_type; x_item_rec inv_item_grp.item_rec_type; l_error_tbl inv_item_grp.error_tbl_type; l_error_msg VARCHAR2(4000); x_return_status VARCHAR2(30); CURSOR cur_item IS SELECT msib.organization_id ,msib.inventory_item_id ,msib.segment1 ,msib.description FROM mtl_system_items_b msib WHERE 1 = 1 AND msib.inventory_item_id = p_item_id; BEGIN FOR rec_item IN cur_item LOOP l_item_rec := inv_item_grp.g_miss_item_rec; l_item_rec.organization_id := rec_item.organization_id; l_item_rec.inventory_item_id := rec_item.inventory_item_id; l_item_rec.description := p_description; -- l_item_rec.allow_item_desc_update_flag := ‘Y‘; inv_item_grp.update_item(p_commit => fnd_api.g_false ,p_item_rec => l_item_rec ,x_item_rec => x_item_rec ,x_return_status => x_return_status ,x_error_tbl => l_error_tbl ,p_template_id => NULL); IF x_return_status <> fnd_api.g_ret_sts_success THEN FOR i IN 1 .. l_error_tbl.last LOOP l_error_msg := substrb(l_error_msg || l_error_tbl(i).column_name || ‘:‘ || l_error_tbl(i) .message_text || ‘#‘ ,1 ,200); END LOOP; -- dbms_output.put_line(rec_item.segment1 || ‘ 出错:‘ || l_error_msg); g_message := rec_item.segment1 || ‘ 出错:‘ || l_error_msg; ROLLBACK; -- ELSE ELSE UPDATE mtl_system_items_b msib SET msib.description = l_item_rec.description WHERE msib.inventory_item_id = p_item_id AND organization_id = l_item_rec.organization_id; COMMIT; g_message := rec_item.segment1 || ‘ 更新成功‘; END IF; END LOOP; END auto_save_item_description;
二、个性化菜单
这里的执行过程代码为:
=‘cux_vk_public_pkg.save_item_description(‘||:MTL_SYSTEM_ITEMS.INVENTORY_ITEM_ID||‘,‘||‘‘‘‘||:MTL_SYSTEM_ITEMS.DESCRIPTION_MIR||‘‘‘)‘
这里的消息调用valid_record_msg函数。valid_record_msg函数其实就是取上面存储过程返回的g_message:
FUNCTION valid_record_msg RETURN VARCHAR2 IS BEGIN RETURN nvl(g_message ,‘Not Init Message.‘); END valid_record_msg;
这里的消息文本还有另外一种写法(不推荐,因为不灵活),就是直接在文本撰写对话框弹出:
代码为:
‘物料 ‘ ||${item.MTL_SYSTEM_ITEMS.INVENTORY_ITEM_MIR.VALUE}|| ‘ 更新描述成功‘
以上是关于通过EBS接口更新物料描述的主要内容,如果未能解决你的问题,请参考以下文章