cari
Rumahpangkalan datatutorial mysqlOracle EBS:PO 常用的查询及Tips

原文:PO: Tips and useful Query 作者:Sanjit Anand 来源:http://www.oracleappshub.com/oracle-purchasing/po-tips-and-useful-query/ http://www.dezai.cn/blog/article.asp?id=304 1.列出没有销售订单的内部采购订单 —used to list all Internal Requisi

原文:PO: Tips and useful Query
作者:Sanjit Anand
来源:http://www.oracleappshub.com/oracle-purchasing/po-tips-and-useful-query/

http://www.dezai.cn/blog/article.asp?id=304

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’

Kenyataan
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Bagaimanakah pelesenan MySQL berbanding dengan sistem pangkalan data lain?Bagaimanakah pelesenan MySQL berbanding dengan sistem pangkalan data lain?Apr 25, 2025 am 12:26 AM

MySQL menggunakan lesen GPL. 1) Lesen GPL membolehkan penggunaan percuma, pengubahsuaian dan pengedaran MySQL, tetapi taburan yang diubah suai mesti mematuhi GPL. 2) Lesen komersial boleh mengelakkan pengubahsuaian awam dan sesuai untuk aplikasi komersil yang memerlukan kerahsiaan.

Bilakah anda memilih InnoDB atas myisam, dan sebaliknya?Bilakah anda memilih InnoDB atas myisam, dan sebaliknya?Apr 25, 2025 am 12:22 AM

Keadaan ketika memilih innoDB dan bukannya myisam termasuk: 1) sokongan transaksi, 2) persekitaran konkurensi tinggi, 3) konsistensi data yang tinggi; Sebaliknya, keadaan apabila memilih myisam termasuk: 1) terutamanya membaca operasi, 2) Tiada sokongan transaksi diperlukan. InnoDB sesuai untuk aplikasi yang memerlukan konsistensi data yang tinggi dan pemprosesan urus niaga, seperti platform e-dagang, manakala MyISAM sesuai untuk aplikasi bacaan dan bebas transaksi seperti sistem blog.

Terangkan tujuan kunci asing di MySQL.Terangkan tujuan kunci asing di MySQL.Apr 25, 2025 am 12:17 AM

Di MySQL, fungsi kunci asing adalah untuk mewujudkan hubungan antara jadual dan memastikan konsistensi dan integriti data. Kekunci asing mengekalkan keberkesanan data melalui pemeriksaan integriti rujukan dan operasi cascading. Perhatikan pengoptimuman prestasi dan elakkan kesilapan biasa apabila menggunakannya.

Apakah jenis indeks yang berbeza di MySQL?Apakah jenis indeks yang berbeza di MySQL?Apr 25, 2025 am 12:12 AM

Terdapat empat jenis indeks utama dalam MySQL: Indeks B-Tree, Indeks Hash, Indeks Teks Penuh dan Indeks Spatial. 1. B-Tree Index sesuai untuk pertanyaan, penyortiran dan pengelompokan, dan sesuai untuk penciptaan pada lajur Nama Jadual Pekerja. 2. Indeks hash sesuai untuk pertanyaan yang setara dan sesuai untuk penciptaan pada lajur ID jadual hash_table enjin penyimpanan memori. 3. Indeks teks penuh digunakan untuk carian teks, sesuai untuk penciptaan pada lajur kandungan jadual artikel. 4. Indeks spatial digunakan untuk pertanyaan geospatial, sesuai untuk penciptaan pada lajur geom jadual lokasi.

Bagaimana anda membuat indeks di MySQL?Bagaimana anda membuat indeks di MySQL?Apr 25, 2025 am 12:06 AM

TOCREATEANINDEXINMYSQL, USETHECreateIndexStatement.1) forasingLecolumn, gunakan "createIndexidx_lastNameonemployees (lastName);" 2) foracompositeIndex, gunakan "createindexidx_nameonemployees (lastName, firstName)

Bagaimanakah MySQL berbeza dari SQLite?Bagaimanakah MySQL berbeza dari SQLite?Apr 24, 2025 am 12:12 AM

