1. --生产批创建事物处理
  2. --created by jenrry
  3. DECLARE
  4. p_mmti_rec mtl_transactions_interface%ROWTYPE;
  5. p_mmli_tbl gme_common_pvt.mtl_trans_lots_inter_tbl;
  6. x_return_status VARCHAR2 (2000);
  7. p_validation_level NUMBER;
  8. p_init_msg_list VARCHAR2 (2000);
  9. p_commit VARCHAR2 (2000);
  10. x_message_count NUMBER;
  11. x_message_list VARCHAR2 (2000);
  12. l_msg_count NUMBER;
  13. l_msg_data VARCHAR2 (2000);
  14. x_mmt_rec mtl_material_transactions%ROWTYPE;
  15. x_mmln_tbl gme_common_pvt.mtl_trans_lots_num_tbl;
  16. l_txn_count NUMBER;
  17. l_count_t NUMBER;
  18. l_count_i NUMBER;
  19. setup_failure EXCEPTION;
  20. p_org_code VARCHAR2 (3) := 'PR1';
  21. g_debug VARCHAR2 (5) := fnd_profile.VALUE ('AFLOG_LEVEL');
  22.  
  23. l_user_name VARCHAR2 (80);
  24. l_user_id NUMBER;
  25.  
  26. CURSOR get_user_id (v_user_name IN VARCHAR2)
  27. IS
  28. SELECT user_id
  29. FROM fnd_user
  30. WHERE user_name = v_user_name;
  31.  
  32. PROCEDURE display_messages (p_msg_count IN NUMBER)
  33. IS
  34. MESSAGE VARCHAR2 (2000);
  35. dummy NUMBER;
  36. l_api_name CONSTANT VARCHAR2 (30) := 'DISPLAY_MESSAGES';
  37. BEGIN
  38. FOR i IN 1 .. p_msg_count
  39. LOOP
  40. fnd_msg_pub.get (p_msg_index => i,
  41. p_data => MESSAGE,
  42. p_encoded => 'F',
  43. p_msg_index_out => dummy
  44. );
  45. DBMS_OUTPUT.put_line ('Message ' || TO_CHAR (i) || ' ' || MESSAGE);
  46. END LOOP;
  47. EXCEPTION
  48. WHEN OTHERS
  49. THEN
  50. fnd_msg_pub.add_exc_msg ('wrapper for Create_Material_txn', l_api_name);
  51. END display_messages;
  52. BEGIN
  53.  
  54. DBMS_OUTPUT.ENABLE (20000);
  55.  
  56. l_user_name := 'SYSADMIN';
  57.  
  58. OPEN get_user_id (l_user_name);
  59.  
  60. FETCH get_user_id
  61. INTO l_user_id;
  62.  
  63. IF get_user_id%NOTFOUND
  64. THEN
  65. DBMS_OUTPUT.put_line ('Invalid User ' || l_user_name);
  66.  
  67. CLOSE get_user_id;
  68.  
  69. RAISE NO_DATA_FOUND;
  70. END IF;
  71.  
  72. CLOSE get_user_id;
  73.  
  74. fnd_profile.initialize (l_user_id);
  75.  
  76. fnd_global.apps_initialize (user_id => l_user_id,
  77. resp_id => NULL,
  78. resp_appl_id => NULL
  79. );
  80.  
  81. x_return_status := fnd_api.g_ret_sts_success;
  82.  
  83. fnd_msg_pub.initialize;
  84. gme_common_pvt.g_error_count := 0;
  85. gme_common_pvt.set_timestamp;
  86. gme_common_pvt.g_move_to_temp := fnd_api.g_false;
  87. p_mmti_rec.organization_id := 1199;
  88. p_mmti_rec.source_code := 'OPM';
  89. p_mmti_rec.source_header_id := 147;
  90. p_mmti_rec.transaction_source_id := 414962;
  91. p_mmti_rec.trx_source_line_id := 576266;
  92. --p_mmti_rec.last_updated_by := gme_common_pvt.g_user_ident;
  93. --p_mmti_rec.last_update_login := gme_common_pvt.g_user_ident ;
  94. --p_mmti_rec.last_update_date := gme_common_pvt.g_timestamp ;
  95. --p_mmti_rec.creation_date := gme_common_pvt.g_timestamp ;
  96. --p_mmti_rec.created_by := gme_common_pvt.g_user_ident;
  97. p_mmti_rec.inventory_item_id := 234657;
  98. p_mmti_rec.revision := NULL;
  99. p_mmti_rec.organization_id := 1199;
  100. p_mmti_rec.transaction_date := SYSDATE;
  101. p_mmti_rec.transaction_type_id := 44/*gme_common_pvt.g_ing_issue*/;
  102. p_mmti_rec.transaction_action_id := gme_common_pvt.g_ing_issue_txn_action;
  103. p_mmti_rec.transaction_quantity := 20;
  104. --p_mmti_rec.primary_quantity :=
  105. p_mmti_rec.transaction_uom := '袋';
  106. p_mmti_rec.subinventory_code := 'CWK';
  107. p_mmti_rec.locator_id := 983;
  108. p_mmti_rec.transaction_source_type_id := 5;
  109. --p_mmti_rec.transaction_source_name :=
  110. p_mmti_rec.wip_entity_type := 10;
  111. --p_mmti_rec.reason_id :=
  112.  
  113. p_mmli_tbl(1).last_update_date := gme_common_pvt.g_timestamp ;
  114. p_mmli_tbl(1).last_updated_by := gme_common_pvt.g_user_ident ;
  115. p_mmli_tbl(1).creation_date := gme_common_pvt.g_timestamp ;
  116. p_mmli_tbl(1).created_by := gme_common_pvt.g_user_ident ;
  117. p_mmli_tbl(1).lot_number := 'L20170814' ;
  118. --p_mmli_tbl(1).parent_lot_number := 'GRNEWPARENTAPI' ;
  119. p_mmli_tbl(1).transaction_quantity := 20 ;
  120.  
  121. gme_api_pub.create_material_txn
  122. (p_api_version => 2.0,
  123. p_validation_level => gme_common_pvt.g_max_errors,
  124. p_init_msg_list => fnd_api.g_false,
  125. p_commit => fnd_api.g_true,
  126. x_message_count => x_message_count,
  127. x_message_list => x_message_list,
  128. x_return_status => x_return_status,
  129. p_org_code => 'F06',
  130. p_mmti_rec => p_mmti_rec,
  131. p_mmli_tbl => p_mmli_tbl,
  132. p_batch_no => NULL,
  133. p_line_no => NULL,
  134. p_line_type => NULL,
  135. p_create_lot => fnd_api.g_true,
  136. p_generate_lot => NULL,
  137. p_generate_parent_lot => NULL,
  138. x_mmt_rec => x_mmt_rec,
  139. x_mmln_tbl => x_mmln_tbl
  140. );
  141. DBMS_OUTPUT.put_line ( 'msg_count from process trxns='
  142. || TO_CHAR (l_msg_count)
  143. );
  144.  
  145. IF l_msg_count > 1
  146. THEN
  147. display_messages (l_msg_count);
  148. END IF;
  149.  
  150. DBMS_OUTPUT.put_line ( 'after process transactions x_return_status='
  151. || TO_CHAR (x_return_status)
  152. );
  153. -- Output the results
  154. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.transaction_id = '
  155. || TO_CHAR (x_mmt_rec.transaction_id),
  156. 1,
  157. 255
  158. )
  159. );
  160. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.transaction_type_id = '
  161. || TO_CHAR (x_mmt_rec.transaction_type_id),
  162. 1,
  163. 255
  164. )
  165. );
  166. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.transaction_action_id = '
  167. || TO_CHAR (x_mmt_rec.transaction_action_id),
  168. 1,
  169. 255
  170. )
  171. );
  172. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.transaction_source_id = '
  173. || TO_CHAR (x_mmt_rec.transaction_source_id),
  174. 1,
  175. 255
  176. )
  177. );
  178. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.trx_source_line_id = '
  179. || TO_CHAR (x_mmt_rec.trx_source_line_id),
  180. 1,
  181. 255
  182. )
  183. );
  184. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.source_line_id = '
  185. || TO_CHAR (x_mmt_rec.source_line_id),
  186. 1,
  187. 255
  188. )
  189. );
  190. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.transaction_quantity = '
  191. || TO_CHAR (x_mmt_rec.transaction_quantity),
  192. 1,
  193. 255
  194. )
  195. );
  196. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.transaction_uom = '
  197. || TO_CHAR (x_mmt_rec.transaction_uom),
  198. 1,
  199. 255
  200. )
  201. );
  202. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.transaction_date = '
  203. || TO_CHAR (x_mmt_rec.transaction_date),
  204. 1,
  205. 255
  206. )
  207. );
  208. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmln_tbl.count = '
  209. || TO_CHAR (x_mmln_tbl.COUNT),
  210. 1,
  211. 255
  212. )
  213. );
  214.  
  215. IF (x_mmln_tbl.COUNT > 0)
  216. THEN
  217. FOR i IN 1 .. x_mmln_tbl.COUNT
  218. LOOP
  219. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmln_tbl((i).lot_number = '
  220. || TO_CHAR (x_mmln_tbl.COUNT),
  221. 1,
  222. 255
  223. )
  224. );
  225. END LOOP;
  226. END IF;
  227.  
  228. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.LAST_UPDATE_DATE = '
  229. || TO_CHAR (x_mmt_rec.last_update_date),
  230. 1,
  231. 255
  232. )
  233. );
  234. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.LAST_UPDATED_BY = '
  235. || TO_CHAR (x_mmt_rec.last_updated_by),
  236. 1,
  237. 255
  238. )
  239. );
  240. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.CREATION_DATE = '
  241. || TO_CHAR (x_mmt_rec.creation_date),
  242. 1,
  243. 255
  244. )
  245. );
  246. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.CREATED_BY = '
  247. || TO_CHAR (x_mmt_rec.created_by),
  248. 1,
  249. 255
  250. )
  251. );
  252. DBMS_OUTPUT.put_line (SUBSTR ( 'x_mmt_rec.LAST_UPDATE_LOGIN = '
  253. || TO_CHAR (x_mmt_rec.last_update_login),
  254. 1,
  255. 255
  256. )
  257. );
  258. DBMS_OUTPUT.put_line (SUBSTR ('x_return_status = ' || x_return_status,
  259. 1,
  260. 255
  261. )
  262. );
  263. DBMS_OUTPUT.put_line ('x_message_count = ' || TO_CHAR (x_message_count));
  264. DBMS_OUTPUT.put_line (SUBSTR ('x_message_list = ' || x_message_list, 1,
  265. 255)
  266. );
  267. gme_common_pvt.count_and_get (x_count => x_message_count,
  268. p_encoded => fnd_api.g_false,
  269. x_data => x_message_list
  270. );
  271.  
  272. IF x_message_count > 1
  273. THEN
  274. display_messages (x_message_count);
  275. END IF;
  276. EXCEPTION
  277. WHEN setup_failure
  278. THEN
  279. DBMS_OUTPUT.put_line (' in setup failure');
  280. WHEN OTHERS
  281. THEN
  282. DBMS_OUTPUT.put_line (SUBSTR ( 'Error '
  283. || TO_CHAR (SQLCODE)
  284. || ': '
  285. || SQLERRM,
  286. 1,
  287. 255
  288. )
  289. );
  290. RAISE;
  291. END;
  292. /

  

