Wednesday, May 25, 2016

To Check AP Invoices are Validated or Not

using the below query can check the invoice status.

SELECT                 DECODE(AP_INVOICES_UTILITY_PKG.GET_APPROVAL_STATUS(AIA.INVOICE_ID,AIA.INVOICE_AMOUNT,AIA.PAYMENT_STATUS_FLAG,AIA.INVOICE_TYPE_LOOKUP_CODE),
                'FULL'            , 'Fully Applied',
                'NEVER APPROVED'  , 'Never Validated',
                'NEEDS REAPPROVAL', 'Needs Revalidation',
                'CANCELLED'       , 'Cancelled',
                'UNPAID'          , 'Unpaid',
                'AVAILABLE'       , 'Available',
                'UNAPPROVED'      , 'Unvalidated',
                'APPROVED'        , 'Validated',
                'PERMANENT'       , 'Permanent Prepayment',
                NULL
        FROM   
                AP_INVOICES_ALL AIA
        WHERE   AIA.INVOICE_NUM = 'Z234'


There is no column in the AP_INVOICES_ALL table that stores the validation status.
Invoice Distributions are validated individually and the status is stored at the Invoice Distributions level. 
This status is stored in  the match_status_flag column of the ap_invoice_distributions_all table (AP_INVOICE_DISTRIBUTIONS_ALL.MATCH_STATUS_FLAG).
Valid values for this column are: 
   A - Validated (it used to be called Approved)
   N or null - Never validated
   T - Tested but not validated
   S - Stopped
The invoice header form derives the invoice validation status based on the following:
Validated:
  • If ALL of the invoice distributions have a MATCH_STATUS_FLAG = 'A' 
  • If MATCH_STATUS_FLAG is 'T' on ALL the distributions and org has no encumbrance enabled then Invoice would show Validated (provided there is no Unreleased Hold)
Never Validated:
  • If all of the invoice distributions have a MATCH_STATUS_FLAG = null or 'N'
Needs Revalidation:
  • If any of the invoice distributions have a MATCH_STATUS_FLAG = 'T' and the org has Encumbrance enabled
  • If the invoice distributions have MATCH_STATUS_FLAG values = 'N', null and 'A' (mixed)
  • If the invoice distributions have MATCH_STATUS_FLAG value = 'S' (stopped)
  • If there are any rows in AP_HOLDS that do not have a release code
MATCH_STATUS_FLAG would remain 'T' if invoice has hold which does not allow Accounting. In such scenario you can not account the invoice because event status will be 'I'.
As soon as Hold is released from Holds Tab/Invoice Workbench event status is set to 'U'. Invoice is shown as Validated and accounting is allowed. Match_Status_Flag still remains 'T'.

To Check AP Invoices are Accounted or Not


There are 4 different types of Accounting status exist in AP Invoices as below

'S' - Selected
'P' - Partial
'N' - Unposted
'Y' - Posted


Invoice is Validated but not Posted (not Accounted).


SELECT INVOICE_NUM
FROM AP_INVOICES_ALL
WHERE AP_INVOICES_PKG.GET_APPROVAL_STATUS
 (INVOICE_ID,
 INVOICE_AMOUNT,
 PAYMENT_STATUS_FLAG,
 INVOICE_TYPE_LOOKUP_CODE
 ) ='APPROVED'
 AND AP_INVOICES_PKG.GET_POSTING_STATUS(INVOICE_ID)='N'

Invoice is Validated and Posted (Accounted). 

SELECT INVOICE_NUM
FROM AP_INVOICES_ALL
WHERE AP_INVOICES_PKG.GET_APPROVAL_STATUS
 (INVOICE_ID,
 INVOICE_AMOUNT,
 PAYMENT_STATUS_FLAG,
 INVOICE_TYPE_LOOKUP_CODE
 ) ='APPROVED'
 AND AP_INVOICES_PKG.GET_POSTING_STATUS(INVOICE_ID)='P'

Friday, May 20, 2016

Reason for PPR not selecting AP Invoices

Below are the reasons for PPR are not selecting the invoices.

1. The invoice should not be selected by any other PPR

                 Action: confirm the checkrun_id is null in ap_payment_schedules_all.

2. The payment schedule's relevant date should be between the PPR's Pay From and Pay Through dates. The relevant date for selection can be either a discount date or the due date

(a) If the due date is between the pay from and pay through dates, the payment schedule will be eligible for selection regardless of the discount date.

Action: Find the due_date in ap_payment_schedules_all.

Find the pay_from_date and pay_thru_date in ap_inv_selection_criteria_all.

If the pay_from_date is null, just confirm the due_date is less than or equal to the pay_thru_date.

If the pay_from_date is not null, confirm the due_date is greater than or equal to the pay_from_date and the due_date is less than or equal to the pay_thru_date.

If this test passes, skip to Step 3.

(b) If the due_date doesn't fall within the parameters, we must rely on the discount date(s). However, this is only available when pay_only_when_due_flag is not Y

Action: Check the pay_only_when_due_flag in ap_inv_selection_criteria_all.

If this is Y, the payment schedule did not fall within the required date parameters and was not selected for that reason.

If it is null or N, continue to the next step.

(c) Determine the relevant discount date.

Action: Confirm the pay_date_basis_lookup_code in ap_supplier_sites_all is discount.

If not, the invoice won't be selected.

See if the always_take_disc_flag in ap_supplier_sites_all is Y.

If yes, then the relevant date is the discount_date from ap_payment_schedules_all.

If no, then find the check_date from ap_inv_selection_criteria_all.

Make the following comparisons and take the date from the first one that is true.

If the check_date is on or before discount date, take the discount date.

If the check_date is on or before the second discount date, take the second discount date.

If the check_date is on or before the third discount date, take the third discount date.

If none of the above is true, the invoice will not be selected.

(d) Confirm the relevant discount date is within the date parameters.

If the always_take_disc_flag is Y, the discount date from Step (c) must be between the pay_from_date and the pay_thru_date, inclusive.

If the always_take_disc_flag is Y and the pay_from_date is null, the discount date from Step (c) just has to be on or before the pay_thru_date.

If the always_take_disc_flag is N, the discount date from Step (c) must be between the check date and the pay_thru_date, inclusive.

3. The payment schedule cannot be fully paid

Action: Confirm the payment_status_flag in ap_payment_schedules_all is N or P

Also confirm the payment_status_flag in ap_invoices_all is N or P

4. The invoice cannot be subject to forced revalidation

Action: Confirm the force_revalidation_flag in ap_invoices_all is N or Null.

5. The payment schedule's payment priority must be between the Payment Priority High and Payment Priority Low parameters designated for the PPR

Action: Find the payment_priority from ap_payment_schedules_all.

Null counts as 99.

Confirm this is between the hi_payment_priority and low_payment_priority, inclusive, from ap_inv_selection_criteria_all.

6. Cancelled invoices will not be selected

Action: Confirm the cancelled_date is null in ap_invoices_all.

7. There cannot be a hold on the payment schedule

Action: Confirm the hold_flag in ap_payment_schedules_all is null or N.

8. A supplier site level hold will prevent payment schedule selection

Action: Confirm the hold_all_payments_flag in ap_supplier_sites_all is null or N.

9. For Payment Request invoices there must be a corresponding record in hz_party_sites

Action: If the invoice_type_lookup_code in ap_invoices_all is PAYMENT REQUEST, and the party_site_id from ap_invoices_all is not null, it must match to a party_site_id from hz_party_sites.

10. Fv_econ_benf_disc.ebd_check must return Y for this invoice

This is a federal function that determines whether it is economically beneficial to pay the invoice now. If Federal is not installed, this will always return Y.

Action: Run the following to check for federal installs

set serveroutput on

begin

mo_global.set_policy_context('S',&org_id_from_invoice);

if (FV_INSTALL.ENABLED) then

dbms_output.put_line('Enabled');

else

dbms_output.put_line('Not Enabled');

end if;

end;

If this returns Not Enabled, continue to the next step. If it returns Enabled, you may need to check the federal rates setup for determining economically beneficial payments.

11. If the user specified an Invoice Batch Name, the invoice must be in that batch

Action: If invoice_batch_id is populated in ap_inv_selection_criteria_all, confirm the same invoice_batch_id is populated in ap_invoices_all.

12. If the user specified the Payee the invoice must be from that payee


Action: If the vendor_id is populated in ap_inv_selection_criteria_all, confirm the same vendor_id is populated in ap_invoices_all.

If the party_id is populated in ap_inv_selection_criteria_all, confirm the same party_id is populated in ap_invoices_all.

13. If the user specified an exchange rate type, it must not conflict with the exchange rate type on the invoice

Action: If an IS_USER inv_exchange_rate_type is populated in ap_inv_selection_criteria_all, confirm the exchange_rate_type on the invoice is also User.

If an IS_NOT_USER inv_exchange_rate_type is populated in ap_inv_selection_criteria_all, confirm the exchange_rate_type on the invoice is either null or a non user type.

14. If the user specified a payment method, it must match the payment method on the payment schedule

Action: If the payment_method_code is populated in ap_inv_selection_criteria_all, confirm the same payment_method_code is populated in ap_payment_schedules_all.

15. If the user specified a vendor type, it must match the vendor type of the invoice's supplier

Action: If the vendor_type_lookup_code is populated in ap_inv_selection_criteria_all, confirm the same vendor_type_lookup_code is populated in ap_suppliers.

16. If any legal entities were specified, the invoice must be in one of those legal entities

Action: If there are any rows in ap_le_group for this checkrun_id, the legal_entity_id in ap_invoices_all must match the legal_entity_id from one of those rows.

17. If any operating units were specified, the invoice must be in one of those operating units

Action: If there are any rows in ap_ou_group for this checkrun_id, the org_id in ap_invoices_all must match the org_id from one of those rows.

18. If any currencies were specified, the invoice's payment currency must match one of them

Action: If there are any rows in ap_currency_group for this checkrun_id, the payment_currency_code in ap_invoices_all must match the currency_code from one of those rows.

19. If any pay groups were specified, the invoice's pay group must match one of them

Action: If there are any rows in ap_pay_group for this checkrun_id, the pay_group_lookup_code in ap_invoices_all must match the vendor_pay_group from one of those rows.

20. For zero-amount invoices, the user must have checked the Include Zero Amount checkbox

Action: If the amount_remaining in ap_payment_schedules_all is 0, confirm the zero_invoices_allowed value in ap_inv_selection_criteria_all is Y.

21. Unapproved invoices will not be selected

Action: Confirm the wfapproval_status in ap_invoices_all and the wfapproval_status on each row in ap_invoice_lines_all is either APPROVED, MANUALLY APPROVED or NOT REQUIRED.

24. An invoice with holds will not be selected for payment

Action: Confirm there are no rows in ap_holds_all where release_lookup_code is null.

25. The invoice must be fully validated. A different query is executed based on whether purchase encumbrances are used for any of the included orgs

Action: Determine the value of the purch_encumbrance_flag in financials_system_parameters.

A. If the purch_encumbrance_flag is null or N, confirm none of the rows in ap_invoice_distributions_all have a match_status_flag of N or S.

B. If the purch_encumbrance_flag is Y, confirm none of the rows in ap_invoice_distributions_all have a match_status_flag of N, S or T.

26. Invoices without distributions will not get selected

Action: Confirm there are rows in ap_invoice_distributions_all.

27. For customers using CCR (a Federal functionality) the Invoice Supplier should not be CCR Expired

Action: See the statement on step 10 to determine if Federal is installed. If it is installed confirm there is not a row in FV_TPP_ASSIGNMENTS_V where the beneficiary_party_id and beneficiary_party_site_id match the party_id and party_site_id from ap_invoices_all and the fv_tpp_pay_flag equals N.

Environment Variables from database table - EBS

To find out the Product "TOP" directories e.g the full directory path values from fnd_appl_tops under APPL_TOP?

select distinct  variable_name, value
from fnd_env_context
where variable_name in (select distinct basepath from FND_APPLICATION_VL  where application_name='INV Custom Application'
)

How to stop Automatic Tax Calculation during AP Invoice Validation

Goal:
How to avoid automatic tax calculation on Invoice validation.

Solution:
If we disable the ‘Allow Tax Applicability’ option under the Configuration owner Tax options we can prevent automatic tax calculation on Invoice validation.


Now let us see how we disable Allow Tax Applicability.

Navigation:

Tax Manager à Defaults and controls à Configuration owner Tax options



Separate will open 

Enter the follwoing information

Configuration Owner = Take your Configuration Owner that is your Legal Entity or Operating Unit 
Application name = Payables
Even Class = Invoice.

click on GO button



If there is an already existing set up then query it or if it returns no values then click on create.
In the page that opens, scroll down to the other field and there on the right side you can see a flag called "Allow Tax Applicability" Disable it and click on Apply button.



Now go to parables create and validate the invoices. After validating the tax will not automatically calculated by the system.

Once we disable the Allow Tax Applicability option we will not calculate the tax automatically, but we can still calculate the tax manually.



EBS Order Holds details and release responsibility

  SELECT ooh.order_number,                  ooh.ordered_date,                 ooh.flow_status_code,                 ooh.credit_card_approval...