API Модуль AP: Отмена счет-фактуры
3 Апрель 2014
Нет комментариев
Пример использования API для отмены счет-фактуры
declare l_result BOOLEAN; l_all_count NUMBER := 0; l_not_cancel_count NUMBER := 0; l_error_count NUMBER := 0; l_successful_count NUMBER := 0; -- lx_error_code VARCHAR2(100); lx_debug_info VARCHAR2(400); -- lx_message_name VARCHAR2(400); lx_invoice_amount NUMBER; lx_base_amount NUMBER; lx_temp_cancelled_amount NUMBER; lx_cancelled_by NUMBER; lx_cancelled_amount NUMBER; lx_cancelled_date DATE; lx_last_update_date DATE; lx_original_prepayment_amount NUMBER; lx_pay_curr_invoice_amount NUMBER; lx_token VARCHAR2(400); begin fnd_global.apps_initialize(-1, 20639, 200); --Диспетчер кредиторов - Кредиторы mo_global.init('SQLAP'); for i in (select i.invoice_id, i.invoice_num from ap_invoices_all i where 1=1 ... --and rownum<=5 ) loop l_all_count := l_all_count + 1; l_result :=ap_cancel_pkg.is_invoice_cancellable( p_invoice_id => i.invoice_id, p_error_code => lx_error_code, p_debug_info => lx_debug_info, p_calling_sequence => NULL ); if NOT l_result then l_not_cancel_count:= l_not_cancel_count+ 1; dbms_output.put_line ('Invoice '||i.invoice_num||' is not cancellable' ); continue; end if; l_result := ap_cancel_pkg.ap_cancel_single_invoice( p_invoice_id => i.invoice_id, p_last_updated_by => fnd_global.user_id, p_last_update_login => fnd_global.login_id, p_accounting_date => sysdate, p_message_name => lx_message_name, p_invoice_amount => lx_invoice_amount, p_base_amount => lx_base_amount, p_temp_cancelled_amount => lx_temp_cancelled_amount, p_cancelled_by => lx_cancelled_by, p_cancelled_amount => lx_cancelled_amount, p_cancelled_date => lx_cancelled_date, p_last_update_date => lx_last_update_date, p_original_prepayment_amount => lx_original_prepayment_amount, p_pay_curr_invoice_amount => lx_pay_curr_invoice_amount, p_token => lx_token, p_calling_sequence => NULL ); if NOT l_result then l_error_count := l_error_count + 1; dbms_output.put_line('Error for invoice '||i.invoice_num||':'||lx_message_name); continue; else dbms_output.put_line('Successfully cancelled the invoice '||i.invoice_num ); l_successful_count := l_successful_count + 1; end if; end loop; commit; dbms_output.put_line(''); dbms_output.put_line('----------------------------------------'); dbms_output.put_line('Total info:'); dbms_output.put_line('----------------------------------------'); dbms_output.put_line(' ALL COUNT = '||l_all_count); dbms_output.put_line('IS NOT CANCELLABLE = '||l_not_cancel_count); dbms_output.put_line(' ERROR COUNT = '||l_error_count); dbms_output.put_line(' SUCCESSFUL COUNT = '||l_successful_count); dbms_output.put_line('----------------------------------------'); end;
Categories: API, Oracle e-Business Suite AP, ap_cancel_pkg, ap_cancel_single_invoice, API, cancel, invoice, is_invoice_cancellable, SQLAP
Последние комментарии