Insert Script for Standard POs


INSERT
INTO po_headers_interface
  (
    interface_header_id,
    batch_id,
    interface_source_code,
    action,
    document_type_code,
    DOCUMENT_NUM,
    vendor_id,
    vendor_site_id,
    org_id,
    CURRENCY_CODE,
    agent_id,
    PAYMENT_TERMS,
    bill_to_location_id,
    ship_to_location_id,
    CREATION_DATE,
    CREATED_BY,
    approval_status
  )
  VALUES
  (
    po_headers_interface_s.NEXTVAL,
    2000,
    'CONVERSION',
    'ORIGINAL', --  Indicates this is a new document
    'STANDARD', -- Indicates a standard PO is being imported
    'GPBTEST52', -- Legacy PO#
    3432090, -- vendor_id in ap_suppliers
    572386,  --  vendor_site_id in ap_supplier_sites_all
    85, -- Organization_id in hr_operating_units
    'USD', -- currency_code in fnd_currencies
    126872, -- agent_id in po_agents
    '30 NET', -- name in ap_terms
    1202,  -- location_id in hr_locations where bill_to_site_flag = 'Y'
573982, -- location_id in hr_locations where ship_to_site_flag = 'Y'
    sysdate,
    1238,
    'APPROVED'
  );
INSERT
INTO po_lines_interface
  (
    interface_header_id,
    INTERFACE_LINE_ID,
    line_num,
    shipment_num,
    line_type,
    item_id,
    quantity,
    item_revision,
    UNIT_PRICE,
    uom_code,
    NEED_BY_DATE,
    PROMISED_DATE,
    SHIP_TO_LOCATION_ID,
    ship_to_organization_id,
    receiving_routing_id,
    vendor_product_num,
    creation_date,
    created_by,
    last_update_date,
    last_updated_by
  )
  VALUES
  (
    po_headers_interface_s.CURRVAL,
    PO_LINES_INTERFACE_S.NEXTVAL,
    1,
1,
    'Goods', -- line_type in po_line_types
    2836753, -- inventory_item_id in mtl_system_items_b
    30,
    NULL,  -- revision in mtl_item_revisions_b
    18.82,
    'EA', -- uom_code in mtl_units_of_measure
    sysdate+3,
    SYSDATE+3,
573982, -- location_id in hr_locations where ship_to_site_flag = 'Y'
3492, -- organization_id in org_organization_definitions
3, -- receiving_routing_id in pofg_receiving_routings
    '12345',
    SYSDATE,
    1238,
    SYSDATE,
    1238
  );
INSERT
INTO po_distributions_interface
  (
    interface_header_id,
    interface_line_id,
    INTERFACE_DISTRIBUTION_ID,
    QUANTITY_ORDERED,
deliver_TO_LOCATION_ID,
    CHARGE_ACCOUNT_ID,
    creation_date,
    created_by,
    last_update_date,
    last_updated_by
  )
  VALUES
  (
    po_headers_interface_s.CURRVAL,
    po_lines_interface_s.CURRVAL,
    PO_DISTRIBUTIONS_INTERFACE_S.NEXTVAL,
    30,
573982, -- location_id in hr_locations where ship_to_site_flag = 'Y'
    538210, -- code_combination_id in gl_code_combinations_kfv
SYSDATE,
    1238,
    SYSDATE,
    1238
  );
/

--  Submit the "Import Standard Purchase Orders" Program from the respective OU

Post a Comment