批量给一个OU分配物料
DECLAREx_return_status VARCHAR2(1);x_msg_countNUMBER;CURSOR cur_item ISSELECT msi.segment1,msi.primary_uom_code,msi.inventory_item_id,msi.organi...
·
DECLARE
x_return_status VARCHAR2(1);
x_msg_count NUMBER;
CURSOR cur_item IS
SELECT msi.segment1,
msi.primary_uom_code,
msi.inventory_item_id,
msi.organization_id
FROM mtl_system_items_b msi,work2 w
WHERE 1 = 1
and msi.organization_id = 87 --物料组id
and msi.segment1 = w.source1
AND NOT EXISTS
(SELECT NULL
FROM mtl_system_items_b i2
WHERE i2.organization_id = 131 --OU id
AND msi.inventory_item_id = i2.inventory_item_id);
BEGIN
fnd_global.APPS_INITIALIZE(user_id => 0, --SHIYIWEN_bp
resp_id => 50937, --PCSCN
resp_appl_id => 401);
mo_global.init('M');
FOR rec_item IN cur_item LOOP
ego_item_pub.assign_item_to_org(p_api_version => 1.0,
p_init_msg_list => fnd_api.g_false,
p_commit => fnd_api.g_false,
p_inventory_item_id => rec_item.inventory_item_id,
p_item_number => rec_item.segment1,
p_organization_id => 131, --OU id
p_organization_code => 'D01', --OU code
p_primary_uom_code => rec_item.primary_uom_code,
x_return_status => x_return_status,
x_msg_count => x_msg_count);
dbms_output.put_line(x_return_status);
END LOOP;
END;
更多推荐
已为社区贡献1条内容
所有评论(0)