标签归档:发票

EBS web页面Internal Server Error错误

    今天财务人员在系统内做批量付款的时候,点击最终完成应用付款的时候,系统一直处于运行状态,但却一直无法完成付款,过几分钟后,直接跳转至如下图所示的界面:

error

这是第三次出现这样类似的问题,从遇到的情况主要可能有如下两点原因:

1. 表空间不足,特别是临时表空间不足(第一次出现是因为此问题造成)

   解决方法:增加表空间,通过脚本查询出需要增加的表空间,增加即可(一般须有DBA执行增加表空间操作),命令如下所示:

select upper(f.tablespace_name) "表空间名",
       d.tot_grootte_mb "表空间大小(M)",
       d.tot_grootte_mb – f.total_bytes "已使用空间(M)",
       to_char(round((d.tot_grootte_mb – f.total_bytes) / d.tot_grootte_mb * 100,
                     2),
               '990.99') || '%' "使用比",
       f.total_bytes "空闲空间(M)",
       f.max_bytes "最大块(M)"
  from (select tablespace_name,
               round(sum(bytes) / (1024 * 1024), 2) total_bytes,
               round(max(bytes) / (1024 * 1024), 2) max_bytes
          from sys.dba_free_space
         group by tablespace_name) f,
       (select dd.tablespace_name,
               round(sum(dd.bytes) / (1024 * 1024), 2) tot_grootte_mb
          from sys.dba_data_files dd
         group by dd.tablespace_name) d
 where d.tablespace_name = f.tablespace_name
 order by 1;

2. 锁表,与付款相关的表被锁住(其中两次是此问题造成)

   解决方法:通过如下命令查出被锁住的表,最后一个字段即是解锁命令,在COMMAND命令行执行即可,特别是locked_mode为‘6’的在很大程度上是不应该存在的,具体原因请自行网络上搜索。

select dob.object_name table_name,
       lo.locked_mode,
       lo.session_id,
       vss.serial#,
       vps.spid,
       vss.action action,
       vss.osuser osuser,
       vss.process ap_pid,
       vps.spid db_pid,
       'alter system kill session ' || '''' || lo.session_id || ',' ||
       vss.serial# || ''';' kill_command
  from v$locked_object lo, dba_objects dob, v$session vss, v$process vps
 where lo.object_id = dob.object_id
   and lo.session_id = vss.sid
   and vss.paddr = vps.addr
 order by 2, 3, dob.object_name;

lock

最终执行命令如下所示示例:

alter system kill session '38,19020';
alter system kill session '278,3533';
alter system kill session '293,3774';
alter system kill session '1016,64895';
alter system kill session '1054,9699';
alter system kill session '1780,20723';
 

 

获取待核销或者待付款的发票信息

select ai.org_id,
       ai.invoice_id,
       aps.vendor_name,
       ai.invoice_num,
       –ail.attribute1, –标准发票中存储预付款发票编号
       nvl(sum(ail.amount + nvl((select sum(zl.tax_amt)
                                  from zx_lines zl
                                 where ail.invoice_id = zl.trx_id
                                   and ail.line_number = zl.trx_line_id
                                   and (zl.tax_amt_included_flag is null or
                                       zl.tax_amt_included_flag = 'N')),
                                0)),
           0) invoice_amount_remaining,
       nvl(sum(ap_prepay_utils_pkg.get_invoice_unpaid_amount(ai.invoice_id) +
               nvl(ai.total_tax_amount, 0)),
           0) invoice_unpaid, –未付或未核销金额
       ai.gl_date,
       ai.vendor_id,
       ai.vendor_site_id,
       ai.invoice_currency_code,
       ai.set_of_books_id,
       ail.line_number

  from ap_invoices_all      ai,
       ap_invoice_lines_all ail,
       gl_code_combinations gcc,
       ap_suppliers         aps
 where 1 = 1
   and ai.invoice_id = ail.invoice_id
   and aps.vendor_id = ai.vendor_id
   and ai.accts_pay_code_combination_id = gcc.code_combination_id
   and ail.line_type_lookup_code(+) = 'ITEM'
      –只获取已付金额小于总金额的发票
   and nvl(ai.amount_paid, 0) < ai.invoice_amount
      –根据需要是否需要验证或者不验证核销(排除取消过的发票)
      –APPROVED已验证,NEVER APPROVED从未验证
   and ap_invoices_utility_pkg.get_approval_status(ai.invoice_id,
                                                   ai.invoice_amount,
                                                   ai.payment_status_flag,
                                                   ai.invoice_type_lookup_code) <>
       'CANCELLED'
   and ai.invoice_type_lookup_code = 'STANDARD'
— and ail.attribute1 is not null
— and ai.org_id = p_org_id
— and (ai.vendor_id = p_vendor_id or p_vendor_id is null)
 group by ai.invoice_id,
          ai.invoice_num,
          ai.org_id,
          ai.gl_date,
          ai.vendor_id,
          aps.vendor_name,
          ai.vendor_site_id,
          ai.invoice_currency_code,
          ai.set_of_books_id,
          ail.line_number,
          ai.creation_date
          –ail.attribute1
 order by ai.creation_date;