1.列出没有销售订单的内部采购订单


---used to list all Internal Requisitions that do not have an  associated Internal Sales order
Select RQH.SEGMENT1 REQ_NUM,
RQL.LINE_NUM,
RQL.REQUISITION_HEADER_ID ,
RQL.REQUISITION_LINE_ID,
RQL.ITEM_ID ,
RQL.UNIT_MEAS_LOOKUP_CODE ,
RQL.UNIT_PRICE ,
RQL.QUANTITY ,
RQL.QUANTITY_CANCELLED,
RQL.QUANTITY_DELIVERED ,
RQL.CANCEL_FLAG ,
RQL.SOURCE_TYPE_CODE ,
RQL.SOURCE_ORGANIZATION_ID ,
RQL.DESTINATION_ORGANIZATION_ID,
RQH.TRANSFERRED_TO_OE_FLAG
from
PO_REQUISITION_LINES_ALL RQL, PO_REQUISITION_HEADERS_ALL RQH
where
RQL.REQUISITION_HEADER_ID = RQH.REQUISITION_HEADER_ID
and RQL.SOURCE_TYPE_CODE = 'INVENTORY'
and RQL.SOURCE_ORGANIZATION_ID is not null
and not exists (select 'existing internal order'
from OE_ORDER_LINES_ALL LIN
where LIN.SOURCE_DOCUMENT_LINE_ID = RQL.REQUISITION_LINE_ID
and LIN.SOURCE_DOCUMENT_TYPE_ID = 10)
orDER BY RQH.REQUISITION_HEADER_ID, RQL.LINE_NUM;

2.关联PR的PO


-----Relation with Requistion and PO
select r.segment1 "Req Num",
       p.segment1 "PO Num"
from po_headers_all p, 
po_distributions_all d,
po_req_distributions_all rd, 
po_requisition_lines_all rl,
po_requisition_headers_all r 
where p.po_header_id = d.po_header_id 
and d.req_distribution_id = rd.distribution_id 
and rd.requisition_line_id = rl.requisition_line_id 
and rl.requisition_header_id = r.requisition_header_id

3.所有取消的PR


-----list My cancel Requistion
select prh.REQUISITION_HEADER_ID,
      prh.PREPARER_ID ,
      prh.SEGMENT1 "REQ NUM",
      trunc(prh.CREATION_DATE),
      prh.DESCRIPTION,
      prh.NOTE_TO_AUTHORIZER
from apps.Po_Requisition_headers_all prh,
     apps.po_action_history pah 
where Action_code='CANCEL' 
and pah.object_type_code='REQUISITION' 
and pah.object_id=prh.REQUISITION_HEADER_ID

4.没有PO的Pr


-----list all Purchase Requisition without a Purchase order that means  a PR has not been autocreated to PO.
  select 
  prh.segment1 "PR NUM", 
  trunc(prh.creation_date) "CreateD ON", 
  trunc(prl.creation_date) "Line Creation Date" ,
  prl.line_num "Seq #", 
  msi.segment1 "Item Num", 
  prl.item_description "Description", 
  prl.quantity "Qty", 
  trunc(prl.need_by_date) "Required By", 
  ppf1.full_name "REQUESTOR", 
  ppf2.agent_name "BUYER" 
  from 
  po.po_requisition_headers_all prh, 
  po.po_requisition_lines_all prl, 
  apps.per_people_f ppf1, 
  (select distinct agent_id,agent_name from apps.po_agents_v ) ppf2, 
  po.po_req_distributions_all prd, 
  inv.mtl_system_items_b msi, 
  po.po_line_locations_all pll, 
  po.po_lines_all pl, 
  po.po_headers_all ph 
  Where 
  prh.requisition_header_id = prl.requisition_header_id 
  and prl.requisition_line_id = prd.requisition_line_id 
  and ppf1.person_id = prh.preparer_id 
  and prh.creation_date between ppf1.effective_start_date and ppf1.effective_end_date 
  and ppf2.agent_id(+) = msi.buyer_id 
  and msi.inventory_item_id = prl.item_id 
  and msi.organization_id = prl.destination_organization_id 
  and pll.line_location_id(+) = prl.line_location_id 
  and pll.po_header_id = ph.po_header_id(+) 
  AND PLL.PO_LINE_ID = PL.PO_LINE_ID(+) 
  AND PRH.AUTHORIZATION_STATUS = 'APPROVED' 
  AND PLL.LINE_LOCATION_ID IS NULL 
  AND PRL.CLOSED_CODE IS NULL 
  AND NVL(PRL.CANCEL_FLAG,'N') <> 'Y'
  orDER BY 1,2

