select a.responsibility_name, b.prompt, f.user_concurrent_program_name from fnd_responsibility_vl a, fnd_menu_entries_vl b, fnd_form_functions_vl c, fnd_request_groups d, fnd_request_group_units e, fnd_concurrent_programs_vl f where a.menu_id = b.menu_id and b.function_id = c.function_id and c.parameters like '%' || d.request_group_code || '%' and d.application_id = e.application_id and d.request_group_id = e.request_group_id and e.unit_application_id = f.application_id and e.request_unit_id = f.concurrent_program_id and f.user_concurrent_program_name like '%杂项出入库报表%'
select poh.segment1 po单据号, poh.creation_date, pov.vendor_name 供应商, --hl_po_utl_pkg.get_location_code(poh.ship_to_location_id) 收货方, --hl_po_utl_pkg.get_location_code(poh.bill_to_location_id) 收单方, poh.currency_code 币种, hr_general.decode_person_name(poh.agent_id) 采购员, po_headers_sv3.get_po_status(poh.po_header_id) 状态, hl_po_utl_pkg.get_po_amount(poh.po_header_id, poh.currency_code) 合计, poh.comments 摘要, pol.line_num 编号, po_line_types_sv.get_line_type(pol.line_type_id) 类型, --hl_po_utl_pkg.get_item_desc(pol.item_id, pll.ship_to_organization_id) 料号, pol.item_description 摘要, cat.concatenated_segments 类别, pol.unit_meas_lookup_code 单位, pol.quantity 数量, pol.unit_price 价格, --hl_po_utl_pkg.format_precision(pol.quantity * unit_price,poh.currency_code) 金额, gcc.concatenated_segments 借记账户, pod.gl_encumbered_date gl_日期 from po_headers_all poh, po_lines_all pol, po_line_locations_all pll, hr_locations_all hl, po_distributions_all pod, po_vendors pov, mtl_system_items_vl mst, mtl_categories_b_kfv cat, gl_code_combinations_kfv gcc where poh.po_header_id = pol.po_header_id and pol.po_line_id = pll.po_line_id and hl.location_id(+) = pll.ship_to_location_id and pod.line_location_id = pll.line_location_id and poh.vendor_id = pov.vendor_id(+) and pol.item_id = mst.inventory_item_id(+) and pol.org_id = mst.organization_id(+) and pol.category_id = cat.category_id(+) and gcc.code_combination_id(+) = pod.code_combination_id
---查询请购单的状态select * from po_requisition_headers_all por where por.requisition_header_id = 63578; ---修改请购单状态为未提交审批update po_requisition_headers_all porh set porh.authorization_status = 'INCOMPLETE' where porh.requisition_header_id = 63578; ---查询采购单状态select * from po_headers_all aa where aa.po_header_id in (20430, 20431, 20306); ---修改采购单状态为未审批update po_headers_all aa set aa.wf_item_type = null, aa.wf_item_key = null, aa.approved_flag = null, aa.authorization_status = null where aa.po_header_id in (20430, 20431);
select hou.organization_id ou_org_id, --org_id hou.name ou_name, --ou名称 ood.organization_id org_org_id, --库存组织id ood.organization_code org_org_code, --库存组织代码 msi.secondary_inventory_name, --子库存名称 msi.description --子库存描述 from hr_organization_information hoi, --组织分类表 hr_operating_units hou, --ou视图 org_organization_definitions ood, --库存组织定义视图 mtl_secondary_inventories msi --子库存信息表 where hoi.org_information1 = 'OPERATING_UNIT' and hoi.organization_id = hou.organization_id and ood.operating_unit = hoi.organization_id and ood.organization_id = msi.organization_id
在ap_invoice_distributions_all中有时rcv_transaciton_id为空,有时却又是有值的, 这是为什么呢?(请参考po_line_locations_all.match_option)
首先,对于EBS中的法人实体和分类账以及OU之间的一个层次关系如下图:
其中,对于分类账和法人实体,并不简单是一对多的关系,按照理论上来讲:由于分类账存在辅助分类账,所以一个法人实体除了对应一个主分类账(Primary Ledger)外,还可能存在辅助分类账,但是一个法人实体肯定只对应一个唯一的主分类账,而对于分类账之间是否存在有“主从关系”还不太清楚,有待进一步考证。
而在R12中,要找出他们之间的关系就需要通过一下sql来看了:
从数据结果中可以看出,系统中有7个分类账(LEDGER)和5个法人实体(LEGAL_ENTITY),对于TCL_YSP这个法人实体来说,拥 有两个分类账,其LEDGER_CATEGORY_CODE分别为PRIMARY和SECONDARY,说明了一个法人实体有一个主分类账,并且可以有辅 助分类账,而2041这个分类账,则没有对应的法人实体,但是其LEDGER_CATEGORY_CODE依然为PRIMARY,这说明一个分类账的 category_code有可能是事前定义好的,而不是在与法人实体关联的时候才决定的,所以不能确定分类账之间到底有层次关系……
对以上的sql进行精简,也可以得出相应的关系来:
select lg.ledger_id, --分类帐
cfgdet.object_id legal_entity_id, --法人实体 lg.currency_code, lg.chart_of_accounts_id, rs.primary_ledger_id from gl_ledger_config_details primdet, gl_ledgers lg, gl_ledger_relationships rs, gl_ledger_configurations cfg, gl_ledger_config_details cfgdet where rs.application_id = 101 --101为总账GL应用 and ((rs.target_ledger_category_code = 'SECONDARY' and rs.relationship_type_code <> 'NONE') or (rs.target_ledger_category_code = 'PRIMARY' and rs.relationship_type_code = 'NONE') or (rs.target_ledger_category_code = 'ALC' and rs.relationship_type_code in ('JOURNAL', 'SUBLEDGER'))) and lg.ledger_id = rs.target_ledger_id and lg.ledger_category_code = rs.target_ledger_category_code and nvl(lg.complete_flag, 'Y') = 'Y' and primdet.object_id = rs.primary_ledger_id and primdet.object_type_code = 'PRIMARY' and primdet.setup_step_code = 'NONE' and cfg.configuration_id = primdet.configuration_id and cfgdet.configuration_id(+) = cfg.configuration_id and cfgdet.object_type_code(+) = 'LEGAL_ENTITY';
--Oracle多行数据合并一行.sql
--1.CREATE TYPE NUMBER_LIST_T AS TABLE OF varchar2(50); --2. CREATE OR REPLACE FUNCTION CONCAT_LIST ( lst IN number_list_t, separator varchar2)RETURN VARCHAR2 ISret varchar2(2000);BEGINFOR j IN 1..lst.LAST LOOPret := ret || separator || lst(j);END LOOP;RETURN ret;END; --3. CREATE OR REPLACE FUNCTION getUserRoles ( userid in varchar2)RETURN VARCHAR2 ISrtl varchar2(2000);BEGIN SELECT Substr(CONCAT_LIST(LST, ','),2) into rtl from ( SELECT CAST(MULTISET( SELECT trim(f_name) AS f_name FROM (select u.userid as f_id,r.rolename as f_name from base_role r, base_user_roles u where r.roleid=u.roleid) e WHERE e.f_id=m.f_id ) AS number_list_t) LST FROM (select u.userid as f_id,r.rolename as f_name from base_role r, base_user_roles u where r.roleid=u.roleid) m where m.f_id = userid group by m.f_id ); return(rtl);END;--select u.*, getUserRoles(u.userid) from base_user u分组最大值记录
比如 序号 名称 数量 1 A 20 2 A 10 1 B 20 2 B 40 3 B 10 1 C 20 2 C 40 |
select * from 表 where (序号,名称) in (select max(序号),名称 from 表 group by 名称)
分析函数:
select 序号 , 名称 , 数量 from (select 序号 , 名称 , 数量 ,row_number() over(partition by 名称 order by 序号 desc ) rnform tab_name )where rn=1或
select 序号 , 名称 , 数量 from (select 序号 , 名称 , 数量 , max(序号) over(partition by 名称) rnform tab_name )
where rn=序号
注意:max的字段只能是number类型字段,如果是date类型的,会提示错误。date类型用上面的row_number()来做就可以了。
1 1
2 1
3 1
4 2
5 2
6 3
7 3
8 3
取出
id apply_id
3 1
5 2
8 3
select alx_a.id
from
(select id,apply_id,rownum rid from 表) alx_a,
(select id,apply_id,rownum rid from 表) alx_b
where alx_a.apply_id = alx_b.apply_id and alx_a.id <= alx_b.id
group by alx_a.id,alx_a.apply_id
having count(*) = 1
分组并取每组中的前n条记录
在oracle中有一数据表exam_result(成绩记录表),
表中的一条记录描述了“某个班某个学生某次考试的成绩"
create table EXAM_RESULT
( ID NUMBER(10) not null, --主键 CLASSID NUMBER(10) not null, -- 班级id,关联到班级表 USERID NUMBER(10) not null, --用户id,关联到用户表 EXAMID NUMBER(10) not null, --试卷id,关联到试卷表 RESULT NUMBER(3) --成绩)
现在要求统计完成了试卷id为1,2,3的成绩的前3名
即完成了试卷id为1的前3名,完成了试卷id为2的前3名,完成了试卷id为3的前3名
INV库存
organization 两个含义:1. 经营单位,A/B/C分公司,A下面有A1,A2等工厂,主题目标是为了独立核算此组织ORG,ORG_ID;2. 库存组织,例如制造商的仓库,例如A1,A2等工厂Organization_id;HR_ORGANIZATION_UNITS -
Org_organization_definitionsMtl_subinventory_ 库存组织单位MTL_PARAMETERS -库存组织参数(没有用ID,直接用name)MTL_SYSTEM_ITEMS_b -物料信息(同上,应用了库存组织name)MTL_SECONDARY_INVENTORIES -子库存组织 -MTL_ITEM_LOCATTIONS -货位 - SUBINVENTROY_CODEMtl_Material_Transactions - (库存)物料事物表
成本 mtl_transaction_accountstransaction_cost是事物成本;ACTUAL_COST是通过成本算法计算出来的实际成本,主计量单位现有量
汇总历史记录(正负合计)Mtl_Material_TransactionsMTL_ONHAND_QUANTITIES现有量表,组织/子库存/货位/物品 summary可能按照挑库先进先出统计,如果设置了"不允许负库存",这样就不可能出现负数PO
请购单头表Po_Requisition_Headers_all行表Po_Requisition_lines_all采购订单PO_HEADER_ALLPO_LINES_ALL采购接收-退货/组织间转移/正常状态 都需要使用这个模块RCV_TRANSACTIONS1. 接收100单位货物,放入“待质检”货位2. 接受/拒绝3. 库存/退回有三个不同的状态!例如:接收100个,80个接受入库,20个退回,那么有80个接受事务/20个退回事物select TRANSACTION_TYPE,DESTINATION_TYPE_CODE from RCV_TRANSACTIONS可以看出以下阶段:A1.RECEIVE – RECEIVINGA2.ACCEPT – RECEIVINGA3.DELIERY – INVETORY(影响库存现有量)如果按照正常模式,最后会触发产生MTL_MATERIAL_TRANSACTIONS
销售订单
OE_ORDER_headers_allSOLD_FROM_ORG_IDSOLD_TO_ORG_ID 就是客户层SHIP_FROM_ORG_IDSHIP_TO_ORG_ID 就是客户收货层INVOICE_TO_ORG_ID 就是客户收单层DELIVER_TO_ORG_ID和客户结构有关客户 RA_customers客户Address Ra_AddressesAddress 货品抵达 site RA_SITE_USES_ALLAddress 发票抵达 siteOE_ORDER_LINEs_allGL凭证
gl_je_batches凭证日期: DEFAULT_EFFECTIVE_DATE会计期间: DEFAULT_PERIOD_NAME原币种凭证批借贷方汇总: RUNNING_TOTAL_DR/CR 比如美元本位币凭证批借贷方汇总: RUNNING_TOTAL_ACCOUNTED_DR/CRgl_je_headers日记账头信息
批号: JE_BATCH_ID会计期间: PERIOD_NAME币种: CURRENCY_CODE汇率类型: CURRENCY_CONVERSION_TYPE汇率日期: CURRENCY_CONVERSION_DATE帐套: SET_OF_BOOKS_ID 参考 GL_SETS_OF_BOOKS凭证类型: JE_CATEGORY 参考 GL_JE_SOURCES凭证来源: JE_SOURCEgl_je_lines日记账体信息
CODE_COMBINATION_ID 科目组合编号GL_BALANCES 总帐余额
PERIOD_NET_DR/CR 净值BEGIN_BALANCE_DR/CR 期初额AR应收发票
RA_CUSTOMER_TRX_ALLCUSTOMER_TRX_ID 发票编号BILL_TO_SITE_USE_ID 客户收单方编号PRIMARY_SALES_ID销售员REFERENCE是Oracle提供的外部编号输入框,但是由于版本问题和长度(<=30),不建议用户使用,如果要使用外部编号,请使用说明性弹性域RA_CUSTOMER_TRX_LINES_ALL
LINE_ID 行号INVENTORY_ITEM_ID 可以为空,比如非物料的服务,只在DESCRIPTION中出现 /税行DESCRIPTION QUANTITY_INVOICE 开票数量LINE_TYPE 行类型 (一般/税)EXTEND_PRICE 本行金额注意:税行是隐藏行,所以至少会有两行收款情况
AR_CASH_RECEIPTS_ALL(还包含了非收款信息)CASH_RECEIPT_ID 内部codeRECEIPT_NUMBER 收款号RECEIPT_DATE 收款日期AMOUNT 总额RECEIPT_TYPE 现金/杂项 Cash/MiscFUNCTIONAL_AMOUNT 本位币计量金额UI上为RECEIPTS核销关系不是一一对应,也不是一次核销100%,UI上右下方的Application 按钮AR_RECEIVABLE_APPLICATIONS_ALLAPPLIED_CUSTOMER_TRX_ID 发票编号APPLIED_CUSTOMER_TRX_LINE_ID 发票行编号STATUS APP表示核销 /UNAPP表示未核销
AMOUNT_APPLIED 匹配金额注意:红冲收款报表时间跨月的问题;必须联查 AR_CASH_RECEIPTS_ALL和 AR_CASH_RECEIPT_HISTORY_ALLAP
应付帐款(是我方人员按照供应商提供的纸张发票信息录入)UI 上的invoiceAP_INVOICES_ALL实际付款PAYMENT
AP_CHECKS_ALL核销关系 同AR,右下方的Payment 按钮
AP_INVOICE_PAYMENTS_ALL客户余额表,情况比较复杂:比如两个用户合并,应收应付差额,预付款资产信息FA_ADDITIONS
名称编号分类数量资产类别
FA_CATEGORIES资产帐簿
FA_BOOK_CONTROLS 和会计帐簿有什么关系?FA_BOOKSUI中的InquiryMothed是折旧方法(直线法/产量法)FA_DISTRIBUTION_HISTORY分配assignment,给什么部门使用多少
LOCATION_ID 部门 联查FA_LOCATIONS折旧信息(分摊方法)
FA_DEPRN_DETAILperiod_counter 折旧期间编号折旧事务(新增、重建、转移、报废)
FA_TRANSACTION_HEADERSselect fnd_profile.VALUE('ORG_ID') FROM DUAL
select * from hr_operating_units hou where hou.organization_id=204--fndselect * from fnd_application select * from fnd_application_tl where application_id=101select * from fnd_application_vl where application_id = 101----值集select * from fnd_flex_value_sets select * from fnd_flex_values select * from fnd_flex_values_vl----弹性域select * from fnd_id_flexs select * from fnd_id_flex_structures where id_flex_code='GL#'select * from fnd_id_flex_segments where id_flex_code='GL#' and id_flex_num=50671select * from fnd_profile_options_vl
select * from fnd_concurrent_programs 程序表select * from fnd_concurrent_requests 请求表select * from fnd_concurrent_processes 进程表--inv
select * from org_organization_definitions 库存组织select * from mtl_parameters 组织参数select * from mtl_system_items_b where inventory_item_id = 171 and organization_id=204 物料表select * from mtl_secondary_inventories 子库存select * from mtl_item_locations 货位select * from mtl_lot_numbers 批次select * from mtl_onhand_quantities 现有量表select * from mtl_serial_numbers 序列select * from mtl_material_transactions 物料事务记录select * from mtl_transaction_accounts 会计分录select * from mtl_transaction_types 事务类型select * from mtl_txn_source_types 事务来源类型select * from mfg_lookups ml where ml.LOOKUP_TYPE = 'MTL_TRANSACTION_ACTION'--po
select * from po_requisition_headers_all 请求头select * from po_requisition_lines_all 请求行select * from po_headers_all 订单头select * from po_lines_all 订单行select * from po_line_locations_all select * from po_distributions_all 分配select * from po_releases_all 发送select * from rcv_shipment_headers 采购接收头select * from rcv_shipment_lines 采购接收行select * from rcv_transactions 接收事务处理select * from po_agents select * from po_vendors 订单select * from po_vendor_sites_all--oe
select * from ra_customers 客户select * from ra_addresses_all 地址select * from ra_site_uses_all 用户select * from oe_order_headers_all 销售头
select * from oe_order_lines_all 销售行select * from wsh_new_deliveries 发送
select * from wsh_delivery_detailsselect * from wsh_delivery_assignments--gl
select * from gl_sets_of_books 总帐select * from gl_code_combinations gcc where gcc.summary_flag='Y' 科目组合select * from gl_balances 科目余额select * from gl_je_batches 凭证批select * from gl_je_headers 凭证头select * from gl_je_lines 凭证行select * from gl_je_categories 凭证分类select * from gl_je_sources 凭证来源select * from gl_summary_templates 科目汇总模板select * from gl_account_hierarchies 科目汇总模板层次--ar
select * from ar_batches_all 事务处理批select * from ra_customer_trx_all 发票头select * from ra_customer_trx_lines_all 发票行select * from ra_cust_trx_line_gl_dist_all 发票分配select * from ar_cash_receipts_all 收款select * from ar_receivable_applications_all 核销select * from ar_payment_schedules_all 发票调整select * from ar_adjustments_all 会计分录select * from ar_distributions_all 付款计划--ap
select * from ap_invoices_all 发票头select * from ap_invoice_distributions_all 发票行select * from ap_payment_schedules_all 付款计划select * from ap_check_stocks_all 单据select * from ap_checks_all 付款select * from ap_bank_branches 银行select * from ap_bank_accounts_all 银行帐号select * from ap_invoice_payments_all 核销售订单要经历登记、发放、挑库、交货四个主要环节,有些表在各个环节都有不同的特性,作者罗列了几个主要的常用的表,其它好象还有些货物路线、停靠之类的信息表则没有涉及。
下面是销售订单的四个主要环节和每个环节用到的常用表:
一、登记
1、oe_order_headers_all --订单头信息表
2、oe_order_lines_all
--header_id=oe_order_headers_all.header_id--订单行信息表
3、mtl_sales_orders
--segment1=oe_order_headers_all.order_number--sales_order_id=mtl_material_transaction.transaction_source_id--记录订单编号的信息表
4、wsh_delivery_details
--source_header_id=oe_order_headers_all.header_id--source_line_id=oe_order_lines_all.line_id--记录订单的物料的发运明细信息,该表的记录在此阶段状态为R(Ready to release: 'R'means "ready to release")
5、wsh_delivery_assignments
--delivery_detail_id=wsh_delivery_details.delivery_detail_id--连接wsh_delivery_details和wsh_new_deliveries的信息表--此阶段连接wsh_delivery_details
二、发放
1、wsh_delivery_details
--该表的记录在此阶段状态为S(Released to Warehouse: 'S' means "submitted for release" )
2、wsh_new_deliveries
--source_header_id=oe_order_headers_all.header_id--记录订单的交货信息表,此阶段为OP(Delivery is Open, has not been shipped)
3、wsh_delivery_assignments
--delivery_id=wsh_new_deliveries.delivery_id--连接wsh_delivery_details和wsh_new_deliveries的信息表--此阶段连接wsh_new_deliveries
4、wsh_picking_batches
--order_header_id=oe_order_headers_all.header_id--记录订单的发放的信息表
三、挑库
1、wsh_delivery_details
--该表的记录在此阶段状态为Y(Staged)。如果启用了序列号,记录会按单个序列号拆分
2、mtl_material_transactions
--transaction_source_id=mtl_sales_orders.sales_order_id--trx_source_line_id=oe_order_lines_all.line_id--记录“销售订单挑库”阶段物料的存放位置发生变化的信息
3、mtl_onhand_quantities
--记录物料的现有数量信息表
4、mtl_transaction_lot_numbers
--transaction_id=mtl_material_transactions.transaction_id--lot_number=mtl_onhand_quantities.lot_number--记录物料的存放位置发生变化的所产生的批次信息表
5、mtl_serial_numbers
--last_txn_source_id=mtl_material_transactions.transaction_source_id--记录物料序列号的当前状态的信息表
四、交货
1、wsh_delivery_details
--该表的记录在此阶段状态为C(Shipped)
2、wsh_new_deliveries
--该表的记录在此阶段为CL(Delivery has arrived at the destination)
3、mtl_material_transactions
--记录“销售订单发放”阶段物料的存放位置发生变化的信息--如果启用了序列号,记录会按单个序列号拆分
在后台完成workflow后,数据将导入RA的接口表
RA_INTERFACE_LINES_ALLRA_INTERFACE_SALESCREDITS_ALL当数据导入后,运行自动开票,数据将导入以下各表RA_CUSTOMER_TRXRA_CUSTOMER_TRX_LINESAR_PAYMENT_SCHEDULES
(五)oracle OM在以下2层中支持开票进程
1.订单头层级的开票:即将整个订单数据倒入结果,或返还AR2.订单行层级的开票:即将订单行中的数据倒入结果,或返还AR
(六)自动开票
Navigation: Interface-> Run AutoinvoiceProgram : Autoinvoice Master ProgramInterface Table: RA_INTERFACE_LINES_ALL
Error Table: RA_INTERFACE_ERRORS_ALLBase Tables: RA_BATCHES_ALLRA_CUSTOMER_TRX_ALLRA_CUSTOMER_TRX_LINES_ALLOE_ORDER_HEADERS_ALL.ORDER_NUMBER =RA_CUSTOMER_TRX_ALL.INTERFACE_HEADER_ATTRIBUTE1
下面所列举的是通过自动开票将OM中的相关引用传递到AR的字段Number Name Column
1 Order Number INTERFACE_LINE_ATTRIBUTE12 Order Type INTERFACE_LINE_ATTRIBUTE23 Delivery INTERFACE_LINE_ATTRIBUTE34 Waybill INTERFACE_LINE_ATTRIBUTE45 Count INTERFACE_LINE_ATTRIBUTE56 Line ID INTERFACE_LINE_ATTRIBUTE67 Picking Line ID INTERFACE_LINE_ATTRIBUTE78 Bill of Lading INTERFACE_LINE_ATTRIBUTE89 Customer Item Part INTERFACE_LINE_ATTRIBUTE910 Warehouse INTERFACE_LINE_ATTRIBUTE1011 Price Adjustment ID INTERFACE_LINE_ATTRIBUTE1112 Shipment Number INTERFACE_LINE_ATTRIBUTE1213 Option Number INTERFACE_LINE_ATTRIBUTE1314 Service Number INTERFACE_LINE_ATTRIBUTE14发票分组规则(Invoice Grouping Rules )
Menu: Navigation > Setup > Transactions > Autoinvoice > Grouping RuleAutoinvoice uses grouping rules to group lines to create one transaction.
1 接口表:
a)OE_HEADERS_IFACE_ALL:此表为多组织表,用于将销售订单头插入开放接口。该表存储来自于其他子系统需要导入OM模块的订单头信息,该表导入时必须输入的字段/条件:ORDER_SOURCE_ID : Order source id 可选ORIG_SYS_DOCUMENT_REF: Original system document reference 必须ORDER_SOURCE : Order source 可选OPERATION_CODE : Operation code 必须ORDER_TYPE_ID : Order type id 可选ORDER_TYPE : Order type 可选RETURN_REASON_CODE : Return reason code 仅用于订单退回SALESREP_ID : Salesrep idPRICE_LIST_ID : Price list id 用于已经booking的订单PRICE_LIST : Price list 用于已经booking的订单example:insert into oe_headers_iface_all(ORDER_SOURCE_ID,orig_sys_document_ref,ORG_ID,order_type_id,PRICE_LIST_ID,TRANSACTIONAL_CURR_CODE,SOLD_TO_ORG_ID,SHIP_TO_ORG_ID,created_by,creation_date,last_updated_by,last_update_date,operation_code)select ooha.order_source_id,ooha.orig_sys_document_ref,ooha.org_id,ooha.order_type_id,ooha.price_list_id,ooha.TRANSACTIONAL_CURR_CODE,ooha.SOLD_TO_ORG_ID,ooha.SHIP_TO_ORG_ID,ooha.created_by,ooha.creation_date,fnd_global.user_id,sysdate,p_operation_codefrom oe_order_headers_all oohawhere order_number=p_order_number;
b)OE_LINES_IFACE_ALL此表为多组织表,用于将销售订单行插入开放接口。
该表存储来自于其他子系统需要导入OM模块的订单行信息,该表导入时必须输入的字段/条件:ORDER_SOURCE_ID : Order source id 必须ORIG_SYS_DOCUMENT_REF : Original system document reference 必须ORIG_SYS_LINE_REF : Original system line reference 必须ORIG_SYS_SHIPMENT_REF : Original system shipment reference 必须INVENTORY_ITEM : Inventory Item 必须INVENTORY_ITEM_ID : Inventory Item ID 可选TOP_MODEL_LINE_REF : Top model line reference 可选LINK_TO_LINE_REF : Link to line reference 可选REQUEST_DATE : Request Date 必须DELIVERY_LEAD_TIME : Delivery lead time 必须DELIVERY_ID : Delivery id 必须ORDERED_QUANTITY : Ordered quantity 必须ORDER_QUANTITY_UOM : Order quantity uom 必须SHIPPING_QUANTITY : Quantity which has been shipped by Shipping in Shipping UOM. 可选SHIPPING_QUANTITY_UOM : The UOM for Shipping Quantity 可选SHIPPED_QUANTITY : Shipped quantity 可选CANCELLED_QUANTITYFULFILLED_QUANTITY : The fulfilled quantity for the line可选PRICING_QUANTITY : Pricing quantity 可选PRICING_QUANTITY_UOM : Pricing quantity uom 可选example:insert into OE_LINES_IFACE_ALL( ORDER_SOURCE_ID ,ORIG_SYS_DOCUMENT_REF,ORIG_SYS_LINE_REF ,ORIG_SYS_SHIPMENT_REF ,org_id ,line_number,line_type_id ,item_type_code ,INVENTORY_ITEM_ID ,source_type_code ,price_list_id ,sold_to_org_id ,sold_from_org_id ,ship_to_org_id,ship_from_org_id ,operation_code ,ORDERED_QUANTITY ,ORDER_QUANTITY_UOM ,CREATED_BY ,CREATION_DATE ,LAST_UPDATED_BY ,LAST_UPDATE_DATE ,LAST_UPDATE_LOGIN )values(l_line_tbl(j).order_source_id,l_line_tbl(j).orig_sys_document_ref,l_line_tbl(j).orig_sys_line_ref ,l_line_tbl(j).orig_sys_shipment_ref,l_line_tbl(j).org_id,l_line_tbl(j).line_number,l_line_tbl(j).line_type_id,l_line_tbl(j).item_type_code,p_new_item,l_line_tbl(j).source_type_code ,l_line_tbl(j).price_list_id,l_line_tbl(j).sold_to_org_id,l_line_tbl(j).sold_from_org_id,l_line_tbl(j).ship_to_org_id,l_line_tbl(j).ship_from_org_id ,p_operation_code,l_line_tbl(j).ordered_quantity ,l_line_tbl(j).order_quantity_uom,l_line_tbl(j).Created_By , l_line_tbl(j).creation_date ,fnd_global.USER_ID ,sysdate ,fnd_global.user_id);
c)OE_PRICE_ADJS_IFACE_ALL
d)导入接口的API: OE_ORDER_PUB常用过程:(1)OE_ORDER_PUB.Process_Order:提供创建,修改,删除订单实体的操作,该方法通过记录集或者外部的请求,同样适用于对订单的其他操作,(2)OE_ORDER_PUB.Get_Order :返回单个订单对象的所有记录(3)OE_ORDER_PUB.Lock_Order :锁定订单对象.可以使用get_order 来获取记录可以调用lock_order锁定该记录
e)记录error信息
OE_PROCESSING_MSGSOE_PROCESSING_MSGS_TLf)销售订单要经历登记、发放、挑库、交货四个主要环节,有些表在各个环节都有不同的特性,几个主要的常用的表,其它好象还有些货物路线、停靠之类的信息表没有深究,就不列罗。1.日期时间间隔操作 当前时间减去7分钟的时间select sysdate,sysdate - interval '7' MINUTE from dual当前时间减去7小时的时间select sysdate - interval '7' hour from dual当前时间减去7天的时间select sysdate - interval '7' day from dual当前时间减去7月的时间select sysdate,sysdate - interval '7' month from dual当前时间减去7年的时间select sysdate,sysdate - interval '7' year from dual时间间隔乘以一个数字select sysdate,sysdate - 8 *interval '2' hour from dual2.日期到字符操作 select sysdate,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dualselect sysdate,to_char(sysdate,'yyyy-mm-dd hh:mi:ss') from dualselect sysdate,to_char(sysdate,'yyyy-ddd hh:mi:ss') from dualselect sysdate,to_char(sysdate,'yyyy-mm iw-d hh:mi:ss') from dual参考oracle的相关关文档(ORACLE901DOC/SERVER.901/A90125/SQL_ELEMENTS4.HTM#48515)3. 字符到日期操作select to_date('2003-10-17 21:15:37','yyyy-mm-dd hh24:mi:ss') from dual具体用法和上面的to_char差不多。4. trunk/ ROUND函数的使用 select trunc(sysdate ,'YEAR') from dualselect trunc(sysdate ) from dualselect to_char(trunc(sysdate ,'YYYY'),'YYYY') from dual;
请购单头信息
PO_REQUISITION_HEADERS_ALL
请购单行信息
PO_REQUISITION_LINES_ALL
请购单分配行
Po_Req_Distributions_All
采购订单头表
po_headers_all
采购订单行表
po_lines_all
采购订单行的发送表
po_line_locations_all
采购订单发送行的分配表
po_distributions_all
Incomplete,In-process,approved,pre-approved
Incomplete 是当PR/PO创建但还没有提交Approve 时的状态此种状态的PR/PO可以删除In-process 是当PR/PO创建并且已经提交approve ,但是主管还没有approve,此时pr/po的状态为In-process , 此种状态的pr/po只能cancel,而不能删除approved 是主管已经审批,也就是说这个PR/PO已经被approved,pre-approved 是主管没有足够的权限进行审批,或者此单据已经失效(限于Release)employee job 是设置主管的,也就是审批权限的,如果为空,就是没有权限审批此PR/PO