PROCEDURE process_cux_to_ap(x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2) IS
l_api_name CONSTANT VARCHAR2(30) := 'PROCESS_CUX_TO_AP';
x_party_id NUMBER;
x_profile_id NUMBER;
l_order_number VARCHAR2(240); CURSOR cur_ch IS
SELECT ch.header_id,
ch.org_id,
ch.invoice_type,
ch.prepayment_type_code,
ch.vendor_id,
ch.vendor_site_id,
ch.invoice_date,
ch.gl_date,
ch.invoice_number,
ch.currency_code,
ch.invoice_amount,
ch.exchange_rate,
ch.exchange_rate_type,
ch.exchange_date,
ch.payment_currency_code,
ch.payment_rate_type,
ch.payment_rate,
ch.payment_rate_date,
ch.payment_method_lookup_code,
ch.pay_schedule_date,
ch.terms_id,
ch.pay_group_lookup_code,
ch.exp_report_id,
ch.apply_employee_name,
ch.invoice_id,
ch.description,
ch.source_code,
ch.source_line_id,
ch.source_reference,
ch.process_group_id,
ch.process_status,
ch.process_date,
ch.process_message,
ch.object_version_number,
ch.creation_date,
ch.created_by,
ch.last_updated_by,
ch.last_update_date,
ch.last_update_login,
ch.attribute_category,
ch.attribute1,
ch.attribute2,
ch.attribute3,
ch.attribute4,
ch.attribute5,
ch.attribute6,
ch.attribute7,
ch.attribute8,
ch.attribute9,
ch.attribute10,
ch.attribute11,
ch.attribute12,
ch.attribute13,
ch.attribute14,
ch.attribute15
FROM cux_oa_ap_invoice_header ch
WHERE (ch.process_status = 'PENDING' OR
ch.process_status = 'ERROR')
FOR UPDATE NOWAIT; CURSOR cur_cl(p_header_id IN NUMBER) IS
SELECT cl.line_id,
cl.header_id,
cl.line_num,
cl.line_type_lookup_code,
cl.amount,
cl.accounting_date,
cl.inventory_item_id,
cl.line_description,
cl.tax_code,
cl.tax_code_id,
cl.amount_includes_tax_flag,
cl.dist_code_combination_id,
cl.exp_item_id,
cl.item_id,
cl.invoice_id,
cl.invoice_line_number,
cl.source_code,
cl.source_line_id,
cl.source_reference,
cl.process_group_id,
cl.process_status,
cl.process_date,
cl.process_message,
cl.object_version_number,
cl.creation_date,
cl.created_by,
cl.last_updated_by,
cl.last_update_date,
cl.last_update_login,
cl.attribute_category,
cl.attribute1,
cl.attribute2,
cl.attribute3,
cl.attribute4,
cl.attribute5,
cl.attribute6,
cl.attribute7,
cl.attribute8,
cl.attribute9,
cl.attribute10,
cl.attribute11,
cl.attribute12,
cl.attribute13,
cl.attribute14,
cl.attribute15
FROM cux_oa_ap_invoice_line cl
WHERE cl.header_id = p_header_id
AND (cl.process_status = 'PENDING' OR
cl.process_status = 'ERROR')
ORDER BY cl.line_num
FOR UPDATE NOWAIT; l_rec_invoice_ifc ap_invoices_interface%ROWTYPE;
l_rec_invoice_line_ifc ap_invoice_lines_interface%ROWTYPE; l_project_num VARCHAR2(100);
l_return_status VARCHAR2(1);
l_msg_data VARCHAR2(240);
l_msg_count NUMBER;
l_group_id NUMBER := cux_doc_sequence_utl.next_seq_number(p_doc_type => 'CUX_OA_AP_IMP',
p_init_number => 1);
l_line_number NUMBER;
l_batch_error_flag VARCHAR2(30);
l_invoices_fetched NUMBER;
l_invoices_created NUMBER;
l_total_invoice_amount NUMBER;
l_print_batch VARCHAR2(30);
l_ret_bool BOOLEAN;
l_ret_status VARCHAR2(1); l_invoice_batch VARCHAR2(30);
v_invoice_id NUMBER; BEGIN x_return_status := cux_api.start_activity(p_pkg_name => g_pkg_name,
p_api_name => l_api_name,
p_init_msg_list => fnd_api.g_true);
raise_exception(x_return_status); -- INIT BEGIN
mo_global.init('SQLAP');
fnd_global.apps_initialize(user_id => 1370, resp_id => 50717, resp_appl_id => 20005); END; FOR rec_ch IN cur_ch LOOP
l_line_number := 0; l_rec_invoice_ifc.invoice_id := ap_invoices_interface_s.nextval;
l_rec_invoice_ifc.invoice_num := rec_ch.invoice_number;
l_rec_invoice_ifc.invoice_type_lookup_code := rec_ch.invoice_type; -- test REDO
l_rec_invoice_ifc.invoice_date := rec_ch.invoice_date;
l_rec_invoice_ifc.po_number := NULL;
l_rec_invoice_ifc.vendor_id := rec_ch.vendor_id;
l_rec_invoice_ifc.vendor_num := NULL;
l_rec_invoice_ifc.vendor_name := NULL;
l_rec_invoice_ifc.vendor_site_id := rec_ch.vendor_site_id;
l_rec_invoice_ifc.vendor_site_code := NULL;
l_rec_invoice_ifc.invoice_amount := rec_ch.invoice_amount;
l_rec_invoice_ifc.invoice_currency_code := rec_ch.currency_code;
l_rec_invoice_ifc.exchange_rate := NULL;
l_rec_invoice_ifc.exchange_rate_type := NULL;
l_rec_invoice_ifc.exchange_date := NULL;
l_rec_invoice_ifc.terms_id := NULL;
l_rec_invoice_ifc.terms_name := NULL;
l_rec_invoice_ifc.description := rec_ch.description;
l_rec_invoice_ifc.awt_group_id := NULL;
l_rec_invoice_ifc.awt_group_name := NULL;
l_rec_invoice_ifc.last_update_date := SYSDATE;
l_rec_invoice_ifc.last_updated_by := g_user_id;
l_rec_invoice_ifc.last_update_login := g_login_id;
l_rec_invoice_ifc.creation_date := SYSDATE;
l_rec_invoice_ifc.created_by := g_user_id;
l_rec_invoice_ifc.attribute_category := NULL;
l_rec_invoice_ifc.attribute1 := 'OA';
l_rec_invoice_ifc.attribute2 := rec_ch.source_line_id;
l_rec_invoice_ifc.attribute3 := NULL;
l_rec_invoice_ifc.attribute4 := NULL;
l_rec_invoice_ifc.attribute5 := NULL;
l_rec_invoice_ifc.attribute6 := NULL;
l_rec_invoice_ifc.attribute7 := NULL;
l_rec_invoice_ifc.attribute8 := NULL;
l_rec_invoice_ifc.attribute9 := NULL;
l_rec_invoice_ifc.attribute10 := NULL;
l_rec_invoice_ifc.attribute11 := NULL;
l_rec_invoice_ifc.attribute12 := NULL;
l_rec_invoice_ifc.attribute13 := NULL;
l_rec_invoice_ifc.attribute14 := NULL;
l_rec_invoice_ifc.attribute15 := NULL;
l_rec_invoice_ifc.global_attribute_category := NULL;
l_rec_invoice_ifc.global_attribute1 := NULL;
l_rec_invoice_ifc.global_attribute2 := NULL;
l_rec_invoice_ifc.global_attribute3 := NULL;
l_rec_invoice_ifc.global_attribute4 := NULL;
l_rec_invoice_ifc.global_attribute5 := NULL;
l_rec_invoice_ifc.global_attribute6 := NULL;
l_rec_invoice_ifc.global_attribute7 := NULL;
l_rec_invoice_ifc.global_attribute8 := NULL;
l_rec_invoice_ifc.global_attribute9 := NULL;
l_rec_invoice_ifc.global_attribute10 := NULL;
l_rec_invoice_ifc.global_attribute11 := NULL;
l_rec_invoice_ifc.global_attribute12 := NULL;
l_rec_invoice_ifc.global_attribute13 := NULL;
l_rec_invoice_ifc.global_attribute14 := NULL;
l_rec_invoice_ifc.global_attribute15 := NULL;
l_rec_invoice_ifc.global_attribute16 := NULL;
l_rec_invoice_ifc.global_attribute17 := NULL;
l_rec_invoice_ifc.global_attribute18 := NULL;
l_rec_invoice_ifc.global_attribute19 := NULL;
l_rec_invoice_ifc.global_attribute20 := NULL;
l_rec_invoice_ifc.status := NULL;
l_rec_invoice_ifc.source := 'OA_IMPORT';
l_rec_invoice_ifc.group_id := 'OA_IMPORT' ||
l_group_id;
l_rec_invoice_ifc.request_id := NULL;
l_rec_invoice_ifc.payment_cross_rate_type := NULL;
l_rec_invoice_ifc.payment_cross_rate_date := NULL;
l_rec_invoice_ifc.payment_cross_rate := NULL;
l_rec_invoice_ifc.payment_currency_code := NULL;
l_rec_invoice_ifc.workflow_flag := NULL;
l_rec_invoice_ifc.doc_category_code := NULL;
l_rec_invoice_ifc.voucher_num := NULL;
l_rec_invoice_ifc.payment_method_lookup_code := NULL;
l_rec_invoice_ifc.pay_group_lookup_code := NULL;
l_rec_invoice_ifc.goods_received_date := NULL;
l_rec_invoice_ifc.invoice_received_date := NULL;
l_rec_invoice_ifc.gl_date := rec_ch.gl_date;
l_rec_invoice_ifc.accts_pay_code_combination_id := NULL;
l_rec_invoice_ifc.ussgl_transaction_code := NULL;
l_rec_invoice_ifc.exclusive_payment_flag := NULL;
l_rec_invoice_ifc.org_id := rec_ch.org_id;
l_rec_invoice_ifc.amount_applicable_to_discount := NULL;
l_rec_invoice_ifc.prepay_num := NULL;
l_rec_invoice_ifc.prepay_dist_num := NULL;
l_rec_invoice_ifc.prepay_apply_amount := NULL;
l_rec_invoice_ifc.prepay_gl_date := NULL;
l_rec_invoice_ifc.invoice_includes_prepay_flag := NULL;
l_rec_invoice_ifc.no_xrate_base_amount := NULL;
l_rec_invoice_ifc.vendor_email_address := NULL;
l_rec_invoice_ifc.terms_date := NULL;
l_rec_invoice_ifc.requester_id := NULL;
l_rec_invoice_ifc.ship_to_location := NULL;
l_rec_invoice_ifc.external_doc_ref := NULL;
l_rec_invoice_ifc.prepay_line_num := NULL;
l_rec_invoice_ifc.requester_first_name := NULL;
l_rec_invoice_ifc.requester_last_name := NULL;
l_rec_invoice_ifc.application_id := NULL;
l_rec_invoice_ifc.product_table := NULL;
l_rec_invoice_ifc.reference_key1 := NULL;
l_rec_invoice_ifc.reference_key2 := NULL;
l_rec_invoice_ifc.reference_key3 := NULL;
l_rec_invoice_ifc.reference_key4 := NULL;
l_rec_invoice_ifc.reference_key5 := NULL;
l_rec_invoice_ifc.apply_advances_flag := NULL;
l_rec_invoice_ifc.calc_tax_during_import_flag := NULL;
l_rec_invoice_ifc.control_amount := NULL;
l_rec_invoice_ifc.add_tax_to_inv_amt_flag := NULL;
l_rec_invoice_ifc.tax_related_invoice_id := NULL;
l_rec_invoice_ifc.taxation_country := NULL;
l_rec_invoice_ifc.document_sub_type := NULL;
l_rec_invoice_ifc.supplier_tax_invoice_number := NULL;
l_rec_invoice_ifc.supplier_tax_invoice_date := NULL;
l_rec_invoice_ifc.supplier_tax_exchange_rate := NULL;
l_rec_invoice_ifc.tax_invoice_recording_date := NULL;
l_rec_invoice_ifc.tax_invoice_internal_seq := NULL;
l_rec_invoice_ifc.legal_entity_id := NULL;
l_rec_invoice_ifc.legal_entity_name := NULL;
l_rec_invoice_ifc.reference_1 := NULL;
l_rec_invoice_ifc.reference_2 := NULL;
l_rec_invoice_ifc.operating_unit := NULL;
l_rec_invoice_ifc.bank_charge_bearer := NULL;
l_rec_invoice_ifc.remittance_message1 := NULL;
l_rec_invoice_ifc.remittance_message2 := NULL;
l_rec_invoice_ifc.remittance_message3 := NULL;
l_rec_invoice_ifc.unique_remittance_identifier := NULL;
l_rec_invoice_ifc.uri_check_digit := NULL;
l_rec_invoice_ifc.settlement_priority := NULL;
l_rec_invoice_ifc.payment_reason_code := NULL;
l_rec_invoice_ifc.payment_reason_comments := NULL;
l_rec_invoice_ifc.payment_method_code := NULL;
l_rec_invoice_ifc.delivery_channel_code := NULL;
l_rec_invoice_ifc.paid_on_behalf_employee_id := NULL;
l_rec_invoice_ifc.net_of_retainage_flag := NULL;
l_rec_invoice_ifc.requester_employee_num := NULL;
l_rec_invoice_ifc.cust_registration_code := NULL;
l_rec_invoice_ifc.cust_registration_number := NULL;
l_rec_invoice_ifc.party_id := NULL;
l_rec_invoice_ifc.party_site_id := NULL;
l_rec_invoice_ifc.pay_proc_trxn_type_code := NULL;
l_rec_invoice_ifc.payment_function := NULL;
l_rec_invoice_ifc.payment_priority := NULL;
l_rec_invoice_ifc.port_of_entry_code := NULL;
l_rec_invoice_ifc.external_bank_account_id := NULL;
l_rec_invoice_ifc.accts_pay_code_concatenated := NULL;
l_rec_invoice_ifc.pay_awt_group_id := NULL;
l_rec_invoice_ifc.pay_awt_group_name := NULL;
l_rec_invoice_ifc.original_invoice_amount := NULL;
l_rec_invoice_ifc.dispute_reason := NULL;
l_rec_invoice_ifc.remit_to_supplier_name := NULL;
l_rec_invoice_ifc.remit_to_supplier_id := NULL;
l_rec_invoice_ifc.remit_to_supplier_site := NULL;
l_rec_invoice_ifc.remit_to_supplier_site_id := NULL;
l_rec_invoice_ifc.relationship_id := NULL;
l_rec_invoice_ifc.remit_to_supplier_num := NULL; INSERT INTO ap_invoices_interface VALUES l_rec_invoice_ifc; FOR rec_cl IN cur_cl(p_header_id => rec_ch.header_id) LOOP l_line_number := l_line_number + 1; l_rec_invoice_line_ifc.invoice_id := ap_invoices_interface_s.currval;
l_rec_invoice_line_ifc.invoice_line_id := ap_invoice_lines_interface_s.nextval;
l_rec_invoice_line_ifc.line_number := l_line_number;
l_rec_invoice_line_ifc.line_type_lookup_code := rec_cl.line_type_lookup_code;
l_rec_invoice_line_ifc.line_group_number := NULL;
l_rec_invoice_line_ifc.amount := rec_cl.amount;
l_rec_invoice_line_ifc.accounting_date := rec_cl.accounting_date;
l_rec_invoice_line_ifc.description := rec_cl.line_description;
l_rec_invoice_line_ifc.amount_includes_tax_flag := NULL;
l_rec_invoice_line_ifc.prorate_across_flag := NULL;
l_rec_invoice_line_ifc.tax_code := NULL;
l_rec_invoice_line_ifc.final_match_flag := NULL;
l_rec_invoice_line_ifc.po_header_id := NULL;
l_rec_invoice_line_ifc.po_number := NULL;
l_rec_invoice_line_ifc.po_line_id := NULL;
l_rec_invoice_line_ifc.po_line_number := NULL;
l_rec_invoice_line_ifc.po_line_location_id := NULL;
l_rec_invoice_line_ifc.po_shipment_num := NULL;
l_rec_invoice_line_ifc.po_distribution_id := NULL;
l_rec_invoice_line_ifc.po_distribution_num := NULL;
l_rec_invoice_line_ifc.po_unit_of_measure := NULL;
l_rec_invoice_line_ifc.inventory_item_id := NULL;
l_rec_invoice_line_ifc.item_description := NULL;
l_rec_invoice_line_ifc.quantity_invoiced := NULL;
l_rec_invoice_line_ifc.ship_to_location_code := NULL;
l_rec_invoice_line_ifc.unit_price := NULL;
l_rec_invoice_line_ifc.distribution_set_id := NULL;
l_rec_invoice_line_ifc.distribution_set_name := NULL;
l_rec_invoice_line_ifc.dist_code_concatenated := NULL;
l_rec_invoice_line_ifc.dist_code_combination_id := rec_cl.dist_code_combination_id;
l_rec_invoice_line_ifc.awt_group_id := NULL;
l_rec_invoice_line_ifc.awt_group_name := NULL;
l_rec_invoice_line_ifc.last_updated_by := g_user_id;
l_rec_invoice_line_ifc.last_update_date := SYSDATE;
l_rec_invoice_line_ifc.last_update_login := g_login_id;
l_rec_invoice_line_ifc.created_by := g_user_id;
l_rec_invoice_line_ifc.creation_date := SYSDATE;
l_rec_invoice_line_ifc.attribute_category := NULL;
l_rec_invoice_line_ifc.attribute1 := NULL;
l_rec_invoice_line_ifc.attribute2 := NULL;
l_rec_invoice_line_ifc.attribute3 := NULL;
l_rec_invoice_line_ifc.attribute4 := NULL;
l_rec_invoice_line_ifc.attribute5 := NULL;
l_rec_invoice_line_ifc.attribute6 := NULL;
l_rec_invoice_line_ifc.attribute7 := NULL;
l_rec_invoice_line_ifc.attribute8 := NULL;
l_rec_invoice_line_ifc.attribute9 := NULL;
l_rec_invoice_line_ifc.attribute10 := NULL;
l_rec_invoice_line_ifc.attribute11 := NULL;
l_rec_invoice_line_ifc.attribute12 := NULL;
l_rec_invoice_line_ifc.attribute13 := NULL;
l_rec_invoice_line_ifc.attribute14 := NULL;
l_rec_invoice_line_ifc.attribute15 := NULL;
l_rec_invoice_line_ifc.global_attribute_category := NULL;
l_rec_invoice_line_ifc.global_attribute1 := NULL;
l_rec_invoice_line_ifc.global_attribute2 := NULL;
l_rec_invoice_line_ifc.global_attribute3 := NULL;
l_rec_invoice_line_ifc.global_attribute4 := NULL;
l_rec_invoice_line_ifc.global_attribute5 := NULL;
l_rec_invoice_line_ifc.global_attribute6 := NULL;
l_rec_invoice_line_ifc.global_attribute7 := NULL;
l_rec_invoice_line_ifc.global_attribute8 := NULL;
l_rec_invoice_line_ifc.global_attribute9 := NULL;
l_rec_invoice_line_ifc.global_attribute10 := NULL;
l_rec_invoice_line_ifc.global_attribute11 := NULL;
l_rec_invoice_line_ifc.global_attribute12 := NULL;
l_rec_invoice_line_ifc.global_attribute13 := NULL;
l_rec_invoice_line_ifc.global_attribute14 := NULL;
l_rec_invoice_line_ifc.global_attribute15 := NULL;
l_rec_invoice_line_ifc.global_attribute16 := NULL;
l_rec_invoice_line_ifc.global_attribute17 := NULL;
l_rec_invoice_line_ifc.global_attribute18 := NULL;
l_rec_invoice_line_ifc.global_attribute19 := NULL;
l_rec_invoice_line_ifc.global_attribute20 := NULL;
l_rec_invoice_line_ifc.po_release_id := NULL;
l_rec_invoice_line_ifc.release_num := NULL;
l_rec_invoice_line_ifc.account_segment := NULL;
l_rec_invoice_line_ifc.balancing_segment := NULL;
l_rec_invoice_line_ifc.cost_center_segment := NULL;
l_rec_invoice_line_ifc.project_id := NULL;
l_rec_invoice_line_ifc.task_id := NULL;
l_rec_invoice_line_ifc.expenditure_type := NULL;
l_rec_invoice_line_ifc.expenditure_item_date := NULL;
l_rec_invoice_line_ifc.expenditure_organization_id := NULL;
l_rec_invoice_line_ifc.project_accounting_context := NULL;
l_rec_invoice_line_ifc.pa_addition_flag := NULL;
l_rec_invoice_line_ifc.pa_quantity := NULL;
l_rec_invoice_line_ifc.ussgl_transaction_code := NULL;
l_rec_invoice_line_ifc.stat_amount := NULL;
l_rec_invoice_line_ifc.type_1099 := NULL;
l_rec_invoice_line_ifc.income_tax_region := NULL;
l_rec_invoice_line_ifc.assets_tracking_flag := NULL;
l_rec_invoice_line_ifc.price_correction_flag := NULL;
l_rec_invoice_line_ifc.org_id := rec_ch.org_id;
l_rec_invoice_line_ifc.receipt_number := NULL;
l_rec_invoice_line_ifc.receipt_line_number := NULL;
l_rec_invoice_line_ifc.match_option := NULL;
l_rec_invoice_line_ifc.packing_slip := NULL;
l_rec_invoice_line_ifc.rcv_transaction_id := NULL;
l_rec_invoice_line_ifc.pa_cc_ar_invoice_id := NULL;
l_rec_invoice_line_ifc.pa_cc_ar_invoice_line_num := NULL;
l_rec_invoice_line_ifc.reference_1 := NULL;
l_rec_invoice_line_ifc.reference_2 := NULL;
l_rec_invoice_line_ifc.pa_cc_processed_code := NULL;
l_rec_invoice_line_ifc.tax_recovery_rate := NULL;
l_rec_invoice_line_ifc.tax_recovery_override_flag := NULL;
l_rec_invoice_line_ifc.tax_recoverable_flag := NULL;
l_rec_invoice_line_ifc.tax_code_override_flag := NULL;
l_rec_invoice_line_ifc.tax_code_id := NULL;
l_rec_invoice_line_ifc.credit_card_trx_id := NULL;
l_rec_invoice_line_ifc.award_id := NULL;
l_rec_invoice_line_ifc.vendor_item_num := NULL;
l_rec_invoice_line_ifc.taxable_flag := NULL;
l_rec_invoice_line_ifc.price_correct_inv_num := NULL;
l_rec_invoice_line_ifc.external_doc_line_ref := NULL;
l_rec_invoice_line_ifc.serial_number := NULL;
l_rec_invoice_line_ifc.manufacturer := NULL;
l_rec_invoice_line_ifc.model_number := NULL;
l_rec_invoice_line_ifc.warranty_number := NULL;
l_rec_invoice_line_ifc.deferred_acctg_flag := NULL;
l_rec_invoice_line_ifc.def_acctg_start_date := NULL;
l_rec_invoice_line_ifc.def_acctg_end_date := NULL;
l_rec_invoice_line_ifc.def_acctg_number_of_periods := NULL;
l_rec_invoice_line_ifc.def_acctg_period_type := NULL;
l_rec_invoice_line_ifc.unit_of_meas_lookup_code := NULL;
l_rec_invoice_line_ifc.price_correct_inv_line_num := NULL;
l_rec_invoice_line_ifc.asset_book_type_code := NULL;
l_rec_invoice_line_ifc.asset_category_id := NULL;
l_rec_invoice_line_ifc.requester_id := NULL;
l_rec_invoice_line_ifc.requester_first_name := NULL;
l_rec_invoice_line_ifc.requester_last_name := NULL;
l_rec_invoice_line_ifc.requester_employee_num := NULL;
l_rec_invoice_line_ifc.application_id := NULL;
l_rec_invoice_line_ifc.product_table := NULL;
l_rec_invoice_line_ifc.reference_key1 := NULL;
l_rec_invoice_line_ifc.reference_key2 := NULL;
l_rec_invoice_line_ifc.reference_key3 := NULL;
l_rec_invoice_line_ifc.reference_key4 := NULL;
l_rec_invoice_line_ifc.reference_key5 := NULL;
l_rec_invoice_line_ifc.purchasing_category := NULL;
l_rec_invoice_line_ifc.purchasing_category_id := NULL;
l_rec_invoice_line_ifc.cost_factor_id := NULL;
l_rec_invoice_line_ifc.cost_factor_name := NULL;
l_rec_invoice_line_ifc.control_amount := NULL;
l_rec_invoice_line_ifc.assessable_value := NULL;
l_rec_invoice_line_ifc.default_dist_ccid := NULL;
l_rec_invoice_line_ifc.primary_intended_use := NULL;
l_rec_invoice_line_ifc.ship_to_location_id := NULL;
l_rec_invoice_line_ifc.product_type := NULL;
l_rec_invoice_line_ifc.product_category := NULL;
l_rec_invoice_line_ifc.product_fisc_classification := NULL;
l_rec_invoice_line_ifc.user_defined_fisc_class := NULL;
l_rec_invoice_line_ifc.trx_business_category := NULL;
l_rec_invoice_line_ifc.tax_regime_code := NULL;
l_rec_invoice_line_ifc.tax := NULL;
l_rec_invoice_line_ifc.tax_jurisdiction_code := NULL;
l_rec_invoice_line_ifc.tax_status_code := NULL;
l_rec_invoice_line_ifc.tax_rate_id := NULL;
l_rec_invoice_line_ifc.tax_rate_code := NULL;
l_rec_invoice_line_ifc.tax_rate := NULL;
l_rec_invoice_line_ifc.incl_in_taxable_line_flag := NULL;
l_rec_invoice_line_ifc.source_application_id := NULL;
l_rec_invoice_line_ifc.source_entity_code := NULL;
l_rec_invoice_line_ifc.source_event_class_code := NULL;
l_rec_invoice_line_ifc.source_trx_id := NULL;
l_rec_invoice_line_ifc.source_line_id := NULL;
l_rec_invoice_line_ifc.source_trx_level_type := NULL;
l_rec_invoice_line_ifc.tax_classification_code := NULL;
l_rec_invoice_line_ifc.cc_reversal_flag := NULL;
l_rec_invoice_line_ifc.company_prepaid_invoice_id := NULL;
l_rec_invoice_line_ifc.expense_group := NULL;
l_rec_invoice_line_ifc.justification := NULL;
l_rec_invoice_line_ifc.merchant_document_number := NULL;
l_rec_invoice_line_ifc.merchant_name := NULL;
l_rec_invoice_line_ifc.merchant_reference := NULL;
l_rec_invoice_line_ifc.merchant_tax_reg_number := NULL;
l_rec_invoice_line_ifc.merchant_taxpayer_id := NULL;
l_rec_invoice_line_ifc.receipt_currency_code := NULL;
l_rec_invoice_line_ifc.receipt_conversion_rate := NULL;
l_rec_invoice_line_ifc.receipt_currency_amount := NULL;
l_rec_invoice_line_ifc.country_of_supply := NULL;
l_rec_invoice_line_ifc.pay_awt_group_id := NULL;
l_rec_invoice_line_ifc.pay_awt_group_name := NULL;
l_rec_invoice_line_ifc.expense_start_date := NULL;
l_rec_invoice_line_ifc.expense_end_date := NULL; INSERT INTO ap_invoice_lines_interface
VALUES l_rec_invoice_line_ifc; END LOOP; --FOR REC_CL IN cur_cl (P_HEADER_ID =>REC_CH.HEADER_ID) LOOP --开始导入 BEGIN l_ret_bool := ap_import_invoices_pkg.import_invoices(p_batch_name => l_invoice_batch,
p_gl_date => NULL,
p_hold_code => NULL,
p_hold_reason => NULL,
p_commit_cycles => NULL,
p_source => 'OA_IMPORT',
p_group_id => 'OA_IMPORT' ||
l_group_id,
p_conc_request_id => fnd_global.conc_request_id,
p_debug_switch => 'N',
p_org_id => NULL,
p_batch_error_flag => l_batch_error_flag, --OUT
p_invoices_fetched => l_invoices_fetched, --OUT
p_invoices_created => l_invoices_created, --OUT
p_total_invoice_amount => l_total_invoice_amount, --OUT for bug 989221
p_print_batch => l_print_batch,
p_calling_sequence => g_pkg_name || '.' ||
l_api_name); --获取导入的发票ID
SELECT i.invoice_id
INTO v_invoice_id
FROM ap_invoices_all i
WHERE i.attribute1 = rec_ch.source_code
AND i.attribute2 = to_char(rec_ch.source_line_id)
AND i.invoice_num = rec_ch.invoice_number
AND i.invoice_type_lookup_code = rec_ch.invoice_type; UPDATE cux_oa_ap_invoice_header h
SET h.process_status = 'COMPLETE',
h.invoice_id = v_invoice_id,
h.last_updated_by = g_user_id,
h.last_update_date = SYSDATE,
h.last_update_login = g_login_id
WHERE h.header_id = rec_ch.header_id; UPDATE oa_ap_invoices_header h
SET h.ebs_process_status = 'COMPLETE'
WHERE h.header_id = rec_ch.source_line_id; UPDATE cux_oa_ap_invoice_line l
SET l.process_status = 'COMPLETE',
l.invoice_id = v_invoice_id,
l.last_updated_by = g_user_id,
l.last_update_date = SYSDATE,
l.last_update_login = g_login_id
WHERE l.header_id = rec_ch.header_id; UPDATE oa_ap_invoices_line l
SET l.ebs_process_status = 'COMPLETE'
WHERE l.header_id = rec_ch.source_line_id; EXCEPTION
WHEN no_data_found THEN
--没有找到,导入失败
UPDATE cux_oa_ap_invoice_header h
SET h.process_message = get_interface_reject(l_rec_invoice_ifc.invoice_id,
l_rec_invoice_line_ifc.invoice_line_id),
h.process_status = 'ERROR',
h.last_updated_by = g_user_id,
h.last_update_date = SYSDATE,
h.last_update_login = g_login_id
WHERE h.header_id = rec_ch.header_id; UPDATE oa_ap_invoices_header h
SET h.ebs_process_status = 'ERROR',
h.ebs_process_message = get_interface_reject(l_rec_invoice_ifc.invoice_id,
l_rec_invoice_line_ifc.invoice_line_id)
WHERE h.header_id = rec_ch.source_line_id; UPDATE cux_oa_ap_invoice_line l
SET l.process_status = 'ERROR',
l.last_updated_by = g_user_id,
l.last_update_date = SYSDATE,
l.last_update_login = g_login_id,
l.process_message = '参考头表错误信息'
WHERE l.header_id = rec_ch.header_id; UPDATE oa_ap_invoices_line l
SET l.ebs_process_status = 'ERROR',
l.ebs_process_message = '参考头表错误信息'
WHERE l.header_id = rec_ch.source_line_id; WHEN OTHERS THEN
l_msg_data := SQLERRM;
UPDATE cux_oa_ap_invoice_header h
SET h.process_message = l_msg_data,
h.process_status = 'ERROR',
h.last_updated_by = g_user_id,
h.last_update_date = SYSDATE,
h.last_update_login = g_login_id
WHERE h.header_id = rec_ch.header_id; UPDATE oa_ap_invoices_header h
SET h.ebs_process_status = 'ERROR',
h.ebs_process_message = l_msg_data
WHERE h.header_id = rec_ch.source_line_id; UPDATE cux_oa_ap_invoice_line l
SET l.process_status = 'ERROR',
l.last_updated_by = g_user_id,
l.last_update_date = SYSDATE,
l.last_update_login = g_login_id,
l.process_message = '参考头表错误信息'
WHERE l.header_id = rec_ch.header_id; UPDATE oa_ap_invoices_line l
SET l.ebs_process_status = 'ERROR',
l.ebs_process_message = '参考头表错误信息'
WHERE l.header_id = rec_ch.source_line_id;
END; ----开始导入 END LOOP; --FOR REC_CH IN cur_ch LOOP x_return_status := cux_api.end_activity(p_pkg_name => g_pkg_name,
p_api_name => l_api_name,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data);
EXCEPTION
WHEN fnd_api.g_exc_error THEN
x_return_status := cux_api.handle_exceptions(p_pkg_name => g_pkg_name,
p_api_name => l_api_name,
p_exc_name => cux_api.g_exc_name_error,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data);
WHEN fnd_api.g_exc_unexpected_error THEN
x_return_status := cux_api.handle_exceptions(p_pkg_name => g_pkg_name,
p_api_name => l_api_name,
p_exc_name => cux_api.g_exc_name_unexp,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data);
WHEN OTHERS THEN
x_return_status := cux_api.handle_exceptions(p_pkg_name => g_pkg_name,
p_api_name => l_api_name,
p_exc_name => cux_api.g_exc_name_others,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data);
END process_cux_to_ap;