5.在PR转PO过程中的(应该是自动创建里面的数据吧)


----- List and all data entry from PR till PO

select distinct u.description "Requestor", 
porh.segment1 as "Req Number", 
trunc(porh.Creation_Date) "Created On", 
pord.LAST_UpdateD_BY, 
porh.Authorization_Status "Status", 
porh.Description "Description", 
poh.segment1 "PO Number", 
trunc(poh.Creation_date) "PO Creation Date", 
poh.AUTHORIZATION_STATUS "PO Status", 
trunc(poh.Approved_Date) "Approved Date"
from apps.po_headers_all poh, 
apps.po_distributions_all pod, 
apps.po_req_distributions_all pord, 
apps.po_requisition_lines_all porl, 
apps.po_requisition_headers_all porh, 
apps.fnd_user u 
where porh.requisition_header_id = porl.requisition_header_id 
and porl.requisition_line_id = pord.requisition_line_id 
and pord.distribution_id = pod.req_distribution_id(+) 
and pod.po_header_id = poh.po_header_id(+) 
and porh.created_by = u.user_id
order by 2

6.没有自动创建PO成功的PR

-----list all Purchase Requisition without a Purchase order that means  a PR has not been autocreated to PO.
  select 
  prh.segment1 "PR NUM", 
  trunc(prh.creation_date) "CreateD ON", 
  trunc(prl.creation_date) "Line Creation Date" ,
  prl.line_num "Seq #", 
  msi.segment1 "Item Num", 
  prl.item_description "Description", 
  prl.quantity "Qty", 
  trunc(prl.need_by_date) "Required By", 
  ppf1.full_name "REQUESTOR", 
  ppf2.agent_name "BUYER" 
  from 
  po.po_requisition_headers_all prh, 
  po.po_requisition_lines_all prl, 
  apps.per_people_f ppf1, 
  (select distinct agent_id,agent_name from apps.po_agents_v ) ppf2, 
  po.po_req_distributions_all prd, 
  inv.mtl_system_items_b msi, 
  po.po_line_locations_all pll, 
  po.po_lines_all pl, 
  po.po_headers_all ph 
  Where 
  prh.requisition_header_id = prl.requisition_header_id 
  and prl.requisition_line_id = prd.requisition_line_id 
  and ppf1.person_id = prh.preparer_id 
  and prh.creation_date between ppf1.effective_start_date and ppf1.effective_end_date 
  and ppf2.agent_id(+) = msi.buyer_id 
  and msi.inventory_item_id = prl.item_id 
  and msi.organization_id = prl.destination_organization_id 
  and pll.line_location_id(+) = prl.line_location_id 
  and pll.po_header_id = ph.po_header_id(+) 
  AND PLL.PO_LINE_ID = PL.PO_LINE_ID(+) 
  AND PRH.AUTHORIZATION_STATUS = 'APPROVED' 
  AND PLL.LINE_LOCATION_ID IS NULL 
  AND PRL.CLOSED_CODE IS NULL 
  AND NVL(PRL.CANCEL_FLAG,'N') <> 'Y'
  orDER BY 1,2

7.PR与PO的关联表

PO_DISTRIBUTIONS_ALL =>PO_HEADER_ID, REQ_DISTRIBUTION_ID
PO_HEADERS_ALL=>PO_HEADER_ID, SEGMENT1
PO_REQ_DISTRIBUTIONS_ALL =>DISTRIBUTION_ID, REQUISITION_LINE_ID
PO_REQUISITION_LINES_ALL =>REQUISITION_LINE_ID)
PO_REQUISITION_HEADERS_ALL =>REQUISITION_HEADER_ID, REQUISITION_LINE_ID, SEGMENT1

What you have to make a join on PO_DISTRIBUTIONS_ALL (REQ_DISTRIBUTION_ID) and PO_REQ_DISTRIBUTIONS_ALL (DISTRIBUTION_ID) to see if there is a PO for the req.

你要做的就是将PO_DISTRIBUTIONS_ALL的REQ_DISTRIBUTION_ID与PO_REQ_DISTRIBUTIONS_ALL中的DISTRIBUTION_ID关联,查看看PR是否有对应的PO

