OM销售订单属性默认规则
需求:
销售订单行发运子库默认值,根据物料带出
方案一:Form个性化,根据物料信息带出子库
方案二:使用OM模块标准功能Attribute Defaulting Rules
路径%OM_SUPER_USER->Setup->Rules->Defaulting
需要对销售订单行的子库设置默认值
一:定义实体属性:销售订单行的子库
Application |
Order Management |
Entity |
Order Line |
Attibute |
Subinventory |
二:定义默认条件和默认来源规则
Defaulting Condition |
Always |
Source Type |
PL/SQL API |
Default Source/Value |
Package.fucntion.attribute1.attribute2 |
FUNCTION get_default_subinv(p_database_object_name IN VARCHAR2,
p_attribute_code IN VARCHAR2)
RETURN VARCHAR2 IS
l_subinventory VARCHAR2(30);
l_ship_to_org_id NUMBER;
l_consigned_flag VARCHAR2(1);
l_ship_from_org_id NUMBER;
l_inventory_item_id NUMBER;
l_header_id NUMBER;
l_order_type_id NUMBER;
l_department_id NUMBER;
l_item_default_shipping_subinv mtl_system_items_er1_v.default_shipping_subinventory%TYPE;
l_log_msg VARCHAR2(2000);
BEGIN
IF p_database_object_name = 'OE_AK_ORDER_LINES_V' THEN
l_ship_to_org_id := ont_line_def_hdlr.g_record.ship_to_org_id;
l_header_id := ont_line_def_hdlr.g_record.header_id;
l_ship_from_org_id := ont_line_def_hdlr.g_record.ship_from_org_id;
l_inventory_item_id := ont_line_def_hdlr.g_record.inventory_item_id;
l_order_type_id := ont_header_def_hdlr.g_record.order_type_id;
ELSE
l_ship_to_org_id := -1;
END IF;
IF l_ship_from_org_id IS NOT NULL AND l_inventory_item_id IS NOT NULL THEN
l_item_default_shipping_subinv := get_default_subinv_by_item(l_ship_from_org_id, l_inventory_item_id);
END IF;
/*--Debug
l_log_msg := 'Order Line Default Shipping Subinventory' ||
g_change_line || 'l_ship_from_org_id: ' ||
l_ship_from_org_id || g_change_line ||
'l_inventory_item_id: ' || l_inventory_item_id || g_change_line ||
'l_item_default_shipping_subinv:' || l_item_default_shipping_subinv;
xxbg_utl.log_msg(p_module => 'LOG',
p_log_level => 1,
p_msg => l_log_msg);*/
RETURN l_subinventory;
END get_default_subinv;