Perbezaan utama antara MySQL dan SQLite adalah konsep reka bentuk dan senario penggunaan: 1. MySQL sesuai untuk aplikasi besar dan penyelesaian peringkat perusahaan, menyokong prestasi tinggi dan kesesuaian yang tinggi; 2. SQLITE sesuai untuk aplikasi mudah alih dan perisian desktop, ringan dan mudah dibenamkan.

Apakah indeks di MySQL, dan bagaimana mereka meningkatkan prestasi?Apakah indeks di MySQL, dan bagaimana mereka meningkatkan prestasi?Apr 24, 2025 am 12:09 AM

Indeks dalam MySQL adalah struktur yang diperintahkan satu atau lebih lajur dalam jadual pangkalan data, yang digunakan untuk mempercepat pengambilan data. 1) Indeks meningkatkan kelajuan pertanyaan dengan mengurangkan jumlah data yang diimbas. 2) Indeks B-Tree menggunakan struktur pokok yang seimbang, yang sesuai untuk pertanyaan dan penyortiran pelbagai. 3) Gunakan pernyataan createIndex untuk membuat indeks, seperti createIndexidx_customer_idonorders (customer_id). 4) Indeks komposit boleh mengoptimumkan pertanyaan berbilang lajur, seperti createIndexidx_customer_orderonorders (customer_id, order_date). 5) Gunakan Jelaskan untuk menganalisis rancangan pertanyaan dan elakkan

Terangkan cara menggunakan transaksi di MySQL untuk memastikan konsistensi data.Terangkan cara menggunakan transaksi di MySQL untuk memastikan konsistensi data.Apr 24, 2025 am 12:09 AM

Menggunakan transaksi dalam MySQL memastikan konsistensi data. 1) Mulakan transaksi melalui starttransaction, dan kemudian laksanakan operasi SQL dan serahkannya dengan komit atau rollback. 2) Gunakan SavePoint untuk menetapkan titik simpan untuk membolehkan rollback separa. 3) Cadangan Pengoptimuman Prestasi termasuk memendekkan masa urus niaga, mengelakkan pertanyaan berskala besar dan menggunakan tahap pengasingan yang munasabah.

See all articles

Alat AI Hot

Undresser.AI Undress

Undresser.AI Undress

Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover

AI Clothes Remover

Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Undress AI Tool

Undress AI Tool

Gambar buka pakaian secara percuma

Clothoff.io

Clothoff.io

Penyingkiran pakaian AI

Video Face Swap

Video Face Swap

Tukar muka dalam mana-mana video dengan mudah menggunakan alat tukar muka AI percuma kami!

Alat panas

SecLists

SecLists

SecLists ialah rakan penguji keselamatan muktamad. Ia ialah koleksi pelbagai jenis senarai yang kerap digunakan semasa penilaian keselamatan, semuanya di satu tempat. SecLists membantu menjadikan ujian keselamatan lebih cekap dan produktif dengan menyediakan semua senarai yang mungkin diperlukan oleh penguji keselamatan dengan mudah. Jenis senarai termasuk nama pengguna, kata laluan, URL, muatan kabur, corak data sensitif, cangkerang web dan banyak lagi. Penguji hanya boleh menarik repositori ini ke mesin ujian baharu dan dia akan mempunyai akses kepada setiap jenis senarai yang dia perlukan.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Persekitaran pembangunan bersepadu PHP yang berkuasa

Hantar Studio 13.0.1

Hantar Studio 13.0.1

Persekitaran pembangunan bersepadu PHP yang berkuasa

MinGW - GNU Minimalis untuk Windows

MinGW - GNU Minimalis untuk Windows

Projek ini dalam proses untuk dipindahkan ke osdn.net/projects/mingw, anda boleh terus mengikuti kami di sana. MinGW: Port Windows asli bagi GNU Compiler Collection (GCC), perpustakaan import yang boleh diedarkan secara bebas dan fail pengepala untuk membina aplikasi Windows asli termasuk sambungan kepada masa jalan MSVC untuk menyokong fungsi C99. Semua perisian MinGW boleh dijalankan pada platform Windows 64-bit.

Versi Mac WebStorm

Versi Mac WebStorm

Alat pembangunan JavaScript yang berguna