AP INVOICES IMPORT API(NOT request)
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)的更多相关文章
- Elasticsearch7.X 入门学习第四课笔记---- Search API之(Request Body Search 和DSL简介)
原文:Elasticsearch7.X 入门学习第四课笔记---- Search API之(Request Body Search 和DSL简介) 版权声明:本文为博主原创文章,遵循CC 4.0 BY ...
- Express4.x常用API(二):Request
这是第二篇了,打算每天都拿些时间去详细的看看文档来自学下express吧,接下来就开始了,这次依然是有选择性的找API根据自己的理解翻译过来,方便日后开发时候的自己查阅,由于水平有限,大概也会在使用过 ...
- [Unit Testing] Node testing: Test api Get request
Using mocha: "devDependencies": { "should": "^5.2.0", "supertest& ...
- .net core web api 获取request body的纯文本
本文代码 https://github.com/wuhaibo/readPlainTextDotNetCoreWepApi 总有些时候我们希望获得Request body 的纯文本 那么怎么做呢?很简 ...
- 记录web api的request以及response(即写log)
https://www.cnblogs.com/felixnet/p/5689501.html https://blog.csdn.net/Vblegend_2013/article/details/ ...
- Vue 项目添加单元测试发现的问题及解决
用 Jest 测试单文件组件 1.安装 Jest 和 Vue Test Utils npm install --save-dev jest @vue/test-utils 2.配置 package.j ...
- Flask Rest接口
Flask适用于简单的接口请求 安装 pip install Flask pip install Flask-RESTful 仅简单请求url,然后出发处理程序,返回处理结果 app.py代码如下 f ...
- Vue项目开发最新、最全代码规范文档
Vue项目开发最新.最全代码规范文档 2019年02月21日 10:43:49 yw00yw 阅读数 337 一. 目录结构 |— build 构建脚本目录 |— build.js 生产环境构建( ...
- 小程序封装request请求,统一API
程序开发中都会调用后端工程师开发的API,小程序的开发文档提供了相对实用的APIwx.request(),但是在开发的过程中,又遇到了一些问题,在小程序的项目开发时,调用的API不止一个,同一个API ...
随机推荐
- Objective-C点语法
Objective-C点语法 点语法可以简单的理解成是为了让Java等语言的开发人员能够快速适应OC语言而添加的一个新写法 因为Java里没有指针,也没有[xxx xxx]这种调用方式,都是使用点xx ...
- Android Studio精彩案例(二)《仿微信动态点击底部tab切换Fragment》
转载本专栏文章,请注明出处,尊重原创 .文章博客地址:道龙的博客 现在很多的App要么顶部带有tab,要么就底部带有tab.用户通过点击tab从而切换不同的页面(大部分情况时去切换fragment). ...
- 剑指Offer——如何做好自我介绍
剑指Offer--如何做好自我介绍 前言 自我特点+经历梳理 各位老师好,我叫某某某,XX人.研究生三年级,就读于某某大学信息科学与工程学院软件工程专业.主要使用的开发语言是Java,熟悉基本数据 ...
- python 3.3.3 字面量,正则,反斜杠和原始字符串
两个不起眼但是比较重要的设定 Python str类型的字面量解释器 当反斜杠及其紧接字符无法构成一个具有特殊含义的序列('recognized escape sequences')时,Python选 ...
- Dynamics CRM2013 从subgrid中打开快速创建窗体创建数据
在页面上使用subgrid时,在subgrid中新建数据时需要跳转到另一个页面,这种操作比较麻烦且很不友好,这时我们想到了快速创建窗体,像下图这样直接在当前页上方下拉出现一个窗体,填写内容后点击保存就 ...
- android 图片网络下载github开源框架之Universal-Image-Loader
最近在做妙趣剪纸项目,剪纸应用项目链接.发扬传统文化,大家多多关注. 需要自己搭建服务器,我用的是新浪sae,简直秒杀京东云几条街,把图片放在网上下载,但是图片经常下载要遇到很多问题,包括oom等.所 ...
- Android自定义处理崩溃异常
用过安卓手机的用户以及安卓开发者们会时长碰到程序异常退出的情况,普通用户遇到这种情况,肯定非常恼火,甚至会骂一生垃圾软件,然后卸载掉.那么开发者们在开发过程中遇到这种情况给怎么办呢,当然,你不可能世界 ...
- Struts 1 之<logic>标签库
1. logic:empty logic:empty标签是用来判断是否为空的.如果为空,该标签体中嵌入的内容就会被处理.该标签用于以下情况: 当Java对象为null时 当String对象为" ...
- 18 UI美化状态集合的位图selector
当我们某个控件 想在不同状态下显示不同的背景图的需求 如我们需要按钮在正常状态显示一种图 按下显示另一背景图 或者单选框被选中时是一种显示图片 没选中是另一种背景图 例子 按钮在不同状态显示不同的背景 ...
- javascript之页面打印
WebBrowser组件是IE内置的浏览器控件,使用时,首先要在<body>标签的下面用<object>...</object>标记声明WebBrowser组件,代 ...