8.未结PO


----- List all open PO'S
select 
h.segment1 "PO NUM", 
h.authorization_status "STATUS", 
l.line_num "SEQ NUM", 
ll.line_location_id, 
d.po_distribution_id , 
h.type_lookup_code "TYPE" 
from 
po.po_headers_all h, 
po.po_lines_all l, 
po.po_line_locations_all ll, 
po.po_distributions_all d 
where h.po_header_id = l.po_header_id 
and ll.po_line_id = l.po_Line_id 
and ll.line_location_id = d.line_location_id 
and h.closed_date is null 
and h.type_lookup_code not in ('QUOTATION')

9.List and PO With there approval , invoice and payment details


----- List and PO With there approval , invoice and payment details
select 
a.org_id "ORG ID", 
E.SEGMENT1 "VENDOR NUM",
e.vendor_name "SUPPLIER NAME",
UPPER(e.vendor_type_lookup_code) "VENDOR TYPE", 
f.vendor_site_code "VENDOR SITE CODE",
f.ADDRESS_LINE1 "ADDRESS",
f.city "CITY",
f.country "COUNTRY", 
to_char(trunc(d.CREATION_DATE)) "PO Date", 
d.segment1 "PO NUM",
d.type_lookup_code "PO Type", 
c.quantity_ordered "QTY orDERED", 
c.quantity_cancelled "QTY CANCELLED", 
g.item_id "ITEM ID" , 
g.item_description "ITEM DESCRIPTION",
g.unit_price "UNIT PRICE", 
(NVL(c.quantity_ordered,0)-NVL(c.quantity_cancelled,0))*NVL(g.unit_price,0) "PO Line Amount", 
(select 
decode(ph.approved_FLAG, 'Y', 'Approved') 
from po.po_headers_all ph 
where ph.po_header_ID = d.po_header_id)"PO Approved?", 
a.invoice_type_lookup_code "INVOICE TYPE",
a.invoice_amount "INVOICE AMOUNT", 
to_char(trunc(a.INVOICE_DATE)) "INVOICE DATE", 
a.invoice_num "INVOICE NUMBER", 
(select 
decode(x.MATCH_STATUS_FLAG, 'A', 'Approved') 
from ap.ap_invoice_distributions_all x 
where x.INVOICE_DISTRIBUTION_ID = b.invoice_distribution_id)"Invoice Approved?", 
a.amount_paid,
h.amount, 
h.check_id, 
h.invoice_payment_id "Payment Id", 
i.check_number "Cheque Number", 
to_char(trunc(i.check_DATE)) "PAYMENT DATE"

FROM AP.AP_INVOICES_ALL A, 
AP.AP_INVOICE_DISTRIBUTIONS_ALL B, 
PO.PO_DISTRIBUTIONS_ALL C, 
PO.PO_HEADERS_ALL D, 
PO.PO_VENDORS E, 
PO.PO_VENDOR_SITES_ALL F, 
PO.PO_LINES_ALL G, 
AP.AP_INVOICE_PAYMENTS_ALL H, 
AP.AP_CHECKS_ALL I 
where a.invoice_id = b.invoice_id 
and b.po_distribution_id = c. po_distribution_id (+) 
and c.po_header_id = d.po_header_id (+) 
and e.vendor_id (+) = d.VENDOR_ID 
and f.vendor_site_id (+) = d.vendor_site_id 
and d.po_header_id = g.po_header_id 
and c.po_line_id = g.po_line_id 
and a.invoice_id = h.invoice_id 
and h.check_id = i.check_id 
and f.vendor_site_id = i.vendor_site_id 
and c.PO_HEADER_ID is not null 
and a.payment_status_flag = 'Y' 
and d.type_lookup_code != 'BLANKET'

