PO Related SQL
PO Related SQL
Sales order
2. Select RQH.SEGMENT1 REQ_NUM,
3. RQL.LINE_NUM,
4. RQL.REQUISITION_HEADER_ID ,
5. RQL.REQUISITION_LINE_ID,
6. RQL.ITEM_ID ,
7. RQL.UNIT_MEAS_LOOKUP_CODE ,
8. RQL.UNIT_PRICE ,
9. RQL.QUANTITY ,
10. RQL.QUANTITY_CANCELLED,
11. RQL.QUANTITY_DELIVERED ,
12. RQL.CANCEL_FLAG ,
13. RQL.SOURCE_TYPE_CODE ,
14. RQL.SOURCE_ORGANIZATION_ID ,
15. RQL.DESTINATION_ORGANIZATION_ID,
16. RQH.TRANSFERRED_TO_OE_FLAG
17. from
18. PO_REQUISITION_LINES_ALL RQL, PO_REQUISITION_HEADERS_ALL RQH
19. where
20. RQL.REQUISITION_HEADER_ID = RQH.REQUISITION_HEADER_ID
21. and RQL.SOURCE_TYPE_CODE = 'INVENTORY'
22. and RQL.SOURCE_ORGANIZATION_ID is not null
23. and not exists (select 'existing internal order'
24. from OE_ORDER_LINES_ALL LIN
25. where LIN.SOURCE_DOCUMENT_LINE_ID = RQL.REQUISITION_LINE_ID
26. and LIN.SOURCE_DOCUMENT_TYPE_ID = 10)
27. ORDER BY RQH.REQUISITION_HEADER_ID, RQL.LINE_NUM;
2. You want to display what requisition and PO are linked(Relation with Requisition
and PO )
8.You need to know the link to GL_JE_LINES table for purchasing accrual and
budgetary control actions..
The budgetary (encumbrance) and accrual actions in the purchasing module generate
records that will be imported into GL for the corresponding accrual and budgetary
journals.
The following reference fields are used to capture and keep PO information in the
GL_JE_LINES table.
These reference fields are populated when the Journal source (JE_SOURCE in
GL_JE_HEADERS) is
Purchasing.
Budgetary Records from PO (These include reservations, reversals and
cancellations):
REFERENCE_1- Source (PO or REQ)
REFERENCE_2- PO Header ID or Requisition Header ID (from
po_headers_all.po_header_id or
po_requisition_headers_all.requisition_header_id)
REFERENCE_3- Distribution ID (from po_distributions_all.po_distribution_id or
po_req_distributions_all.distribution_id)
REFERENCE_4- Purchase Order or Requisition number (from po_headers_all.segment1 or
po_requisition_headers_all.segment1)
REFERENCE_5- (Autocreated Purchase Orders only) Backing requisition number (from
po_requisition_headers_all.segment1)
Accrual Records from PO:
REFERENCE_1- Source (PO)
REFERENCE_2- PO Header ID (from po_headers_all.po_header_id)
REFERENCE_3- Distribution ID (from po_distributions_all.po_distribution_id
REFERENCE_4- Purchase Order number (from po_headers_all.segment1)
REFERENCE_5- (ON LINE ACCRUALS ONLY) Receiving Transaction ID (from
rcv_receiving_sub_ledger.rcv_transaction_id)
Take a note for Period end accruals, the REFERENCE_5 column is not used.
-----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
List all information form PR to PO
----- List and all data entry from PR till PO
1.Item Creation:
2.Supplier Creation:
3.Buyer Creation:
-------------------------------------------------
1.Item Creation:
1)Attach the Responsibility called "Inventory Vision Operations (USA)"
2)Open the Items form
Items=>Master Item
3)Select the Organization name - Vision Operations
4)Enter the Item Name , Item Description
goto Inventory tab check the checkbox called Inventory
goto purchasing tab check the check box called Purchasing
5)Save
6)Goto Tools Menu => Organization Assignment option to assign for the multiple
organizations.
2.Supplier Creation:
1)Attach the Responsibility called "Purchasing Vision Operations (USA)"
2)Goto the Supplier Form
Supply Base=>Suppliers
3)Enter the Supplier Name . Save supplier number will be created automatically.
4)Select the Sites button enter the supplier site address and other details
5)Goto the Contacts tab enter the Contact details
Name
Phno
Postion and so on.....
Buyer Creation:
==================
Standard P.O
Planned P.O
Blanket P.O
ContractP.O
Terms and Conditions
Goods or Service Known
Pricing Known
Quantity known
Account Distributions Known
Delivery Schedule Known
Can be Encumbered
Can Encumber releases
Yes
Yes
Yes
Yes
Yes
Yes
Yes
N/A
Yes
Yes
Yes
Yes
Yes
May be
Yes
Yes
Yes
Yes
May be
No
No
No
No
Yes
Yes
No
No
No
No
No
No
N/A
Receipts are one of the documents it will be used to find out how much
quantity Supplier has supplied. We will find out Purchase Order status if it is
successfully approved then we will create the Receipt. We will give the PO Number
select Findbutton check the PO lines right mark and save. It will create the
Receipt number select Header button it will shows the receipt number and date.
2-way:- Purchase Order and Invoice Quantities must match within tolerance before
the corresponding invoice can be paid.
3-way:- Purchase Order, Receipts and Invoice Quantities must match with in
tolerance before the corresponding invoice can be paid.
4-way:- Purchase Order, Receipts, Inspection and Invoice Quantities must match with
in tolerance before the corresponding invoice can be paid.
From the company point of view a person or Organization who is going to receive
amount we will call as Supplier.
Types of Invoices:-
1. Standard
2. Credit Memo
3. Debit Memo
4. With Holding Tax
5. Po Default
6. Mixed
7. Pre Payment
8. Expense Report
9. Recurring Invoices
10. Quick Match
Credit Memo & Debit Memo Invoices:- Both Invoices has got negative (-ve) amount and
adjusted against Standard Invoice. Credit Memo will be created whenever Supplier is
giving discount. Debit Memo will be created if buyer is going to deduct the amount.
With Holding Tax Invoice:- If supplier is not registered supplier then buyer
will make the Income Tax to the government on behalf of supplier.
Po Default Invoice:- Here we will create the Invoice as per Purchase Order
amount. We will give the Po number system will retrieve PO amount and Invoice will
be created as per PO details.
Prepayment Invoice:- When ever we want make payment to supplier in advance that
tome we will create this Prepayment Invoice and we make the Payment.
Expense Reports Invoice:- It will be created for employee expenses as per the
employee grade, position this Invoices will be calculated.
Recurring Invoice:- For some of the Invoices we will not be having supplier
invoice that time we will create Recurring Invoices.
Ex:- For rent account we will be creating Invoice which has got fixed amount and
fixed rate (duration).
Quick Match Invoice:- While creating Purchase Order we will be giving the match
approval option as per that match approval we will create the Invoice and the
Invoice type is Quick Match Invoice.
Mixed Invoice:- Mixed Invoices will be created for miscellaneous expenses. Once we
create the invoice you have to do following 3 activities.
1. Validate Invoice
2. Approve the Invoice
3. Create Accounting entries for Invoice
INVOICES
Here we will select the Invoice type and we will give the Supplier number, name,
site invoice date, invoice number, invoice currencies, and amount. Select
Distributions button to distribute the Invoice amount into different accounts.
1. Invoice total should be equal to the distributions total then we will call
it as Invoice validated successfully.
2. Select Actions…1 button chooses approve check box press OK then system will
approve the Invoice.
3. Select Actions…1 button choose create accounting check box press OK button
it will create the accounting entries we can see all this accounting transactions
from tools view accounting option.
SELECT * FROM AP_INVOICES_ALL WHERE INVOICE_NUM='INV4516' --INVOICE_ID=63379
,--VENDOR_ID(LINK B/WAP INVOICE AND PO_VENDORS
)
SELECT * FROM AP_INVOICE_DISTRIBUTIONS_ALL WHERE INVOICE_ID=63379
Invoice Holds:- If invoice is not approved then that invoice will be keeping
under hold status. By selecting holds button in invoice form we can see the holds
details.
PAYMENTS:
Payments:- Once the Invoice is approved then we can go for payments. The
Payments are or 3 types. They were
1. Manual
2. Quick
3. Refund
Manual:- Here we will issue the checks manually to the supplier and we will
capture that information in the payment scheme by using manual payment option.
Quick:- Through the Quick Payment type we can generate checks through the
system and we can have the transactions directly in the system.
Refund:- When ever company is going to give advance back to the customer that
time we will select payment type as Refund.
To view posting:
After submitting the request select viewà output button. It will shows
number of transactions has been transferred to G.L. then select G.L Module (General
Ledger, Vision Operations (USA)).
SELECT * FROM GL_JE_HEADERS
SELECT * FROM GL_JE_LINES
SELECT * FROM GL_JE_BATCHES
SELECT * FROM GL_BALANCES
PO Approval History Query in Oracle apps
Action History of PO
SELECT DISTINCT prha.segment1 req
, pha.segment1 po
, gcc.segment3 acct
, acct_desc.description acct_desc
, gcc.segment4 ctr
, ctr_desc.description ctr_desc
, papf.full_name req_raised_by
, reqah.full_name req_last_approver
, poah.full_name po_last_approver
, pv.vendor_name supplier
, pvsa.vendor_site_code site
FROM po.po_requisition_headers_all prha
, po.po_requisition_lines_all prla
, po.po_line_locations_all plla
, po.po_lines_all pla
, po.po_headers_all pha
, po.po_distributions_all pda
, gl.gl_code_combinations gcc
, apps.po_vendors pv
, apps.po_vendor_sites_all pvsa
, apps.fnd_flex_values_vl acct_desc
, apps.fnd_flex_values_vl ctr_desc
, hr.per_all_people_f papf
, (SELECT papf.full_name
, pah.action_code
, pah.object_id
FROM po.po_action_history pah
, po.po_requisition_headers_all prha
, applsys.fnd_user fu
, hr.per_all_people_f papf
WHERE object_id = prha.requisition_header_id
AND pah.employee_id = fu.employee_id
AND fu.employee_id = papf.person_id
AND SYSDATE BETWEEN papf.effective_start_date
AND papf.effective_end_date
AND pah.object_type_code = 'REQUISITION'
AND pah.action_code = 'APPROVE'
AND pah.sequence_num =
(SELECT MAX(sequence_num)
FROM po.po_action_history pah1
WHERE pah1.object_id = pah.object_id
AND pah1.object_type_code = 'REQUISITION'
AND pah1.action_code = 'APPROVE')) reqah
, (SELECT papf.full_name
, pah.action_code
, pah.object_id
FROM po.po_action_history pah
, po.po_headers_all pha
, applsys.fnd_user fu
, hr.per_all_people_f papf
WHERE object_id = pha.po_header_id
AND pah.employee_id = fu.employee_id
AND fu.employee_id = papf.person_id
AND SYSDATE BETWEEN papf.effective_start_date
AND papf.effective_end_date
AND pah.object_type_code = 'PO'
AND pah.action_code = 'APPROVE'
AND pah.sequence_num =
(SELECT MAX(sequence_num)
FROM po.po_action_history pah1
WHERE pah1.object_id = pah.object_id
AND pah1.object_type_code = 'PO'
AND pah1.action_code = 'APPROVE')) poah
WHERE prha.requisition_header_id = prla.requisition_header_id
AND prla.line_location_id = plla.line_location_id
AND plla.po_header_id = pla.po_header_id
AND pla.po_header_id = pha.po_header_id
AND pla.po_line_id = pda.po_line_id
AND pda.code_combination_id = gcc.code_combination_id
AND reqah.object_id = prha.requisition_header_id
AND poah.object_id = pha.po_header_id
AND prha.preparer_id = papf.person_id
AND gcc.segment3 = acct_desc.flex_value
AND gcc.segment4 = ctr_desc.flex_value
AND pha.vendor_id = pv.vendor_id
AND pha.vendor_site_id = pvsa.vendor_site_id
AND pv.vendor_id = pvsa.vendor_id
AND SYSDATE BETWEEN papf.effective_start_date
AND papf.effective_end_date
AND prha.creation_date >= '01-APR-2009'
AND prha.creation_date <= '03-APR-2009'
ORDER BY prha.segment1
, gcc.segment4
PO to GL query
Solution
---------
SELECT asp.vendor_name supplier_name,
asp.segment1 supplier_number,
ass.vendor_site_code supplier_site,
hou.name operating_unit,
decode(ass.pay_on_code,'RECEIPT',ass.pay_on_code,'') pay_on_receipt_flag,
ass.pay_on_receipt_summary_code invoice_summary_level,
ieppm.payment_method_code
FROM ap_suppliers asp,
ap_supplier_sites_all ass,
hr_operating_units hou,
IBY_EXTERNAL_PAYEES_ALL iepa,
iby_ext_party_pmt_mthds ieppm
WHERE asp.vendor_id=ass.vendor_id
AND ass.org_id=hou.organization_id
AND iepa.supplier_site_id=ass.vendor_site_id
AND iepa.org_id=ass.org_id
AND iepa.ext_payee_id = ieppm.ext_pmt_party_id
AND ass.org_id in(81,82,83,155);
hope this will help to you.... keep watching this site for more updates or bookmark
this site.
Query to fetch requisition and PO are linked(Relation with Requisition and PO )
http://img.my.csdn.net/uploads/201304/09/1365476750_2267.png
Requisition Approval History Query in Oracle apps