Thursday 30 October 2014

Single 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


Single Insert Script for Open AR Transaction (Credit Memo) for R12 - Insert Into ra_interface_lines_all

-------------------- For Credit Memo -----------------------------------------
INSERT
INTO Apps.ra_interface_lines_all
  (
    trx_number,
    batch_source_name,
    line_type,
    inventory_item_id,
description,
    currency_code,
    amount,
    org_id ,
    conversion_type,
    conversion_rate ,
    orig_system_bill_address_id,
    orig_system_ship_address_id,
    orig_system_bill_customer_id,
    orig_system_ship_customer_id ,
    primary_salesrep_id,
    memo_line_id,
    memo_line_name, -- (standard lines)
    creation_date,
    created_by ,
    tax_code,
    gl_date ,
    cust_trx_type_id,
    cust_trx_type_name ,
    interface_line_context,
    interface_line_attribute1,
    interface_line_attribute2,
    interface_line_attribute3,
    interface_line_attribute4
  )
  VALUES
  (
    '9996',
    'CONVERSION_GP', -- Name in ra_batch_sources_all
    'LINE',
    2256906,
'NOVASURE STERILIZED DEVICE 3 PK',
    'USD', -- Currency_code in fnd_currencies
    -100,
85 ,  -- Organization_id in hr_operating_units
    'User',
    1 ,
    125629, -- cust_acct_site_id in hz_cust_acct_sites_all
NULL, -- cust_acct_site_id in hz_cust_acct_sites_all
1321077, -- cust_account_id in hz_cust_accounts
NULL , -- cust_account_id in hz_cust_accounts
    -3, -- salesrep_id in jtf_rs_salesreps
    NULL, -- memo_line_id in ar_memo_lines_all_tl
    NULL, -- Name in ar_memo_lines_all_tl
    SYSDATE,
    1238 , -- User_Id in fnd_user
    NULL,
    SYSDATE ,
    6389, -- cust_trx_type_id in ra_cust_trx_types_all
    'GPS CORP CONV CM' ,  -- Name in ra_cust_trx_types_all
    'CONVERSION',
    '9996',
    'GENPROBE_TEST',
    'Testing',
    'Test'
  );
/


-- Submit the "Autoinvoice Master Program" Program from the respective OU

Single Insert Script for AR Open Invoice


Single Insert Script for Open AR Transaction (Invoice) for R12 - Insert Into ra_interface_lines_all


INSERT
INTO Apps.ra_interface_lines_all
  (
    trx_number,
    batch_source_name,
    line_type,
    Inventory_item_id,
description,
uom_code,
quantity_ordered,
    currency_code,
    amount,
    org_id ,
    conversion_type,
    conversion_rate ,
    orig_system_bill_address_id,
    orig_system_ship_address_id,
    orig_system_bill_customer_id,
    orig_system_ship_customer_id ,
    primary_salesrep_id,
    memo_line_id,
    memo_line_name, -- (standard lines)
    creation_date,
    created_by ,
    tax_code,
    gl_date ,
    term_id,
    term_name,
    cust_trx_type_id,
    cust_trx_type_name ,
    interface_line_context,
    interface_line_attribute1,
    interface_line_attribute2,
    interface_line_attribute3,
    interface_line_attribute4
  )
  VALUES
  (
    '9997',
    'CONVERSION_GP', -- Name in ra_batch_sources_all
    'LINE',
    2256906, -- Inventory_item_id in mtl_system_items_b
'NOVASURE STERILIZED DEVICE 3 PK', -- Description in mtl_system_items_b
'EA',
2,
    'USD', -- Currency_code in fnd_currencies
    150,
85 ,  -- Organization_id in hr_operating_units
    'User',
    1 ,
    377980, -- cust_acct_site_id in hz_cust_acct_sites_all
NULL, -- cust_acct_site_id in hz_cust_acct_sites_all
2955128, -- cust_account_id in hz_cust_accounts
NULL , -- cust_account_id in hz_cust_accounts
    -3, -- salesrep_id in jtf_rs_salesreps
    NULL, -- memo_line_id in ar_memo_lines_all_tl
    NULL, -- Name in ar_memo_lines_all_tl
    SYSDATE,
    1238 , -- User_Id in fnd_user
    NULL,
    SYSDATE ,
    1010, -- term_id in ra_terms_tl
    '90 NET', -- Name in ra_terms_tl
    5396, -- cust_trx_type_id in ra_cust_trx_types_all
    'GPI CORP CONV INV' , -- Name in ra_cust_trx_types_all
    'CONVERSION',
    '9997',
    'GENPROBE_TEST',
    'Testing',
    'Test'
  );

-- Submit the "Autoinvoice Master Program" Program from the respective OU