日志 库存事务处理临时表 Mtl_material_transactions_temp 批次事务处理临时表 mtl_transaction_lots_temp 序列事务处理临时表 mtl_serial_numbers_temp ü n n n n n n n n n n n n n n n 以下信息来源于物料定义(mtl_system_items_b msi) n n n n n n n n n n n n n n n n 以下数据来源库存事务处理类型(mtl_transaction_types mt) n n n 以下数据外部赋值 n n n n n n n n 提交后台请求(或者让系统自动提交,系统每隔几分钟提交一次) fnd_request.submit_request( 'INV', 'INCTCW', '', '', FALSE, to_char(g_group_id), '2', '','','','','','','','', '','','','','','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','','','','','', '','','','','','','','','',''); 实例:(帐户别名接收的库存事务处理) --测试库存事务处理 declare errbuf VARCHAR2(240); errcode NUMBER; g_org_id NUMBER := 84; x_trx_qty NUMBER; x_acct_id NUMBER; x_request_id NUMBER; x_qty_disp NUMBER; x_oraphase VARCHAR2(240); x_return VARCHAR2(240); x_phase VARCHAR2(240); x_status VARCHAR2(240); x_message VARCHAR2(240); x_req_status BOOLEAN; x_precision NUMBER; g_period_id number; g_group_id number; g_item_id number := 23884; g_mtx mtl_material_transactions_temp%ROWTYPE; g_user_id number := 2539; g_date date := sysdate; g_subinv varchar2(30) :='972';-- 'SUBINV'; g_trx_type_id number := 41; -----账户别名接收 g_serial_prefix varchar2(30); g_lot_prefix varchar2(30); BEGIN begin select acct_period_id into g_period_id from org_acct_periods oap where oap.organization_id = 84/*g_org_id*/ and g_date between oap.period_start_date and oap.schedule_close_date; --dbms_output.put_line(g_period_id); exception when others then dbms_output.put_line(sqlerrm); end; BEGIN select mtl_material_transactions_s.nextval into g_group_id from dual; Exception when others then dbms_output.put_line(sqlerrm); END; x_trx_qty := 1; g_trx_type_id := 41; g_mtx.allowed_units_lookup_code := 3; g_mtx.created_by := g_user_id; g_mtx.creation_date := g_date; g_mtx.last_update_date := g_date; g_mtx.last_update_login := g_user_id; g_mtx.last_updated_by := g_user_id; g_mtx.final_completion_flag := 'N'; BEGIN select organization_id, inventory_item_id, description, a.inventory_asset_flag, a.location_control_code, a.lot_control_code, a.primary_uom_code, a.restrict_subinventories_code, a.restrict_locators_code, a.revision_qty_control_code, a.segment1, a.serial_number_control_code, a.shelf_life_code, a.shelf_life_days, a.mtl_transactions_enabled_flag, a.primary_uom_code, a.auto_serial_alpha_prefix, a.auto_lot_alpha_prefix into g_mtx.organization_id, g_mtx.inventory_item_id, g_mtx.item_description, g_mtx.item_inventory_asset_flag, g_mtx.item_location_control_code, g_mtx.item_lot_control_code, g_mtx.item_primary_uom_code, g_mtx.item_restrict_subinv_code, g_mtx.item_restrict_locators_code, g_mtx.item_revision_qty_control_code, g_mtx.item_segments, g_mtx.item_serial_control_code, g_mtx.item_shelf_life_code, g_mtx.item_shelf_life_days, g_mtx.item_trx_enabled_flag, g_mtx.transaction_uom, g_serial_prefix, g_lot_prefix from mtl_system_items_b a where organization_id = g_org_id and inventory_item_id = g_item_id; Exception when others then dbms_output.put_line(sqlerrm); END; g_mtx.lock_flag := 'N'; g_mtx.posting_flag := 'Y'; g_mtx.process_flag := 'Y'; g_mtx.source_line_id := -1; g_mtx.transaction_header_id := g_group_id; g_mtx.transaction_mode := 3; g_mtx.transaction_status := 1; g_mtx.transaction_temp_id := g_group_id; BEGIN select transaction_type_id, transaction_action_id, transaction_source_type_id into g_mtx.transaction_type_id, g_mtx.transaction_action_id, g_mtx.transaction_source_type_id from mtl_transaction_types a where a.transaction_type_id = g_trx_type_id; Exception when others then dbms_output.put_line(sqlerrm); END; g_mtx.acct_period_id := g_period_id; g_mtx.primary_quantity := x_trx_qty; g_mtx.subinventory_code := g_subinv; g_mtx.supply_locator_id := ''; g_mtx.transaction_date := g_date; g_mtx.transaction_cost := 1.001; g_mtx.transaction_quantity := x_trx_qty; g_mtx.transaction_source_id := 1220;--13; g_mtx.transaction_source_name := ''; g_mtx.operation_seq_num := ''; g_mtx.department_id := ''; g_mtx.wip_entity_type := ''; g_mtx.distribution_account_id := ''; begin insert into mtl_material_transactions_temp values g_mtx; --rollback; commit; dbms_output.put_line(g_mtx.transaction_header_id); dbms_output.put_line(g_mtx.transaction_source_type_id); exception when others then dbms_output.put_line(sqlerrm); rollback; end; x_request_id := fnd_request.submit_request('INV', 'INCTCW', '', '', FALSE, to_char(g_group_id), '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); IF x_request_id > 0 THEN commit; dbms_output.put_line('后台请求 ' || x_request_id); END IF; END; |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7730229/viewspace-1020422/ ,如需转载,请注明出处,否则将追究法律责任。
道具: | (以小纸条形式发送) 查看今日免费发送数量