Oracle EBS VMI/寄售(5)--不能自动产生AP Invoice

       在之前Oracle EBS 寄销/VMI(1)-->基础设置评论中,有朋友问我没有设置供应商Pay On会有什么样的后果?其后后果如下情况:不能自动创建AP Invoice。

      某供应商要从标准PO转换到BPA,由于财务忽略了对供应商地点层“Purchasing”的“Pay On”设置为“Use”,从而导致该供应商不能自动创建AP Invoice。

Oracle EBS VMI/寄售(5)--不能自动产生AP Invoice_第1张图片

注意:在启用自动创建APInvoice时,Pay On有三个项

1.      Use:表示寄售/VMI耗用时,自动创建AP Invoice。

2.      Receipt:表示采购接收入库时,自动创建AP Invoice

3.      Receipt and Use:待测试

通过“Purchase Order Summary”。输入对应的供应商,采购订单类型为“Blanket Purchase Agreement,勾选“View Releases”,点击查找,显示字段“Pay On Code,PO Number211000025333部分记录“Pay On Code”空。

Oracle EBS VMI/寄售(5)--不能自动产生AP Invoice_第2张图片

通过并发请求“Pay On Receipt AutoInvoice”的源代码查看,包过程“PO_INVOICES_SV2. create_use_invoices,游标c_consumption的代码

<span style="font-size:18px;">/* Cursor for fetching consumption advice */
  CURSOR c_consumption(p_cutoff_date DATE,p_vendor_id number,p_vendor_site_id number) IS
  -- std PO referencing Global Agreement
    SELECT poh.po_header_id PO_HEADER_ID,
           TO_NUMBER(NULL) PO_RELEASE_ID, -- bug2840859
           pol.po_line_id PO_LINE_ID,
           poll.line_location_id LINE_LOCATION_ID,
           pod.po_distribution_id PO_DISTRIBUTION_ID,
           pv.vendor_id VENDOR_ID,
           pvs.pay_on_receipt_summary_code PAY_ON_RECEIPT_SUMMARY_CODE,
           poh.vendor_site_id VENDOR_SITE_ID,
           NVL(pvs.default_pay_site_id, pvs.vendor_site_id) DEFAULT_PAY_SITE_ID,
           pol.item_description ITEM_DESCRIPTION,
           poll.price_override UNIT_PRICE,
           pod.quantity_ordered QUANTITY,
           NVL(pod.quantity_billed, 0) QUANTITY_BILLED,
           poh.currency_code CURRENCY_CODE,
           poh.rate_type CURRENCY_CONVERSION_TYPE,
           poh.rate CURRENCY_CONVERSION_RATE,
           poh.rate_date CURRENCY_CONVERSION_DATE,
           NVL(pvs.payment_currency_code,
               NVL(pvs.invoice_currency_code, poh.currency_code)) PAYMENT_CURRENCY_CODE,
           poh.creation_date CREATION_DATE,
           NVL(NVL(poll.terms_id, poh.terms_id), pvs2.terms_id) PAYMENT_TERMS_ID,
           DECODE(poll.taxable_flag, 'Y', poll.tax_code_id, NULL) TAX_CODE_ID,
           NVL(pvs.ap_tax_rounding_rule, 'N') TAX_ROUNDING_RULE,
           NVL(pvs.auto_tax_calc_flag, 'N') AUTO_TAX_CALC_FLAG,
           poh.org_id ORG_ID
      FROM PO_VENDORS        pv,
           PO_VENDOR_SITES   pvs,
           PO_VENDOR_SITES   pvs2,
           PO_HEADERS        poh,
           PO_LINES          pol,
           PO_LINE_LOCATIONS poll,
           PO_DISTRIBUTIONS  pod
     WHERE pv.vendor_id = poh.vendor_id
       AND poh.vendor_site_id = pvs.vendor_site_id
       AND NVL(pvs.default_pay_site_id, pvs.vendor_site_id) =
           pvs2.vendor_site_id
       AND poh.po_header_id = pol.po_header_id
       AND pol.po_line_id = poll.po_line_id
       AND poll.line_location_id = pod.line_location_id
       and pv.vendor_id = p_vendor_id
       AND poh.vendor_site_id = p_vendor_site_id
       AND poh.pay_on_code IN ('RECEIPT_AND_USE', 'USE')
       AND DECODE(poh.consigned_consumption_flag, -- utilize PO_HEADERS_F1 idx
                  'Y',
                  DECODE(poh.closed_code, 'FINALLY CLOSED', NULL, 'Y'),
                  NULL) = 'Y'
       AND poh.type_lookup_code = 'STANDARD'
       AND poh.creation_date <= p_cutoff_date
       AND pvs.pay_on_code IN ('RECEIPT_AND_USE', 'USE')
       AND pod.quantity_ordered > NVL(pod.quantity_billed, 0)
       AND poll.closed_code <> 'FINALLY CLOSED'
    UNION ALL
    --blanket release 如下对应一揽子发放的SQL
    SELECT poh.po_header_id PO_HEADER_ID,
           por.po_release_id PO_RELEASE_ID,
           pol.po_line_id PO_LINE_ID,
           poll.line_location_id LINE_LOCATION_ID,
           pod.po_distribution_id PO_DISTRIBUTION_ID,
           pv.vendor_id VENDOR_ID,
           pvs.pay_on_receipt_summary_code PAY_ON_RECEIPT_SUMMARY_CODE,
           poh.vendor_site_id VENDOR_SITE_ID,
           NVL(pvs.default_pay_site_id, pvs.vendor_site_id) DEFAULT_PAY_SITE_ID,
           pol.item_description ITEM_DESCRIPTION,
           poll.price_override UNIT_PRICE,
           pod.quantity_ordered QUANTITY,
           NVL(pod.quantity_billed, 0) QUANTITY_BILLED,
           poh.currency_code CURRENCY_CODE,
           poh.rate_type CURRENCY_CONVERSION_TYPE,
           poh.rate CURRENCY_CONVERSION_RATE,
           poh.rate_date CURRENCY_CONVERSION_DATE,
           NVL(pvs.payment_currency_code,
               NVL(pvs.invoice_currency_code, poh.currency_code)) PAYMENT_CURRENCY_CODE,
           por.creation_date CREATION_DATE,
           NVL(NVL(poll.terms_id, poh.terms_id), pvs2.terms_id) PAYMENT_TERMS_ID,
           DECODE(poll.taxable_flag, 'Y', poll.tax_code_id, NULL) TAX_CODE_ID,
           NVL(pvs.ap_tax_rounding_rule, 'N') TAX_ROUNDING_RULE,
           NVL(pvs.auto_tax_calc_flag, 'N') AUTO_TAX_CALC_FLAG,
           por.org_id ORG_ID
      FROM PO_VENDORS        pv,
           PO_VENDOR_SITES   pvs,
           PO_VENDOR_SITES   pvs2,
           PO_HEADERS        poh,
           PO_RELEASES       por,
           PO_LINES          pol,
           PO_LINE_LOCATIONS poll,
           PO_DISTRIBUTIONS  pod
     WHERE pv.vendor_id = poh.vendor_id
       AND poh.vendor_site_id = pvs.vendor_site_id
       AND NVL(pvs.default_pay_site_id, pvs.vendor_site_id) =
           pvs2.vendor_site_id
       AND poh.po_header_id = por.po_header_id
       AND poh.po_header_id = pol.po_header_id
       AND pol.po_line_id = poll.po_line_id
       AND por.po_release_id = poll.po_release_id
       AND poll.line_location_id = pod.line_location_id
       and pv.vendor_id = p_vendor_id
       AND poh.vendor_site_id = p_vendor_site_id
       AND por.pay_on_code IN ('RECEIPT_AND_USE', 'USE')--对应的供应商地点未设置Pay On值,创建冲减通知时,产生的一榄子发放Pay_on_code会为空值
      AND DECODE(por.consigned_consumption_flag, -- utilize PO_RELEASES_F1 idx
                  'Y',
                  DECODE(por.closed_code, 'FINALLY CLOSED', NULL, 'Y'),
                  NULL) = 'Y'
       AND por.release_type = 'BLANKET'
       AND por.creation_date <= p_cutoff_date
       AND pvs.pay_on_code IN ('RECEIPT_AND_USE', 'USE')
       AND pod.quantity_ordered > NVL(pod.quantity_billed, 0)
       AND poll.closed_code <> 'FINALLY CLOSED'
     ORDER BY 6, -- VENDOR_ID
              9, -- DEFAULT_PAY_SITE_ID
              7, -- PAY_ON_RECEIPT_SUMMARY_CODE
              15, -- CURRENCY_CODE
              18, -- CURRENCY_CONVERSION_DATE  -- bug2786193
              16, -- CURRENCY_CONVERSION_TYPE  -- bug2786193
              17, -- CURRENCY_CONVERSION_RATE  -- bug2786193
              20, -- PAYMENT_TERMS_ID
              -- 19,   -- CREATION_DATE          -- bug2786193
              1, -- PO_HEADER_ID
              2, -- PO_RELEASE_ID
              3, -- PO_LINE_ID
              4, -- LINE_LOCATION_ID
              5; -- DISTRIBUTION_ID
