Oracle EBS OPM 创建生产批
--创建生产批
--created by jenrry
DECLARE
x_message_count NUMBER;
x_message_list VARCHAR2 (2000);
x_return_status VARCHAR2 (1);
p_batch_header gme_batch_header%ROWTYPE;
x_batch_header gme_batch_header%ROWTYPE;
x_exception_material_tbl gme_common_pvt.exceptions_tab;
l_user_name VARCHAR2 (80):= 'SYSADMIN';
l_user_id NUMBER; CURSOR get_user_id (v_user_name IN VARCHAR2)
IS
SELECT user_id
FROM fnd_user
WHERE user_name = v_user_name; PROCEDURE display_messages (p_msg_count IN NUMBER)
IS
MESSAGE VARCHAR2 (2000);
dummy NUMBER;
l_api_name CONSTANT VARCHAR2 (30) := 'DISPLAY_MESSAGES';
BEGIN
FOR i IN 1 .. p_msg_count
LOOP
fnd_msg_pub.get (p_msg_index => i,
p_data => MESSAGE,
p_encoded => 'F',
p_msg_index_out => dummy
);
DBMS_OUTPUT.put_line ('Message ' || TO_CHAR (i) || ' ' || MESSAGE);
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
fnd_msg_pub.add_exc_msg ('insert_step', l_api_name);
END display_messages;
BEGIN
DBMS_OUTPUT.ENABLE (20000);
l_user_name := 'SYSADMIN'; OPEN get_user_id (l_user_name); FETCH get_user_id
INTO l_user_id; IF get_user_id%NOTFOUND
THEN
DBMS_OUTPUT.put_line ('Invalid User ' || l_user_name); CLOSE get_user_id; RAISE NO_DATA_FOUND;
END IF; CLOSE get_user_id;
fnd_profile.initialize (l_user_id);
fnd_global.apps_initialize (user_id => l_user_id,
resp_id => 51010,
resp_appl_id => 553
);
fnd_profile.put ('AFLOG_LEVEL', '1');
p_batch_header.batch_no := '20170731';-- batch_type .. 10=fpo, 0=batch
p_batch_header.batch_type := 0;
-- p_batch_header.recipe_validity_rule_id := 1336;
p_batch_header.plan_start_date := SYSDATE;
-- p_batch_header.due_date := TO_DATE('');
-- p_batch_header.plan_cmplt_date := TO_DATE('');
p_batch_header.update_inventory_ind := 'Y';
gme_api_pub.create_batch
(p_api_version => 2.0,
p_validation_level => 100,
p_init_msg_list => fnd_api.g_true,
p_commit => fnd_api.g_true,
x_message_count => x_message_count,
x_message_list => x_message_list,
x_return_status => x_return_status,
p_org_code => 'B01',
p_batch_header_rec => p_batch_header,
x_batch_header_rec => x_batch_header,
p_batch_size => NULL,
p_batch_size_uom => NULL,
p_creation_mode => 'RECIPE',
p_recipe_id => NULL,
p_recipe_no => '60215000002',
p_recipe_version => 1,
p_product_no => NULL,
p_item_revision => NULL,
p_product_id => NULL,
p_ignore_qty_below_cap => fnd_api.g_true,
p_use_workday_cal => NULL,
p_contiguity_override => NULL,
p_use_least_cost_validity_rule => fnd_api.g_false,
x_exception_material_tbl => x_exception_material_tbl
);
DBMS_OUTPUT.put_line ('x_message_count = ' || TO_CHAR (x_message_count));
DBMS_OUTPUT.put_line (SUBSTR ('x_message_list = ' || x_message_list, 1,
255)
);
DBMS_OUTPUT.put_line ('x_return_status = ' || x_return_status);
DBMS_OUTPUT.put_line ('x_batch_header.batch_id = '|| x_batch_header.batch_id);
DBMS_OUTPUT.put_line ('x_batch_header.plant_code = '|| x_batch_header.plant_code);
DBMS_OUTPUT.put_line ('x_batch_header.batch_no = '|| x_batch_header.batch_no);
DBMS_OUTPUT.put_line ('x_batch_header.batch_type = '|| x_batch_header.batch_type);
DBMS_OUTPUT.put_line ('x_batch_header.recipe_validity_rule_id = ' || x_batch_header.recipe_validity_rule_id);
DBMS_OUTPUT.put_line ('x_batch_header.formula_id = '|| x_batch_header.formula_id);
DBMS_OUTPUT.put_line ('x_batch_header.routing_id = '|| x_batch_header.routing_id);
DBMS_OUTPUT.put_line ('x_batch_header.plan_start_date = '
|| TO_CHAR (x_batch_header.plan_start_date,'DD-MON-YYYY HH24:MI:SS'
)
);
DBMS_OUTPUT.put_line ( 'x_batch_header.due_date = '
|| TO_CHAR (x_batch_header.due_date,
'DD-MON-YYYY HH24:MI:SS'
)
);
DBMS_OUTPUT.put_line ( 'x_batch_header.plan_cmplt_date = '
|| TO_CHAR (x_batch_header.plan_cmplt_date,
'DD-MON-YYYY HH24:MI:SS'
)
);
DBMS_OUTPUT.put_line ('x_batch_header.batch_status = '|| x_batch_header.batch_status);
DBMS_OUTPUT.put_line ('x_batch_header.wip_whse_code = '|| x_batch_header.wip_whse_code);
DBMS_OUTPUT.put_line ('x_batch_header.poc_ind = '|| x_batch_header.poc_ind);
DBMS_OUTPUT.put_line ('x_batch_header.update_inventory_ind = '|| x_batch_header.update_inventory_ind);
DBMS_OUTPUT.put_line ( 'x_batch_header.last_update_date = '
|| TO_CHAR (x_batch_header.last_update_date,
'DD-MON-YYYY HH24:MI:SS'
)
);
DBMS_OUTPUT.put_line ( 'x_batch_header.last_updated_by = '||x_batch_header.last_updated_by);
DBMS_OUTPUT.put_line ( 'x_batch_header.creation_date = '
|| TO_CHAR (x_batch_header.creation_date,
'DD-MON-YYYY HH24:MI:SS'
)
);
DBMS_OUTPUT.put_line ('x_batch_header.created_by = '||x_batch_header.created_by);
DBMS_OUTPUT.put_line ('x_batch_header.last_update_login = '|| x_batch_header.last_update_login);
DBMS_OUTPUT.put_line ('x_batch_header.delete_mark = '||x_batch_header.delete_mark);
DBMS_OUTPUT.put_line ('x_batch_header.text_code = '||x_batch_header.text_code);
DBMS_OUTPUT.put_line ('x_batch_header.automatic_step_calculation = '||x_batch_header.automatic_step_calculation); IF x_exception_material_tbl.COUNT > 0
THEN
FOR i IN
x_exception_material_tbl.FIRST .. x_exception_material_tbl.LAST
LOOP
IF x_exception_material_tbl.EXISTS (i)
THEN
DBMS_OUTPUT.put_line
( 'x_exception_material_tbl('
|| TO_CHAR (i)
|| ').organization_id = '
|| TO_CHAR
(x_exception_material_tbl (i).organization_id
)
);
DBMS_OUTPUT.put_line ( 'x_exception_material_tbl('
|| TO_CHAR (i)
|| ').att = '
|| x_exception_material_tbl (i).att
);
DBMS_OUTPUT.put_line ( 'x_exception_material_tbl('
|| TO_CHAR (i)
|| ').atr = '
|| x_exception_material_tbl (i).atr
);
DBMS_OUTPUT.put_line
( 'x_exception_material_tbl('
|| TO_CHAR (i)
|| ').material_detail_id = '
|| x_exception_material_tbl (i).material_detail_id
);
DBMS_OUTPUT.put_line ( 'x_exception_material_tbl('
|| TO_CHAR (i)
|| ').batch_id = '
|| x_exception_material_tbl (i).batch_id
);
END IF;
END LOOP;
END IF; IF x_message_count > 1
THEN
display_messages (x_message_count);
END IF;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error ' || TO_CHAR (SQLCODE) || ': ' || SQLERRM);
RAISE;
END;
/
Oracle EBS OPM 创建生产批的更多相关文章
- Oracle EBS OPM 发放生产批
--发放生产批 --created by jenrry DECLARE x_return_status VARCHAR2 (1); l_exception_material_tbl gme_commo ...
- Oracle EBS OPM 取消生产批
--取消生产批 --created by jenrry SET serveroutput on; DECLARE p_batch_header_rec gme_batch_header%ROWTYPE ...
- Oracle EBS OPM 生产批创建事务处理
--生产批创建事物处理 --created by jenrry DECLARE p_mmti_rec mtl_transactions_interface%ROWTYPE; p_mmli_tbl gm ...
- Oracle EBS OPM update material txn
--update_material_txn --created by jenrry DECLARE p_mmti_rec mtl_transactions_interface%ROWTYPE; p_m ...
- Oracle EBS OPM release step
--release_step生产批 --created by jenrry SET serveroutput on DECLARE x_return_status VARCHAR2 (1); l_ex ...
- Oracle EBS AP 创建贷项通知单并核销到相应发票
--1.0 生成与发票一样的贷项通知单 created by jenrry 20170423 DECLARE L_CUSTOMER_TRX_ID NUMBER; L_INVOICE_NUMBER VA ...
- Oracle EBS OPM close batch
--close_batch --created by jenrry DECLARE x_message_count NUMBER; x_message_list VARCHAR2 (4000); x_ ...
- Oracle EBS OPM convert dtl reservation
--convert_dtl_reservation --created by jenrry DECLARE l_reservation_rec mtl_reservations%ROWTYPE; l_ ...
- Oracle EBS OPM complete step
--complete_step --created by jenrry DECLARE x_return_status VARCHAR2 (1); l_exception_material_tbl g ...
随机推荐
- Spring学习--Spring事务相关速记
数据库事务 事务特性: 原子性,事务是不可分割的最小工作单元,事务内的操作要么全做,要么全不做 一致性,在事务执行前数据库的数据处于正确的状态,而事务执行完成后数据库的数据还是处于正确的状态 隔离性, ...
- WPF 中textBox实现只输入数字
刚学到 通过本方法可以使文本框只能输入或复制入数字 对于数量类输入文本框比较有用 金额类只需小改动也可实现 以TextBox txtCount为例 添加TextChanged事件 代码如下 priv ...
- 07 - JavaSE之容器
本章宗旨:1136 -- 1个图 1个类 3个知识点 6个接口 容器 J2SDK 所提供的容器 API 位于 java.util 包内. 容器 API 的类图如下: Collection 接口的子接口 ...
- Ansible-安装-秘钥-部署-使用
本文转自:https://www.cnblogs.com/ylqh/p/5902259.html ansiblemaster:192.168.74.146 ansibleslave1 :192.168 ...
- ConcurrentHashMap 扩容分析拾遗
前言 这是一篇对 transfer 方法的拾遗,关于之前那篇文章的一些一笔带过,或者当时不知道的地方进行回顾. 疑点 1. 为什么将链表拆成两份的时候,0 在低位,1 在高位? 回顾一下 transf ...
- el-upload源码跳坑2
产品又加了一个需求,要求删除图片时候弹一个提示框,如果确定就直接发请求从服务器删除图片 一开始想的比较简单,直接在on-remove的钩子函数上做弹框提示,如果取消就撤销,代码如下: <el ...
- MVC母版页_Layout.cshtml
记得在asp.net时候,我们常会使用母版页MasterPage.而在MVC也有此功能,应用起来比MasterPage更加便捷. 在本次练习之前,所有MVC的练习均是创建单独的网页.Insus.NET ...
- 数据库中存储日期的字段类型到底应该用varchar还是datetime
将数据库中存储时间的数据类型改为varchar(),这时最好让这些时间是数据库中自动生成的(一个没有格式的输入也可能会导致输出错误),因为存储类型为varchar(),所以获取到的值也就被认为是一个字 ...
- C#调用百度地图API经验分享(三)
这一篇我将跟大家分享一下我自己在开发过程中总结出的一些操作地图的方法,属性,及思路,希望可以让大家少走弯路. 1.定位 一般百度的示例DEMO里开始初始化地图时用的都是map.centerAndZoo ...
- HDU4283(KB22-G)
You Are the One Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...