Oracle EBS OPM 生产批创建事务处理的更多相关文章

  1. Oracle EBS OPM 创建生产批

    --创建生产批 --created by jenrry DECLARE x_message_count NUMBER; x_message_list VARCHAR2 (2000); x_return ...

  2. Oracle EBS OPM 发放生产批

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

  3. Oracle EBS OPM 取消生产批

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

  4. Oracle EBS OPM 事务处理

    --事务处理 --created by jenrry DECLARE l_iface_rec inv.mtl_transactions_interface%ROWTYPE; l_iface_lot_r ...

  5. Oracle EBS OPM 车间发料事务处理

    --车间发料事物处理 --created by jenrry DECLARE l_iface_rec inv.mtl_transactions_interface%ROWTYPE; l_iface_l ...

  6. Oracle EBS OPM update material txn

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

  7. Oracle EBS OPM release step

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

  8. Oracle EBS OPM close batch

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

  9. Oracle EBS OPM convert dtl reservation

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

随机推荐

  1. php -- 数学函数

    ----- 016-math.php ----- <!DOCTYPE html> <html> <head> <meta http-equiv="c ...

  2. 逆向工程-对native层的一次简单逆向实践

    关注一款app很久了,这款app为了防止别人逆向破解拉取数据做了很多工作: 防止别人修改apk包,执行关键动作时对dex文件进行md5验证: 防止用户调用接口批量拉数据,对返回的web网页里个人信息进 ...

  3. MySQL问答整理

    1.Mysql中有哪些不同的表格? MyISAM: 基于IASM代码.可以被压缩,支持全文搜索,事务不安全,而且也不支持外键.如果事务回滚将会造成不完全回滚,从而不具备原子性.所以假如忽略事务以及访问 ...

  4. Java源码阅读(不断补充)

    java.util.LinkedList LinkedList是实现了List接口的双链表实现,拥有list的所有方法并且允许所有元素(包括null). 双向链表也叫双链表,是链表的一种,它的每个数据 ...

  5. es6学习笔记6--Generator 函数

    基本概念 Generator函数有多种理解角度.从语法上,首先可以把它理解成,Generator函数是一个状态机,封装了多个内部状态. 执行Generator函数会返回一个遍历器对象,也就是说,Gen ...

  6. [转]SQL Server Reporting Services - Timeout Settings

    本文转自:https://social.technet.microsoft.com/wiki/contents/articles/23508.sql-server-reporting-services ...

  7. .Net Core MVC实现自己的AllowAnonymous

    全局过滤,在Startup中ConfigureServices里面添加如下代码 services.AddMvc(options => { options.Filters.Add(typeof(M ...

  8. sql 中有关时间的语句

    1.比较得到两个时间相差的间隔 SELECT datediff(minute, ’2009-04-28 12:05:00′, getdate()); SELECT datediff(month, ’2 ...

  9. [基础篇] 玄机网C#培训课程-初级.

    课程目录 0x01第一课课前准备vs的选择与安装常用工具/网址      http://msdn.itellyou.cn/vs常用设置 0x02第二课C#的语法样式  编程风格VS的常用功能 俩个注意 ...

  10. Alice and Bob(博弈)

    Alice and Bob Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB Total submit users ...