--创建生产批
--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 创建生产批的更多相关文章

  1. Oracle EBS OPM 发放生产批

    --发放生产批 --created by jenrry DECLARE x_return_status VARCHAR2 (1); l_exception_material_tbl gme_commo ...

  2. Oracle EBS OPM 取消生产批

    --取消生产批 --created by jenrry SET serveroutput on; DECLARE p_batch_header_rec gme_batch_header%ROWTYPE ...

  3. Oracle EBS OPM 生产批创建事务处理

    --生产批创建事物处理 --created by jenrry DECLARE p_mmti_rec mtl_transactions_interface%ROWTYPE; p_mmli_tbl gm ...

  4. Oracle EBS OPM update material txn

    --update_material_txn --created by jenrry DECLARE p_mmti_rec mtl_transactions_interface%ROWTYPE; p_m ...

  5. Oracle EBS OPM release step

    --release_step生产批 --created by jenrry SET serveroutput on DECLARE x_return_status VARCHAR2 (1); l_ex ...

  6. Oracle EBS AP 创建贷项通知单并核销到相应发票

    --1.0 生成与发票一样的贷项通知单 created by jenrry 20170423 DECLARE L_CUSTOMER_TRX_ID NUMBER; L_INVOICE_NUMBER VA ...

  7. Oracle EBS OPM close batch

    --close_batch --created by jenrry DECLARE x_message_count NUMBER; x_message_list VARCHAR2 (4000); x_ ...

  8. Oracle EBS OPM convert dtl reservation

    --convert_dtl_reservation --created by jenrry DECLARE l_reservation_rec mtl_reservations%ROWTYPE; l_ ...

  9. Oracle EBS OPM complete step

    --complete_step --created by jenrry DECLARE x_return_status VARCHAR2 (1); l_exception_material_tbl g ...

随机推荐

  1. postgresql逻辑结构--用户及权限管理(七)

    一.用户和角色 二.创建用户和角色 三.权限管理 四.

  2. Spring整合Mybatis原理简单分析

    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean" ...

  3. SpringCloud入门之eclipse新建maven子项目和聚合项目

    一.new maven project :  next 二.勾选 create a simple project  :  next 三.Group Id:项目的包路径 如com.test,之后创建的C ...

  4. docker空间管理之清理磁盘占用

    1.docker部署后修改数据存放目录,默认存放到/var/lib/docker下面,修改到一个大的空间目录下面.参考我的另外一篇博客:https://www.cnblogs.com/cuishuai ...

  5. JS作用域,作用域,作用链详解

    前言   通过本文,你大概明白作用域,作用域链是什么,毕竟这也算JS中的基本概念. 一.作用域(scope) 什么是作用域,你可以理解为你所声明变量的可用范围,我在某个范围内申明了一个变量,且这个变量 ...

  6. es6学习笔记4--数组

    数组的扩展 Array.from() Array.from方法用于将两类对象转为真正的数组:类似数组的对象(array-like object)和可遍历(iterable)的对象(包括ES6新增的数据 ...

  7. Spring学习之路-注解

    Spring的注解总结. 地址:https://docs.spring.io/spring/docs/4.3.12.RELEASE/spring-framework-reference/htmlsin ...

  8. jQuery在线引用地址(全)

    转:https://www.cnblogs.com/lmyau/p/7736269.html 1.官网jquery压缩版引用地址: 3.1.1版本: <script src="http ...

  9. java多线程框架

    JDK5中的一个亮点就是将Doug Lea的并发库引入到Java标准库中.Doug Lea确实是一个牛人,能教书,能出书,能编码,不过这在国外还是比较普遍的,而国内的教授们就相差太远了. 一般的服务器 ...

  10. Java JDBC的基础知识(一)

    一.为什么引入JDBC 在学习JDBC之前,抛开它的概念,我先按照我的理解解释一下,为什么要引入JDBC.在我看来,引入JDBC跟我之前学过的引入JVM(Java虚拟机)有些相似之处.当然,关于JVM ...