AP INVOICES IMPORT API(NOT request)的更多相关文章

  1. Elasticsearch7.X 入门学习第四课笔记---- Search API之(Request Body Search 和DSL简介)

    原文:Elasticsearch7.X 入门学习第四课笔记---- Search API之(Request Body Search 和DSL简介) 版权声明:本文为博主原创文章,遵循CC 4.0 BY ...

  2. Express4.x常用API(二):Request

    这是第二篇了,打算每天都拿些时间去详细的看看文档来自学下express吧,接下来就开始了,这次依然是有选择性的找API根据自己的理解翻译过来,方便日后开发时候的自己查阅,由于水平有限,大概也会在使用过 ...

  3. [Unit Testing] Node testing: Test api Get request

    Using mocha: "devDependencies": { "should": "^5.2.0", "supertest& ...

  4. .net core web api 获取request body的纯文本

    本文代码 https://github.com/wuhaibo/readPlainTextDotNetCoreWepApi 总有些时候我们希望获得Request body 的纯文本 那么怎么做呢?很简 ...

  5. 记录web api的request以及response(即写log)

    https://www.cnblogs.com/felixnet/p/5689501.html https://blog.csdn.net/Vblegend_2013/article/details/ ...

  6. Vue 项目添加单元测试发现的问题及解决

    用 Jest 测试单文件组件 1.安装 Jest 和 Vue Test Utils npm install --save-dev jest @vue/test-utils 2.配置 package.j ...

  7. Flask Rest接口

    Flask适用于简单的接口请求 安装 pip install Flask pip install Flask-RESTful 仅简单请求url,然后出发处理程序,返回处理结果 app.py代码如下 f ...

  8. Vue项目开发最新、最全代码规范文档

    Vue项目开发最新.最全代码规范文档 2019年02月21日 10:43:49 yw00yw 阅读数 337   一. 目录结构 |— build 构建脚本目录 |— build.js 生产环境构建( ...

  9. 小程序封装request请求,统一API

    程序开发中都会调用后端工程师开发的API,小程序的开发文档提供了相对实用的APIwx.request(),但是在开发的过程中,又遇到了一些问题,在小程序的项目开发时,调用的API不止一个,同一个API ...

随机推荐

  1. 浏览器加载和渲染html的顺序(html/css/js)

    最近在学习前端的技术,把html.js.css的基础知识看了看.感觉越看越觉得前端并不比后端容易,技术含量还是相当大的.今天突然想弄明白浏览器到底是怎么加载和渲染html的?html中的DOM.js文 ...

  2. Linux块设备加密之dm-crypt分析

    相关的分析工作一年前就做完了,一直懒得写下来.现在觉得还是写下来,以来怕自己忘记了,二来可以给大家分享一下自己的研究经验. 这篇文章算是<Device Mapper代码分析>的后续篇,因为 ...

  3. Dynamics CRM2013 6.1.1.1143版本插件注册器的一个bug

    最近在做的项目客户用的是CRM2013sp1版本,所以插件注册器使用的也是与之对应的6.1.1.1143,悲剧的事情也因此而开始. 在插件中注册step时,工具里有个run in user's con ...

  4. GDAL 2.0版本RPC校正速度测试

    GDAL2.0版本的更新日志中提到了对RPC校正的优化,今天测试了一下,发现提升的速度还是蛮快的,测试的数据是一个IRS-P5的数据. 单线程测试 首先使用一个线程进行测试,使用下面的批处理进行运行, ...

  5. 学习TensorFlow,保存学习到的网络结构参数并调用

    在深度学习中,不管使用那种学习框架,我们会遇到一个很重要的问题,那就是在训练完之后,如何存储学习到的深度网络的参数?在测试时,如何调用这些网络参数?针对这两个问题,本篇博文主要探索TensorFlow ...

  6. UNIX网络编程——UNIX域套接字编程和socketpair 函数

    一.UNIX Domain Socket IPC socket API原本是为网络通讯设计的,但后来在socket的框架上发展出一种IPC机制,就是UNIX Domain Socket.虽然网络soc ...

  7. 【Unity Shaders】Shader学习资源和Surface Shader概述

    写在前面 写这篇文章的时候,我断断续续学习Unity Shader半年了,其实还是个门外汉.我也能体会很多童鞋那种想要学好Shader却无从下手的感觉.在这个期间,我找到一些学习Shader的教程以及 ...

  8. Xcode中Objc动态调用方法同时避免警告的几个办法

    我们在Xcode中使用objc写代码的时候往往会碰到动态调用方法的时候. 如果是静态调用这很常见,不会有任何问题: [self performSelector:@selector(method)]; ...

  9. Android学习笔记之AppWidget

    什么是AppWidget?AppWidget就是我们平常在桌面上见到的那种一个个的小窗口,利用这个小窗口可以给用户提供一些方便快捷的操作. 今天的目标就是怎么创建一个简单的AppWidget. 首先我 ...

  10. 海量数据挖掘MMDS week5: 聚类clustering

    http://blog.csdn.net/pipisorry/article/details/49427989 海量数据挖掘Mining Massive Datasets(MMDs) -Jure Le ...