INV*账户别名接收发放
DECLARE
--p_old_new_flag OLD 为导出 NEW 为导入
l_iface_rec inv.mtl_transactions_interface%ROWTYPE;
l_iface_lot_rec inv.mtl_transaction_lots_interface%ROWTYPE;
l_timeout NUMBER;
l_outcome BOOLEAN;
l_error_code VARCHAR2(100);
l_error_explanation VARCHAR2(100);
l_request_id NUMBER;
l_sqlerrm VARCHAR2(1000); l_inventory_item_id NUMBER;
l_organization_id NUMBER;
l_uom VARCHAR2(240);
l_disposition_id NUMBER;
l_subinventory_code VARCHAR2(240);
l_count NUMBER;
l_locator_id NUMBER;
l_error_msg VARCHAR2(32767); CURSOR cur IS
SELECT t.import_id,
t.organization_code,
t.item_number,
t.subinventory_code,
t.transaction_type transaction_type1,
decode(t.transaction_type,
'帐户别名接收',
41,
'帐户别名发放',
31,
NULL) transaction_type,
t.account_alias,
t.transaction_uom,
t.transaction_date,
t.lot_number,
decode(t.transaction_type,
'帐户别名接收',
t.transaction_quantity,
'帐户别名发放',
t.transaction_quantity * (-1),
NULL) transaction_quantity,
t.attribute1,
t.attribute2,
t.attribute3,
t.attribute4,
t.attribute5
FROM cux_inv_mmt_account_temp t
WHERE 1 = 1
--AND t.item_number = '1515453000051'
;
BEGIN mo_global.init('INV');
fnd_global.apps_initialize(user_id => 1318,
resp_id => 50559,
resp_appl_id => 222);
mo_global.set_policy_context('S',
83); l_count := 0;
FOR rec IN cur
LOOP l_error_msg := NULL;
l_iface_rec.last_update_date := SYSDATE;
l_iface_rec.last_updated_by := -1;
l_iface_rec.creation_date := SYSDATE;
l_iface_rec.created_by := -1;
l_iface_rec.last_update_login := -1;
l_iface_lot_rec.last_update_date := SYSDATE;
l_iface_lot_rec.last_updated_by := -1;
l_iface_lot_rec.creation_date := SYSDATE;
l_iface_lot_rec.created_by := -1;
l_iface_lot_rec.last_update_login := -1; SELECT mtl_material_transactions_s.nextval
INTO l_iface_rec.transaction_interface_id
FROM dual; BEGIN
SELECT msi.inventory_item_id,
msi.organization_id,
msi.primary_uom_code
INTO l_inventory_item_id, l_organization_id, l_uom
FROM mtl_system_items_b msi, org_organization_definitions ood
WHERE 1 = 1
AND msi.organization_id = ood.organization_id
AND ood.organization_code = rec.organization_code
AND msi.segment1 = rec.item_number;
EXCEPTION
WHEN OTHERS THEN
l_error_msg := l_error_msg || '物料' || rec.item_number || '不存在';
END; BEGIN
SELECT mgd.disposition_id
INTO l_disposition_id
FROM mtl_generic_dispositions mgd
WHERE 1 = 1
AND mgd.organization_id = l_organization_id
AND mgd.segment1 = rec.account_alias;
EXCEPTION
WHEN OTHERS THEN
l_error_msg := l_error_msg || '账户别名不存在';
END; BEGIN
SELECT msi.secondary_inventory_name
INTO l_subinventory_code
FROM mtl_secondary_inventories msi
WHERE 1 = 1
AND msi.organization_id = l_organization_id
AND msi.secondary_inventory_name = rec.subinventory_code;
EXCEPTION
WHEN OTHERS THEN
l_error_msg := l_error_msg || '子库存不存在';
END; IF (rec.attribute1 IS NOT NULL) THEN
BEGIN
SELECT mik.inventory_location_id
INTO l_locator_id
FROM mtl_item_locations_kfv mik
WHERE mik.concatenated_segments = rec.attribute1
AND mik.organization_id = l_organization_id
AND mik.subinventory_code = rec.subinventory_code;
EXCEPTION
WHEN no_data_found THEN
l_error_msg := l_error_msg || '货位不存在';
END;
END IF; --dbms_output.put_line('1!'); l_iface_rec.transaction_header_id := l_iface_rec.transaction_interface_id;
l_iface_rec.transaction_mode := 3;
l_iface_rec.process_flag := 1;
l_iface_rec.transaction_type_id := rec.transaction_type; --41 帐户别名接收 31 帐户别名发放
l_iface_rec.transaction_source_id := l_disposition_id; --来源
l_iface_rec.organization_id := l_organization_id;
l_iface_rec.inventory_item_id := l_inventory_item_id;
l_iface_rec.subinventory_code := rec.subinventory_code;
l_iface_rec.locator_id := l_locator_id;
l_iface_rec.transaction_quantity := rec.transaction_quantity; --出库数量为负数 入库数量为正数
l_iface_rec.primary_quantity := rec.transaction_quantity;
l_iface_rec.transaction_uom := l_uom;
l_iface_rec.transaction_date := rec.transaction_date;
l_iface_rec.source_code := '账户别名接收/发放';
l_iface_rec.source_header_id := to_number(to_char(SYSDATE,
'YYYYMMDDHH24MISS'));
l_iface_rec.source_line_id := to_number(to_char(SYSDATE,
'YYYYMMDDHH24MISS')); IF (l_error_msg IS NULL) THEN
INSERT INTO inv.mtl_transactions_interface VALUES l_iface_rec;
END IF; IF (rec.lot_number IS NOT NULL) THEN
l_iface_lot_rec.transaction_interface_id := l_iface_rec.transaction_interface_id;
l_iface_lot_rec.lot_number := rec.lot_number;
l_iface_lot_rec.transaction_quantity := l_iface_rec.transaction_quantity;
l_iface_lot_rec.source_code := l_iface_rec.source_code;
l_iface_lot_rec.source_line_id := l_iface_rec.source_line_id; IF (l_error_msg IS NULL) THEN
INSERT INTO inv.mtl_transaction_lots_interface
VALUES l_iface_lot_rec;
END IF;
END IF; IF (l_error_msg IS NULL) THEN
l_timeout := 10;
l_outcome := mtl_online_transaction_pub.process_online(p_transaction_header_id => l_iface_rec.transaction_header_id,
p_timeout => l_timeout,
p_error_code => l_error_code,
p_error_explanation => l_error_explanation); IF (l_outcome = FALSE) THEN
dbms_output.put_line('Failed*******Import_id:' || rec.import_id);
dbms_output.put_line('Failed!');
dbms_output.put_line('l_error_code:' || l_error_code);
dbms_output.put_line('l_error_explanation:' || l_error_explanation);
ELSIF (l_outcome = TRUE) THEN
l_count := l_count + 1;
END IF;
END IF; IF (l_error_msg IS NOT NULL) THEN
dbms_output.put_line('l_error_msg:' || l_error_msg);
END IF; END LOOP;
dbms_output.put_line('SuccessFul:' || l_count); EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Exception!' || SQLERRM);
END;
--期初数据导入,创建表存储
create table cux_inv_mmt_account_temp(
IMPORT_ID NUMBER,
ORGANIZATION_CODE VARCHAR2(),
ITEM_NUMBER VARCHAR2(),
SUBINVENTORY_CODE VARCHAR2(),
TRANSACTION_TYPE VARCHAR2(),
ACCOUNT_ALIAS VARCHAR2(),
TRANSACTION_UOM VARCHAR2(),
TRANSACTION_DATE DATE,
LOT_NUMBER VARCHAR2(),
TRANSACTION_QUANTITY NUMBER,
ATTRIBUTE1 VARCHAR2(),
ATTRIBUTE2 VARCHAR2(),
ATTRIBUTE3 VARCHAR2(),
ATTRIBUTE4 VARCHAR2(),
ATTRIBUTE5 VARCHAR2()
)
INV*账户别名接收发放的更多相关文章
- 物料事务处理接口表 MTL_TRANSACTIONS_INTERFACE 账户别名使用 及 提示无效的分配账户字段
实例: PROCEDURE MAIN(P_ORGANIZATION_ID NUMBER, P_PERIOD_NAME VARCHAR2, XV_STATUS OUT VARCHAR, XV_MESG ...
- 所有标准API
序号 系统版本 模块 应用场景 类型 API/接口 参数规格 样例代码 备注 登记者 登记时间 关键字 1 12.1.3 AP 付款核销 API ap_pay_invoice_pkg.ap_pay_i ...
- Oracle EBS-SQL (INV-2):检查帐户别名发放记录.sql
SELECT FU.description 操作者, ITM.SEGMENT1 物料编码, ITM.DESC ...
- ORACLE EBS常用表及查询语句(最终整理版)
建议去看参考二 参考一: call fnd_global.APPS_INITI ...
- PMS与orcalebs结合之字段
call fnd_global.APPS_INITIALIZE(1318,50583,401) select fnd_profile.VALUE('ORG_ID') FROM DUAL select ...
- Oracle常用标准表
一.INV(库存) 子库存:mtl_secondary_inventories 事物处理:mtl_material_transactions mmt 事务处理来源类型:mtl_txn_source_t ...
- EBS常用表_Dictionary
EBS常用表:转载于 https://blog.csdn.net/xiariqingcao/article/details/8775827 . OU.库存组织 SELECT hou.organizat ...
- 具体解释EBS接口开发之WIP模块接口
整体说明 文档目的 本文档针对WIP模块业务功能和接口进行分析和研究,对採用并发请求方式和调用API方式分别进行介绍 内容 WIP模块经常使用标准表简单介绍 WIP事物处理组成 WIP相关业务流程 W ...
- 详解EBS接口开发之WIP模块接口
总体说明 文档目的 本文档针对WIP模块业务功能和接口进行分析和研究,对采用并发请求方式和调用API方式分别进行介绍 内容 WIP模块常用标准表简介 WIP事物处理组成 WIP相关业务流程 WIP相关 ...
随机推荐
- BM递推杜教版
#include <bits/stdc++.h> using namespace std; #define rep(i,a,n) for (long long i=a;i<n;i++ ...
- SQL Server 中PAGELATCH_x和PAGEIOLATCH_x解析
0.参考文献 Microsoft SQL Server企业级平台管理实践 第11章 Buffer Latch Timeout的解析 什么是PAGELATCH和PAGEIOLATCH 1.PAGELAT ...
- Postgresql operator does not exist: numeric = character varying
)),series_name from svcm_t_series_res: 原来series_id是numeric型,现在转换为varchar(64):
- 如何调试 Windows 服务
概要 本文分步介绍了如何使用 WinDbg 调试程序 (windbg.exe) 调试 Windows 服务. 要调试 Windows 服务,可以在服务启动后将 WinDbg 调试程序附加到托管该服务的 ...
- [Gradle] 发布 library 到本地 maven 仓库
Java Library // publish_local_java.gradle apply plugin: 'maven-publish' publishing { publications { ...
- 洛谷 P1351 联合权值 题解
P1351 联合权值 题目描述 无向连通图 \(G\) 有 \(n\) 个点,\(n-1\) 条边.点从 \(1\) 到 \(n\) 依次编号,编号为 \(i\) 的点的权值为 \(W_i\),每条 ...
- UOJ46. 【清华集训2014】玄学 [线段树,二进制分组]
UOJ 思路 模拟赛出了这题,结果我没学过二进制分组--一波主席树然后空间就爆炸了-- 用线段树维护时间序列,每个节点维护\(a_i\to x_i\times a_i+b_i,i\in [1,n]\) ...
- java生成HMACSHA256的方法
data要加密的数据,key密钥 public static String HMACSHA256(String data, String key) throws Exception { Mac sha ...
- JavaBitSet学习
一.背景 之前公司项目需要对会员人群进行去重过滤,人群的维度是user_id: 因此采用了BitSet做简单的去重,方案将user_id作为bitset中的bit索引: 通过and\or\xor基础运 ...
- 第06组 Alpha事后诸葛亮
一.组长博客: https://www.cnblogs.com/mhq-mhq/p/11923194.html 二.Postmortem模板 设想和目标 1.我们的软件要解决什么问题?是否定义得很清楚 ...