{"id":1854,"date":"2011-04-17T14:56:48","date_gmt":"2011-04-17T09:26:48","guid":{"rendered":"http:\/\/sendyoursmiles.com\/?p=1854"},"modified":"2011-04-17T14:56:48","modified_gmt":"2011-04-17T09:26:48","slug":"procure-to-pay-cycle-query","status":"publish","type":"post","link":"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query","title":{"rendered":"Procure to Pay Cycle Query"},"content":{"rendered":"<p>Includes two scripts to fetch all the transactions information related with in a procure to pay cycle.<br \/>\nTwo scripts are provided to use one with receipts and other when receipts are not created.<\/p>\n<p>Few important fields that were included in the script are Requisition Number, Purchase Order Number, Invoice Number, Customer Number, Invoice Amount, GL Transfer flag e.t.c<\/p>\n<p>&#8211;Procure to Pay query without receipts<br \/>\n<code><br \/>\nselect distinct<br \/>\n           reqh.segment1 REQ_NUM,<br \/>\n           reqh.AUTHORIZATION_STATUS REQ_STATUS,  -- poh.po_header_id,<br \/>\n           poh.segment1 PO_NUM,<br \/>\n           pol.line_num,<br \/>\n           poh.AUTHORIZATION_STATUS PO_STATUS,<br \/>\n    --     i.invoice_id,<br \/>\n           i.invoice_num,<br \/>\n           i.invoice_amount,<br \/>\n           i.amount_paid,<br \/>\n           i.vendor_id,<br \/>\n    --     v.vendor_name,<br \/>\n    --     p.check_id,<br \/>\n           c.check_number,<br \/>\n           h.gl_transfer_flag,<br \/>\n           h.period_name<br \/>\n    from ap_invoices_all i,<br \/>\n         ap_invoice_distributions_all invd,<br \/>\n         po_headers_all poh,<br \/>\n         po_lines_all pol,<br \/>\n         po_distributions_all pod,<br \/>\n         po_vendors v,<br \/>\n         po_requisition_headers_all reqh,<br \/>\n         po_requisition_lines_all reql,<br \/>\n         po_req_distributions_all reqd,<br \/>\n         ap_invoice_payments_all p,<br \/>\n         ap_checks_all c,<br \/>\n         ap_ae_headers_all h,<br \/>\n         ap_ae_lines_all l<br \/>\n    where 1=1<br \/>\n    and i.vendor_id = v.vendor_id<br \/>\n    and c.check_id = p.check_id<br \/>\n    and p.invoice_id = i.invoice_id<br \/>\n    and poh.PO_HEADER_ID = pol.PO_HEADER_ID<br \/>\n    and reqh.REQUISITION_HEADER_ID = reql.REQUISITION_HEADER_ID<br \/>\n    and reqd.REQUISITION_LINE_ID = reql.REQUISITION_LINE_ID<br \/>\n    and pod.REQ_DISTRIBUTION_ID = reqd.DISTRIBUTION_ID<br \/>\n    and pod.PO_HEADER_ID = poh.PO_HEADER_ID<br \/>\n    and pod.PO_DISTRIBUTION_ID = invd.PO_DISTRIBUTION_ID<br \/>\n    and invd.INVOICE_ID = i.INVOICE_ID<br \/>\n    and h.ae_header_id = l.ae_header_id<br \/>\n    and l.SOURCE_TABLE = 'AP_INVOICES'<br \/>\n    AND l.SOURCE_ID = i.invoice_id<br \/>\n    --and poh.segment1 = 4033816 -- PO NUMBER<br \/>\n    and reqh.segment1 = '501'   -- REQ NUMBER<br \/>\n    --and i.invoice_num = 3114     -- INVOICE NUMBER<br \/>\n    --and c.check_number =     -- CHECK NUMBER<br \/>\n   --and vendor_id =          -- VENDOR ID<\/code><\/p>\n<p>&#8212; PROCURE TO PAY CYCLE QUERY WITH RECEIPTS<\/p>\n<p><code><br \/>\nSELECT DISTINCT reqh.segment1 req_num, reqh.authorization_status req_status,<br \/>\n      --       POH.PO_HEADER_ID,<br \/>\n                poh.segment1 po_num, pol.line_num,<br \/>\n                poh.authorization_status po_status, rcvh.receipt_num,<br \/>\n                rcv.inspection_status_code,<br \/>\n      --       I.INVOICE_ID,<br \/>\n                i.invoice_num, i.invoice_amount,<br \/>\n                i.amount_paid, i.vendor_id,<br \/>\n      --       V.VENDOR_NAME,<br \/>\n      --       P.CHECK_ID,<br \/>\n                c.check_number, h.gl_transfer_flag,<br \/>\n               h.period_name<br \/>\n           FROM ap_invoices_all i,<br \/>\n                ap_invoice_distributions_all invd,<br \/>\n                po_headers_all poh,<br \/>\n                po_lines_all pol,<br \/>\n                po_distributions_all pod,<br \/>\n                po_vendors v,<br \/>\n                po_requisition_headers_all reqh,<br \/>\n                po_requisition_lines_all reql,<br \/>\n                po_req_distributions_all reqd,<br \/>\n                rcv_transactions rcv,<br \/>\n                rcv_shipment_headers rcvh,<br \/>\n                rcv_shipment_lines rcvl,<br \/>\n                ap_invoice_payments_all p,<br \/>\n                ap_checks_all c,<br \/>\n                ap_ae_headers_all h,<br \/>\n                ap_ae_lines_all l<br \/>\n          WHERE 1 = 1<br \/>\n            AND i.vendor_id = v.vendor_id<br \/>\n            AND c.check_id = p.check_id<br \/>\n            AND p.invoice_id = i.invoice_id<br \/>\n            AND poh.po_header_id = pol.po_header_id<br \/>\n            AND reqh.requisition_header_id = reql.requisition_header_id<br \/>\n            AND reqd.requisition_line_id = reql.requisition_line_id<br \/>\n            AND pod.req_distribution_id = reqd.distribution_id<br \/>\n            AND pod.po_header_id = poh.po_header_id<br \/>\n          --AND POH.PO_HEADER_ID = RCV.PO_HEADER_ID<br \/>\n            AND rcvh.shipment_header_id = rcv.shipment_header_id(+)<br \/>\n          --AND RCVH.SHIPMENT_HEADER_ID = RCVL.SHIPMENT_HEADER_ID<br \/>\n          --AND RCV.TRANSACTION_TYPE = 'RECEIVE'<br \/>\n          --AND RCV.SOURCE_DOCUMENT_CODE = 'PO'<br \/>\n          --AND POL.PO_LINE_ID = RCV.PO_LINE_ID<br \/>\n          --AND POD.PO_DISTRIBUTION_ID = RCV.PO_DISTRIBUTION_ID<br \/>\n            AND pod.po_distribution_id = invd.po_distribution_id<br \/>\n            AND invd.invoice_id = i.invoice_id<br \/>\n            AND h.ae_header_id = l.ae_header_id<br \/>\n            AND l.source_table = 'AP_INVOICES'<br \/>\n            AND l.source_id = i.invoice_id<br \/>\n          --AND POH.SEGMENT1 = 36420 -- PO NUMBER<br \/>\n            AND reqh.segment1 = '501'  -- REQ NUMBER<br \/>\n          --AND I.INVOICE_NUM = 3114     -- INVOICE NUMBER<br \/>\n          --AND C.CHECK_NUMBER =     -- CHECK NUMBER<br \/>\n          --AND VENDOR_ID =          -- VENDOR ID<br \/>\n          --AND RECEIPT_NUM = 692237<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Includes two scripts to fetch all the transactions information related with in a procure to pay cycle. Two scripts are provided to use one with receipts and other when receipts are not created. Few important fields that were included in the script are Requisition Number, Purchase Order Number, Invoice Number, Customer Number, Invoice Amount, GL [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-1854","post","type-post","status-publish","format-standard","hentry","category-scripts"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>oracle apps procure to pay cycle script<\/title>\n<meta name=\"description\" content=\"oracle apps procure to pay cycle script, tables, oracle applications, p2p, cycle\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prudhvi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query#article\",\"isPartOf\":{\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query\"},\"author\":{\"name\":\"Prudhvi\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512\"},\"headline\":\"Procure to Pay Cycle Query\",\"datePublished\":\"2011-04-17T09:26:48+00:00\",\"dateModified\":\"2011-04-17T09:26:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query\"},\"wordCount\":79,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\"},\"articleSection\":[\"Scripts\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query\",\"url\":\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query\",\"name\":\"oracle apps procure to pay cycle script\",\"isPartOf\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#website\"},\"datePublished\":\"2011-04-17T09:26:48+00:00\",\"dateModified\":\"2011-04-17T09:26:48+00:00\",\"description\":\"oracle apps procure to pay cycle script, tables, oracle applications, p2p, cycle\",\"breadcrumb\":{\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/erpschools.com\/erps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Procure to Pay Cycle Query\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/erpschools.com\/erps\/#website\",\"url\":\"https:\/\/erpschools.com\/erps\/\",\"name\":\"erpSchools\",\"description\":\"Oracle Apps\",\"publisher\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/erpschools.com\/erps\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/erpschools.com\/erps\/#organization\",\"name\":\"erpSchools\",\"url\":\"https:\/\/erpschools.com\/erps\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png\",\"contentUrl\":\"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png\",\"width\":250,\"height\":60,\"caption\":\"erpSchools\"},\"image\":{\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"http:\/\/facebook.com\/erpschools\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512\",\"name\":\"Prudhvi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/erpschools.com\/erps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g\",\"caption\":\"Prudhvi\"},\"sameAs\":[\"http:\/\/www.erpschools.com\"],\"url\":\"https:\/\/erpschools.com\/erps\/author\/prudhvi\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"oracle apps procure to pay cycle script","description":"oracle apps procure to pay cycle script, tables, oracle applications, p2p, cycle","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query","twitter_misc":{"Written by":"Prudhvi","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query#article","isPartOf":{"@id":"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query"},"author":{"name":"Prudhvi","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512"},"headline":"Procure to Pay Cycle Query","datePublished":"2011-04-17T09:26:48+00:00","dateModified":"2011-04-17T09:26:48+00:00","mainEntityOfPage":{"@id":"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query"},"wordCount":79,"commentCount":3,"publisher":{"@id":"https:\/\/erpschools.com\/erps\/#organization"},"articleSection":["Scripts"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query#respond"]}]},{"@type":"WebPage","@id":"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query","url":"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query","name":"oracle apps procure to pay cycle script","isPartOf":{"@id":"https:\/\/erpschools.com\/erps\/#website"},"datePublished":"2011-04-17T09:26:48+00:00","dateModified":"2011-04-17T09:26:48+00:00","description":"oracle apps procure to pay cycle script, tables, oracle applications, p2p, cycle","breadcrumb":{"@id":"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/erpschools.com\/erps\/scripts\/procure-to-pay-cycle-query#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/erpschools.com\/erps"},{"@type":"ListItem","position":2,"name":"Procure to Pay Cycle Query"}]},{"@type":"WebSite","@id":"https:\/\/erpschools.com\/erps\/#website","url":"https:\/\/erpschools.com\/erps\/","name":"erpSchools","description":"Oracle Apps","publisher":{"@id":"https:\/\/erpschools.com\/erps\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/erpschools.com\/erps\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/erpschools.com\/erps\/#organization","name":"erpSchools","url":"https:\/\/erpschools.com\/erps\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/","url":"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png","contentUrl":"https:\/\/erpschools.com\/erps\/wp-content\/uploads\/img\/erps_logo7.png","width":250,"height":60,"caption":"erpSchools"},"image":{"@id":"https:\/\/erpschools.com\/erps\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/facebook.com\/erpschools"]},{"@type":"Person","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/dbed9bb7fb66aa7a700fc565da024512","name":"Prudhvi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/erpschools.com\/erps\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/488cec3605845b95cb20e60c67a8f5c7e74b65a305525c8006315d524f120db9?s=96&d=blank&r=g","caption":"Prudhvi"},"sameAs":["http:\/\/www.erpschools.com"],"url":"https:\/\/erpschools.com\/erps\/author\/prudhvi"}]}},"_links":{"self":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts\/1854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/comments?post=1854"}],"version-history":[{"count":0,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/posts\/1854\/revisions"}],"wp:attachment":[{"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/media?parent=1854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/categories?post=1854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/erpschools.com\/erps\/wp-json\/wp\/v2\/tags?post=1854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}