</span>

修改代码:

--查找出Pay On为空的记录
Select PHA.SEGMENT1,PRA.PAY_ON_CODE
  From PO_HEADERS_ALL PHA, PO_RELEASES_ALL PRA
 Where PHA.PO_HEADER_ID = PRA.PO_HEADER_ID
   And PHA.SEGMENT1 = '211000025333'And PRA.PAY_ON_CODE Is Null
--后台修改Pay On空记录,PAY_ON_CODE ='USE'
Update PO_RELEASES_ALL
   Set PAY_ON_CODE = 'USE'
 Where PO_HEADER_ID In (Select PHA.PO_HEADER_ID
                          From PO_HEADERS_ALL PHA, PO_RELEASES_ALL PRA
                         Where PHA.PO_HEADER_ID = PRA.PO_HEADER_ID
                           And PHA.SEGMENT1 = '211000025333'
                           And PRA.PAY_ON_CODE Is Null)

            然后,提交请求“Pay On Receipt AutoInvoice”,成功产生AP Invoice。

       如何测试你修改的方法是否正确?
       1.把刚才产生的AP Invoice取消。重新提交一次请求“Pay On Receipt AutoInvoice”,仍然能功成功产生AP Invoice。
       2.对于产生的AP Invoice一一核对AP Invoice的匹配行的匹配数据、金额和相关的PO字段,没有发现有问题的记录。

      3.将AP Invoice验证过帐传送至GL总帐,用PO、AP和GL相关报表核对科目余额和发生额
      若没有问题表明接直修改PO_RELEASES_ALL. PAY_ON_CODE值为USE没有问题。

 

你可能感兴趣的:(Oracle EBS VMI/寄售(5)--不能自动产生AP Invoice)