Oracle EBS:PO 常用的查询及Tips相关推荐

  1. oracle 删除po查询,Oracle EBS:PO 常用的查询及Tips

    1.列出没有销售订单的内部采购订单 ---used to list all Internal Requisitions that do not have an  associated Internal ...

  2. oracle po订单变更,Oracle EBS PO 采购订单接口 创建后 点击发运后 未修改任何数据 需要保存...

    Oracle EBS PO 采购订单接口 创建后 点击发运后 未修改任何数据 需要保存 现象: Oracle EBS PO 采购订单接口创建的订单 点击发运后 未修改任何数据 需要保存 测试环境: O ...

  3. 【转】 Oracle EBS PO问题杂记

    [转] Oracle EBS PO问题杂记 Oracle EBS PO问题杂记 1.PR订单拒绝后不能删除明细行,PO单拒绝后可以删除明细行.PR单取消是会整张取消退回,所以要尽量避免这种现象. 2. ...

  4. 银行使用oracle做查询,Oracle EBS ERP银行信息查询视图

    Oracle EBS ERP银行信息查询视图 CREATE OR REPLACE VIEW XXX_STD_CE_BANKINFO_V AS SELECT cbau.org_id, cba.accou ...

  5. 转:oracle ebs po模块一揽子采购协议小结

    转自:http://yedward.net/?id=193 oracle ebs po模块一揽子采购协议小结 本文总结oracle ebs 采购订单(po)模块一揽子采购协议的相关知识,总结如下: 1 ...

  6. Oracle ebs ap表结构,oracle,ebs,r12,常用表表结构总结之ap.docx

    oracle,ebs,r12,常用表表结构总结之ap EBSR12install(ap/db在同一台机器) ip: os:redhatlinuxx64 [root@siotest1ftptest]#l ...

  7. Oracle EBS PO调用API修改一揽子发放行需求日期或数量引发单价变更

    背景:         最近,客户的用户反映批量修改或拆分一揽子发放行的需求日期或承诺日期或数量时,自动修改该发放行的单价为对应PBA行的单价. 解决方法:         通过实际数据分析.参考官方 ...

  8. oracle 基本命令及常用的查询语句

    1.create user username identified by password;//建用户名和密码oracle ,oracle  2.grant connect,resource,dba ...

  9. Oracle EBS:PO入库(收货)价格不随Blanket更改

    这个可真是差点出了大麻烦啊,呵呵. 事故描述: 1月下交期,2月调价,1月所下的PO没有交完货的情况下,在原PO上作更改PO交期.结果没想到的是:系统在入库时点会PO的价格重新获取差刷新一次,导致系统 ...

最新文章

  1. 大数据文件的批量写入方式
  2. 目标检测--Beyond Skip Connections: Top-Down Modulation for Object Detection
  3. 手术革命:这三家公司如何用AR技术辅助医疗手术
  4. linux内核编译 menuconfig详解,Linux内核编译menuconfig介绍
  5. gogs可以自动化部署吗_Git-WebHook 自动化部署工具 - 支持Github / GitLab / Gogs / GitOsc...
  6. 如何在SAP Spartacus的scss里引入全局变量
  7. spss三次指数平滑_17 统计学:SPSS基础
  8. IP地址子网的划分机制
  9. devops 三十六计_DevOps从业人员应遵循的16个博客和新闻通讯
  10. Spring Boot/Cloud 背后豪华的研发团队
  11. java textarea 自动滚动条_月光软件站 - 编程文档 - Java - 如何实现滚动条的自动滚动到textarea的末尾...
  12. ODIN SNN处理器
  13. Linux初级入门百篇--lsof工具
  14. 鸽群优化算法(Pigeon-inspired Optimization algorithm, PIO)附matlab代码
  15. android 股票行情走势图K线控件 KLineView
  16. 怎样解决ABBYY FineReader 12识别字体字符错误
  17. 苹果设置显示连接到服务器,iPhone升级更新至iOS9后显示连接到iCloud服务器错误现象的解决办法...
  18. 图片文件压缩并上传至阿里云OSS
  19. 关于ASCII()函数
  20. 基于MATLAB的远程声控小车的系统设计与仿真

热门文章

  1. 【Cprimerplus_03】算术运算符、关系运算符、逻辑运算符
  2. Nexus6P解锁、刷机等相关教程
  3. 多国语音文件制作网站
  4. mysql实现线性插值法_线性插值法
  5. 【Java】7-23 币值转换 (20 分)
  6. 计算机无法注册打印机,无法安装打印机操作无法完成错误 0x000003eb 的解决方法...
  7. 速卖通需要shua单吗?shua单能给卖家带来什么好处?
  8. TOM企业邮箱|新人在公司不知道企业邮箱怎么登陆
  9. 5G中DMRS的设计特点
  10. mhtml转html c,生成MHTML要点