{"id":20695,"date":"2020-07-27T18:05:43","date_gmt":"2020-07-27T21:05:43","guid":{"rendered":"https:\/\/orabr.com\/?p=20695"},"modified":"2020-07-27T18:05:47","modified_gmt":"2020-07-27T21:05:47","slug":"oracle-ebs-app-criar-po-via-open-interface","status":"publish","type":"post","link":"https:\/\/orabr.virttus.com\/?p=20695","title":{"rendered":"Oracle EBS\/APP &#8211; CRIAR PO VIA OPEN INTERFACE"},"content":{"rendered":"<HTML>\n<pre class=\"wp-block-code\"><code>\n\n\n\/*Purchase Order Interface\nPurchase Order Interface -- PO_HEADERS_INTERFACE \nInterface Tables Used\n\n1)PO_HEADERS_INTERFACE\n2)PO_LINES_INTERFACE\n3)PO_DISTRIBUTIONS_INTERFACE\n*\/\nINSERT INTO po_headers_interface\n  (interface_header_id\n  ,batch_id\n  ,action\n  ,org_id\n  ,document_type_code\n  ,vendor_id\n  ,vendor_site_code\n  ,vendor_site_id\n  ,vendor_doc_num\n  ,currency_code\n  ,agent_id\n  ,terms_id\n  ,approval_status\n  ,ship_to_location_id\n  ,effective_date\n  ,creation_date\n  ,created_by\n  ,last_update_date\n  ,last_updated_by\n  ,attribute_category\n  ,attribute9 --xtra information \n  ,comments)\nVALUES\n  (po_headers_interface_s.nextval\n  ,po_headers_interface_s.currval\n  ,'ORIGINAL'\n  ,g_org_id\n  ,'STANDARD'\n  ,rec_get_header_info.vendor_id\n  ,rec_get_header_info.vendor_site_code\n  ,rec_get_header_info.vendor_site_id\n  ,po_headers_interface_s.currval\n  ,'USD'\n  ,l_agent_id\n  ,rec_get_header_info.terms_id\n  ,'APPROVED'\n  ,rec_get_header_info.deliver_to_location_id\n  ,to_date(SYSDATE, 'DD-MON-RRRR')\n  ,to_date(SYSDATE, 'DD-MON-RRRR')\n  ,fnd_profile.value('USER_ID')\n  ,to_date(SYSDATE, 'DD-MON-RRRR')\n  ,fnd_profile.value('USER_ID')\n  ,'DS Fields'\n  ,rec_get_header_info.attribute9 --xtra information \n  ,l_comments) INSERT INTO po_lines_interface\n  (interface_header_id\n  ,interface_line_id\n  ,requisition_line_id\n  ,line_num\n  ,shipment_num\n  ,line_type_id\n  ,item\n  ,item_description\n  ,category_id\n  ,unit_of_measure\n  ,quantity\n  ,unit_price\n  ,ship_to_organization_id\n  ,line_location_id\n  ,effective_date\n  ,need_by_date\n  ,creation_date\n  ,created_by\n  ,last_update_date\n  ,last_updated_by\n  ,taxable_flag)\nVALUES\n  (po.po_headers_interface_s.currval\n  ,po.po_lines_interface_s.nextval\n  ,rec_get_line_info.requisition_line_id\n  ,l_line_num\n  ,1\n  ,rec_get_line_info.line_type_id\n  ,rec_get_line_info.segment1\n  ,rec_get_line_info.item_description\n  ,rec_get_line_info.category_id\n  ,rec_get_line_info.primary_unit_of_measure\n  ,rec_get_line_info.quantity\n  ,rec_get_line_info.unit_price\n  ,rec_get_line_info.destination_organization_id\n  ,po_line_locations_s.nextval\n  ,to_date(SYSDATE, 'DD-MON-RRRR')\n  ,to_date(rec_get_line_info.need_by_date, 'DD-MON-RRRR')\n  ,to_date(SYSDATE, 'DD-MON-RRRR')\n  ,fnd_profile.value('USER_ID')\n  ,to_date(SYSDATE, 'DD-MON-RRRR')\n  ,fnd_profile.value('USER_ID')\n  ,'Y');\nINSERT INTO po.po_distributions_interface\n  (interface_header_id\n  ,interface_line_id\n  ,interface_distribution_id\n  ,req_distribution_id\n  ,org_id\n  ,distribution_num\n  ,quantity_ordered\n  ,destination_organization_id\n  ,destination_type_code\n  ,destination_subinventory\n  ,deliver_to_location_id\n  ,set_of_books_id\n  ,charge_account_id\n  ,budget_account_id\n  ,accrual_account_id\n  ,variance_account_id\n  ,deliver_to_person_id\n  ,creation_date\n  ,created_by\n  ,last_update_date\n  ,last_updated_by)\nVALUES\n  (po.po_headers_interface_s.currval\n  ,po.po_lines_interface_s.currval\n  ,po.po_distributions_interface_s.nextval\n  ,rec_get_distrib_info.distribution_id\n  ,g_org_id\n  ,rec_get_distrib_info.distribution_num\n  ,rec_get_distrib_info.req_line_quantity\n  ,rec_get_distrib_info.destination_organization_id\n  ,rec_get_distrib_info.destination_type_code\n  ,l_destination_subinventory\n  ,rec_get_line_info.deliver_to_location_id\n  ,rec_get_distrib_info.set_of_books_id\n  ,rec_get_distrib_info.code_combination_id\n  ,rec_get_distrib_info.budget_account_id\n  ,l_new_accrual_account_id\n  ,rec_get_distrib_info.variance_account_id\n  ,rec_get_line_info.to_person_id\n  ,to_date(SYSDATE, 'DD-MON-RRRR')\n  ,fnd_profile.value('USER_ID')\n  ,to_date(SYSDATE, 'DD-MON-RRRR')\n  ,fnd_profile.value('USER_ID'));\n--\n--\n--Ap\u00f3s ter populado AS interface rodar o concurrent abaixo concurrent program :\n--\n--\n         apps.fnd_request.submit_request(application => 'PO' --Application, \n                                        program =>\n                                        'POXPOPDOI' --Program, \n                                        argument1 => '' --Buyer ID, \n                                        argument2 =>\n                                        'STANDARD' --Document Type, \n                                        argument3 => '' --Document Subtype, \n                                        argument4 => 'N' --Process Items Flag, \n                                        argument5 => 'N' --Create Sourcing rule, \n                                        argument6 => '' --Approval Status, \n                                        argument7 => '' --Release Generation Method, \n                                        argument8 => '' --NULL, \n                                        argument9 =>\n                                        g_org_id --Operating Unit ID, \n                                        argument10 => '' --Global Agreement\n                         );\n--CALLING po approval workflow TO approve pos\n  SELECT to_char(po_wf_itemkey_s.nextval)\n    INTO v_wf_seq\n    FROM sys.dual;\nv_itemkey := to_char(l_header.po_header_id) || '-' || v_wf_seq;\npo_reqapproval_init1.start_wf_process(itemtype              => 'POAPPRV',\n                                      itemkey               => v_itemkey,\n                                      workflowprocess       => 'POAPPRV_TOP',\n                                      actionoriginatedfrom  => 'PO_FORM',\n                                      documentid            => l_header.po_header_id,\n                                      documentnumber        => l_header.segment1,\n                                      preparerid            => l_header.agent_id,\n                                      documenttypecode      => 'PO',\n                                      documentsubtype       => 'STANDARD',\n                                      submitteraction       => 'APPROVE',\n                                      forwardtoid           => NULL,\n                                      forwardfromid         => l_header.agent_id,\n                                      defaultapprovalpathid => 10,\n                                      note                  => NULL,\n                                      printflag             => 'N',\n                                      faxflag               => NULL,\n                                      faxnumber             => NULL);\n<\/code><\/pre>\n<\/HTML>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-20695","post","type-post","status-publish","format-standard","hentry","category-base-de-conhecimentos"],"_links":{"self":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts\/20695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20695"}],"version-history":[{"count":1,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts\/20695\/revisions"}],"predecessor-version":[{"id":20696,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts\/20695\/revisions\/20696"}],"wp:attachment":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}