AP/PO PURGE INVOICE SELECT 조건

제품 : FIN_AP
작성날짜 : 2005-11-28
AP/PO PURGE INVOICE SELECT 조건
=============================
PURPOSE
AP/PO Purge 프로그램 수행시 내부 Validation Logic에 의한 대상 조건 찾기
Problem Description
어떤 조건에 의해서 대상을 선별하는지 SQL 조건
Workaround
Solution Description
sql0
INSERT INTO ap_purge_invoice_list
(invoice_id, purge_name, double_check_flag)
SELECT DISTINCT I.invoice_id, 'lg20041231-1', 'Y'
FROM ap_invoices I, ap_invoice_distributions D
WHERE I.invoice_id = D.invoice_id
AND I.payment_status_flag || '' = 'Y'
AND I.invoice_type_lookup_code != 'PREPAYMENT'
AND D.posted_flag || '' = 'Y'
AND D.last_update_date <= to_date('20041231','YYYYMMDD')
AND I.last_update_date <= to_date('20041231','YYYYMMDD')
AND I.invoice_date <= to_date('20041231','YYYYMMDD')
UNION
SELECT I.invoice_id, 'lg20041231-1', 'Y'
FROM ap_invoices I, ap_invoice_distributions D
WHERE I.invoice_id = D.invoice_id (+)
AND I.last_update_date <= to_date('20041231','YYYYMMDD')
AND I.invoice_date <= to_date('20041231','YYYYMMDD')
AND I.invoice_amount = 0
AND I.invoice_type_lookup_code != 'PREPAYMENT'
GROUP BY I.invoice_id
HAVING SUM(NVL(D.amount, 0)) = 0;
sql1 -- Retest invoices
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'N'
AND EXISTS(
SELECT 'invoice no longer purgeable'
FROM ap_invoices I
WHERE PL.invoice_id = I.invoice_id
AND (( I.payment_status_flag <> 'Y'
AND
I.invoice_amount <> 0)
OR I.last_update_date > to_date('20041231','YYYYMMDD')
OR I.invoice_date > to_date('20041231','YYYYMMDD')))
sql2 -- Retest PA Invoices
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'N'
AND (EXISTS
(SELECT 'project-related vendor invoices'
FROM ap_invoice_distributions d
WHERE d.invoice_id = pl.invoice_id
AND d.project_id is not null -- bug1746226
OR EXISTS
(SELECT 'project-related expense report'
FROM ap_invoices i
WHERE i.invoice_id = pl.invoice_id
AND i.source = 'Oracle Project Accounting' ))
sql3.
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'N'
AND EXISTS (
SELECT 'payment schedule no longer purgeable'
FROM ap_payment_schedules PS,
ap_invoices I
WHERE PS.invoice_id = PL.invoice_id
AND PS.invoice_id = I.invoice_id
AND ((PS.payment_status_flag <> 'Y'
AND I.cancelled_date is null)
OR PS.last_update_date > to_date('20041231','YYYYMMDD')))
sql4. -- Retest simple Invoice Distributions
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'N'
AND EXISTS
(SELECT 'distribution no longer purgeable'
FROM ap_invoice_distributions D, ap_invoices I
WHERE I.invoice_id = D.invoice_id
AND PL.invoice_id = D.invoice_id
AND ( D.last_update_date > to_date('20041231','YYYYMMDD')
OR D.posted_flag <> 'Y'
OR D.po_distribution_id IS NOT NULL
OR D.assets_addition_flag||'' = 'U'
AND I.cancelled_date IS NULL)))
sql4-1.
SELECT PL.invoice_id
FROM ap_invoice_distributions D, ap_invoices I , ap_purge_invoice_list PL
WHERE I.invoice_id = D.invoice_id
AND PL.invoice_id = D.invoice_id
AND D.last_update_date > to_date('20041231','YYYYMMDD')
sql4-2.
SELECT PL.invoice_id
FROM ap_invoice_distributions D, ap_invoices I,, ap_purge_invoice_list PL
WHERE I.invoice_id = D.invoice_id
AND PL.invoice_id = D.invoice_id
and D.posted_flag <> 'Y' -- 2번 조건
sql4-3.
SELECT 'PL.invoice_id
FROM ap_invoice_distributions D, ap_invoices I,, ap_purge_invoice_list PL
WHERE I.invoice_id = D.invoice_id
AND PL.invoice_id = D.invoice_id
and D.po_distribution_id IS NOT NULL -- 3번 조건
sql4-4.
SELECT PL.invoice_id
FROM ap_invoice_distributions D, ap_invoices I, ap_purge_invoice_list PL
WHERE I.invoice_id = D.invoice_id
AND PL.invoice_id = D.invoice_id
and (D.assets_addition_flag||'' = 'U' -- ( 추가 -- 4번 조건
AND I.cancelled_date IS NULL)
sql5 -- Retest Payments
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'N'
AND EXISTS (
SELECT 'payment no longer purgeable'
FROM ap_invoice_payments P, ap_checks C
WHERE P.invoice_id = PL.invoice_id
AND P.check_id = C.check_id
AND (P.posted_flag <> 'Y'
OR P.last_update_date > to_date('20041231','YYYYMMDD')
OR C.last_update_date > to_date('20041231','YYYYMMDD')
OR (NVL(C.cleared_date, C.void_date) > to_date('20041231','YYYYMMDD')
AND nvl(C.cleared_date, C.void_date) is not NULL)));
sql6.
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'Y'
and purge_name = 'lg20041231-1'
AND EXISTS (
SELECT 'payment no longer purgeable'
FROM ap_invoice_payments P, ap_checks C
WHERE P.invoice_id = PL.invoice_id
AND P.check_id = C.check_id
AND (P.posted_flag <> 'Y'
OR P.last_update_date > to_date('20041231','YYYYMMDD')
OR C.last_update_date > to_date('20041231','YYYYMMDD')
OR (C.future_pay_due_date is not null
AND C.status_lookup_code ='ISSUED')))
OR
c.cleared_date > to_date('20041231','YYYYMMDD')
OR
c.void_date > to_date('20041231','YYYYMMDD')
or
EXISTS (SELECT 'Referenced by cashbook'
from ce_statement_reconciliations SR
where C.check_id=SR.reference_id
AND SR.reference_type= 'PAYMENT')));
sql7.
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'N'
and EXISTS (
SELECT 'matched'
FROM ap_invoice_distributions aid
, rcv_transactions rcv
WHERE aid.invoice_id = PL.invoice_id
and aid.rcv_transaction_id = rcv.transaction_id
and rcv.last_update_date > to_date('20041231','YYYYMMDD'))
sql8.
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'N'
AND EXISTS (
SELECT 'invoice accounting not purgeable'
FROM ap_accounting_events aae
, ap_ae_headers aeh
where aae.source_table = 'AP_INVOICES'
and aae.source_id=PL.invoice_id
and aae.accounting_event_id = aeh.accounting_event_id
and (aeh.gl_transfer_flag = 'N'
OR aae.last_update_date >to_date('20041231','YYYYMMDD')
OR aeh.last_update_date >to_date('20041231','YYYYMMDD')))
sql9.
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'N'
and EXISTS (
SELECT 'payment accounting not purgeable'
FROM ap_accounting_events aae
, ap_invoice_payments aip
, ap_checks apc
, ap_ae_headers aeh
WHERE aae.source_table = 'AP_CHECKS'
and aae.source_id = apc.check_id
and PL.invoice_id = aip.invoice_id
and aip.check_id = apc.check_id
and aae.accounting_event_id = aeh.accounting_event_id
and (aeh.gl_transfer_flag = 'N'
OR aae.last_update_date >to_date('20041231','YYYYMMDD')
OR aeh.last_update_date >to_date('20041231','YYYYMMDD')))
sql10.
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'Y'
and purge_name = 'lg20041231-1'
AND EXISTS (
SELECT 'invoice accounting not purgeable'
FROM ap_accounting_events aae
, ap_ae_headers aeh
where aae.source_table = 'AP_INVOICES'
and aae.source_id=PL.invoice_id
and aae.accounting_event_id = aeh.accounting_event_id
and (aeh.gl_transfer_flag = 'N'
OR aae.last_update_date >to_date('20041231','YYYYMMDD')
OR aeh.last_update_date >to_date('20041231','YYYYMMDD')))
sql11.
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'Y'
and purge_name = 'lg20041231-1'
and EXISTS (
SELECT 'payment accounting not purgeable'
FROM ap_accounting_events aae
, ap_invoice_payments aip
, ap_checks apc
, ap_ae_headers aeh
WHERE aae.source_table = 'AP_CHECKS'
and aae.source_id = apc.check_id
and PL.invoice_id = aip.invoice_id
and aip.check_id = apc.check_id
and aae.accounting_event_id = aeh.accounting_event_id
and (aeh.gl_transfer_flag = 'N'
OR aae.last_update_date >to_date('20041231','YYYYMMDD')
OR aeh.last_update_date >to_date('20041231','YYYYMMDD')))
sql12.
Select invoice_id
from ap_purge_invoice_list PL
WHERE PL.double_check_flag = 'Y'
and purge_name = 'lg20041231-1'
and EXISTS (
SELECT 'history not purgeable'
FROM ap_invoice_payments aip
, ap_payment_history aph
WHERE aip.invoice_id = PL.invoice_id
and aip.check_id = aph.check_id
--Bug 1579474
--and aph.last_update_date >= :P_activity_date);
and aph.last_update_date > :P_activity_date);
Reference Documents
4445984.993

Pl post OS and database details. Pl verify that INIT.ORA parameters are set as per MOS Doc 396009.1 (Database Initialization Parameters for Oracle Applications Release 12)
Pl review these two threads and post the information requested for these SQL statements with and without the NO_UNNEST hints.
HOW TO: Post a SQL statement tuning request - template posting
When your query takes too long ...
HTH
Srini

Similar Messages

  • Excise Invoice Selection Vs assessable value in Subcontracting Challan

    Hi,
    I have maintained the Assessable Value for my subcontracting components and also there is Excise Invoice exists for this components. While creating Subcontracting challan, system is displaying information message that Material  XXXXXX has an assessable value, but I would like to refer the Excise Invoice.
    Hence, when I click the Excise Invoice selection, there is no effect. As per SAP message "The message is for information purpose only. Go ahead with the option selected" system should ignore this message and allow me to select Excise Invoices but it is not happening.
    Is this bug or any other config setting to be done to overcome this issue?.
    Your replies to resolve this issue is highly appreciated.
    Thanks,
    Babu.

    Hi,
    For every excisable material (whether you procure, manufacture or sale) has to be declared as excisable material in table J1ID with appropriate chapter ID, assessable value & CENVAT declaration.
    When you send the excisable material to the sub-contractor the material needs to be returned back to your plant within 180 days. If this is not done, then you will have to pay back the excise duty on the material with base value as assessable value. Hence it is required to maintain the assessable value.
    Hope this clears your query.
    Regards,
    Prashant

  • Excise Invoice Selection in Return Delivery

    Process - 1
    Depot to Customer
    ===============
    Sales Order -> Delivery Note -> J1IJ(Excise Invoice Selection) -> PGI->(VF01)Billing Document
    Process - 2
    Rejected Order from Cudtomer
    ======================
    VA01(Doc. Type - 'RE')->Delivery Note->PGR->(VF01)Credit Memo TO Customer
    Now in Process - 2 ,we have not done any process for Excise.We can take Credit Using 'J1IH'(Additional Excise),But i want to know whether the Excise Invoice which i have selected in Process 1(T-code - J1IJ),will get free.
    I want this beacause we want to use the same Excise Invoice for Different Order if it gets free.I also want to know whether we are following the correct Steps Sequence.
    Help required Urgently.
    Thanx,
    Viru.
    Edited by: Virendra SIngh on Nov 25, 2008 6:00 AM

    Hi
    For depot returns use the transaction code J1IG. Create this with reference to material document of
    return delivery. Thus there will be and reciept entry in RG23D register. This again can be refered whil doing depot excise invoice (J1IJ)
    Do not use J1IH this will not have any impact in RG23D table. You have to use J1IH in case of
    factory sale and not depot sales.
    Regards
    MBS

  • Sub-Contracting Excise Invoice Selection in J1IF01

    Hai Friends,
    Let me share one issue, which i faced in my project.
    I was doing sub - contracting process..  I have created sub-contract PO, With reference to that i have issued material to sub-contrator. then i went to create for subcontracting challana... where i couldn't able to select the excise invoice selection????????????????????
    What could be the reason ?
    Some body told that i have to maintain no.of days in Excise setting ?
    Which i have maintained already..
    Some body told that In J1ID , I have to maintain ***.VALUE ?
    Which value i have to maintain there ???? I don't know....
    even though i have given some value in J1ID... Then i tried after that also i couldn't able to excise invoice selection in J1IF01....
    So please guide me .... What could be the reason ? where i have missed configuration ?

    Assesable value is maintained in J1ID. It is the value of the components that your sending to the vendor for processing which is certified by the respective authority.
    For creating challan to J1IF01 and enter the material document with which you have made the transfer posting and save.

  • How excise invoices are sorted in Excise invoice selection screen (J1ij)

    Sir
    when I do excise invoice creation in Ji1j for customer depatch, in the excise invoice selection screen , the excise invoices are not sorted properly, i.e excise invoice related to 2011 appearing first and then 2008 is appearing then again 2011 is appearing.
    can some one tell me how these excise invoices are sorted?
    Jaya Anand

    Sir
    Not yet. Already   'EI proc' is set as First in firstout only.
    But Still , 2008 document is appearing in the middle of 2011 documents. i.e first 4 documents is related to 2011 and 5th document is 2008 and then again 6th document related to 2011 ect...
    Can I attach the screen shot in this forum?
    Regards
    Jaya Anand
    Edited by: Jayaanand on Nov 21, 2011 10:19 AM

  • In MIGO Excise Invoice Selection screen?

    Hello
    I had created the the PO for excisesable material.When i Go for MIGO for
    receiving the Goods....when check the system will ask me to enter excise Invoice no and
    Excise invoice date. besides that one selection option is there....
    Capture excise Invoice
    Ref Excise Invoice
    Only Part1
    No excise entry
    Bussiness requirement is that.....they want to keep  Only Part1 option....they
    wanted to remove all other options.  how to do that? there is no selction screen in CIN customising
    Regards
    sapman

    Hi,
    one option is remove the ticks for MIGO settings in Excise group customization, but also u can see some other options for that you need to alter the standard Domain's J_1IEXCISE_ACTION fixed values(delete the other options).
    Second option is explore the authorization objects in CIN and try to restrict the use via authorization.
    Note - Altering standard domain is NOT recomended by SAP.
    Cheers,
    Santosh
    Edited by: Santosh (INDIA) on Jul 16, 2008 11:18 AM

  • No invoices selected in payment run

    Hi,
      Our users did a payment run for 2 vendors, but no invoices are selected. Actually there is one open invoice for each vendor. But they are trying to do the payment run on 31st march.and the document is posted on 30th march. I checked the data but cannot find any clue.
    Can any one help me to solve this.
    Thanks,
    Sravanthi

    Hello
    There could be 2 reasons,
    One is payment method and bank selection not maintained in vendor master record
    or during invoice creation some parameters of payment details were not maintained
    Lastly, check the payment terms maintained in the invoice, whether the invoices are really due or not. If not due the payment program may not pick up the invoices, although parameters are correctly maintained in the proposal run.
    Reg
    assign points if useful

  • Lockbox - credit memo w/ref to invoice selected when paying invoice only

    Hello Experts,
    We are implementing automation of lockbox and have encoutntered issues when paying invoices - create credit memos inreference to invoice are also selected which casues the payment to go "On account" as opposed to "Applied"
    E.x WE have Invoice# 123 for $100.00. We created a credit memo# 312 w/ref to invoice 123 (XBLNR for credit memo = 123) for $20.00.
    The customer is now paying invoice 123 for $100.00 and our business process is to refund the cusotmer later for $20.00 for which he received a credit.
    In FLBP, when we process the payment, the status is "On Account" becasue the open item total to $80.00 ($100.00 - $20.00).
    Has anybody encountered a similar issue? Any thoughts on how to address this?
    Thanks,
    Leela

    It was a problem with the payment advice. The Payment amount field needed to be filled for the program to pick only the invoice.
    Thanks,
    Leela

  • What type of invoice select in PPR?

    Hi,
    What types of invoices is included in PPR?Can autoselect shedule payment program select PREPAYMENT,CREDIT MEMO,DEBIT MEMO,MIXED TYPE invoices?

    Hi Rehan,
    i am sure that Standard, Credit Memo, Debit Memo and Prepayment Invoices that will be selected by PPR .... but not sure about Mixed Type of Invoice..
    Probably you can perform a test case and find that ...
    Regards,
    Ivruksha

  • AR Invoice Selective Re-printing

    Dear Experts,
    I wonder if there is a way to batch print all AR Invoices for a range of dates for a particular sales employee.
    We normally have the invoices automatically printed at the time they are added. However, periodically, a sales employee might ask for copies of his/her invoices. I can create an SQL query to create a list of the invoices for the sales person within the date range. However, going into each invoice and printing it from there seems to be so time consuming...
    Thank you for your help,
    Michael

    As you may know, current design of document printing would only support continue range of either by document numbers or posting dates.  You may post a DRQ here:
    /community [original link is broken]
    Thanks,
    Gordon

  • US localization. Select 2 Sales orders in one down payment invoice

    US Localization.
    I need to create a Sales Down payemnt invoice selecting 2 sales order but is not possibile to select more than one SO.
    In Other localization I see that it is possible.
    There is some set up or on the US localization it is not possible?
    Thanks

    Hi,
    Is it was happening for one customer or all? Please check SAP note:
    1649125 - LOC_US/CA_Impossible to base a foreign currency down
    payment on multiple orders
    1766588 - LOC_US_CA_System Exchange rate cannot be used in A/R
    Downpayment Invoice
    Thanks & Regards,
    Nagarajan

  • R11i - Scheduled payment set where no invoices are selected

    Hi,
    I would like to set up scheduled runs of payment sets. When there are no invoices selected based on the selection criteria, the payment set will error. Is there a way to automate the cancelling of the payment batch when that happens so future payments sets can be run normally?
    Thanks!
    Carmen

    Hello
    There could be 2 reasons,
    One is payment method and bank selection not maintained in vendor master record
    or during invoice creation some parameters of payment details were not maintained
    Lastly, check the payment terms maintained in the invoice, whether the invoices are really due or not. If not due the payment program may not pick up the invoices, although parameters are correctly maintained in the proposal run.
    Reg
    assign points if useful

  • How to delete uploaded invoices in ap?

    Hi
    We have a situation to delete the uploaded invoices in ap, got the api namely ap_purge_pkg
    But there is no documentation and examples how to use it.
    Can you provide some examples?
    Thanks
    Rajesh.

    If you are on R12, see if you can run AP/PO Purge Initiation (Selection) Routine.
    While you are at it, also check AP/PO Purge Initiation (Selection) Routine Is Very Slow [ID 854721.1]
    Hope this helps,
    Sandeep Gandhi

  • Help needed in selection screen - Urgent

    Hi Experts,
    I have a selection screen. I have three radi buttons in that selection screen. Based on the selection of the radio buttons I need to activate corresponding selection screen parameters.
    e.g : if radiobutton1 is selected, njo activation needed,
           if radiobutton2 is selected, activate selection screen parameter p_one,
           if radiobutton3 is selected, activate selection screen parameter p_two.
    All three radiobuttons are attached to the same radio button group.
    I have assigned the parameters p_one, p_two, p_three to MODIF ID as follows.
    p_one - NULL
    p_two - t01
    p_three - t02.
    on the selection of a radio button I want the corresponding parameter to get activated.
    please help me.
    Regards,
    Arul jothi A.

    hi
    jothi
    AT SELECTION-SCREEN OUTPUT.                                      
      CASE SY-TCODE.                                                 
        WHEN 'ZEDI6'.                                                
          LOOP AT SCREEN.                                             
            CASE SCREEN-GROUP4.                                      
              WHEN '001'.                  "Sales order select       
                SCREEN-ACTIVE = '1'.       "1=Active, 0=Don't display
                MODIFY SCREEN.                                       
              WHEN '002'.                  "Delivery select          
                SCREEN-ACTIVE = '0'.       "1=Active, 0=Don't display
                MODIFY SCREEN.                                        
              WHEN '003'.                  "Invoice select           
                SCREEN-ACTIVE = '0'.       "1=Active, 0=Don't display
                MODIFY SCREEN.                                       
              WHEN '004'.                  "PO Select                
                SCREEN-ACTIVE = '0'.       "1=Active, 0=Don't display
                MODIFY SCREEN.                                       
    regards
    praveen

  • Report for AR reserve invoices

    I want to see all AR reserve invoices for a particular item. Is there a report for this in SBO or do I have to write a query?
    thanks

    Awesome, thanks.
    To check Committed quantity coming from AR reserve invocies
    AR Reserve invoices
    select oinv.docentry, oinv.docnum, oinv.canceled, oinv.isins, inv1.linenum, inv1.itemcode, inv1.linestatus, inv1.quantity, inv1.opencreqty
    from oinv
    inner join inv1 on oinv.docentry=inv1.docentry
    where itemcode = 'X' and isins = 'Y' and inv1.linestatus <> 'C'

Maybe you are looking for

  • Interactive Analysis using a non-BO WebService

    Hi all, I'v a question about the new version of WebI - Interactive Analysis. Is it possible to build a report using a 3rd party WebService ? If so, how to do this? Thanks and best regards, Silvia

  • How to save mov files on CD

    I am using Windows XP with quicktime but I can not save mov files on CD. I donot mean to watch mov on VCD but save mov as data files to free my hard disk. Thank you for your assistant

  • IP1800 printer problem

    iP1800 printer isn't printing solid / dark black anymore. Anything that's supposed to be black is coming out light gray on white paper. Cartridge (#40) is half full, but a brand new cartridge does same thing. I've run all the deep cleaning and testin

  • HELP NEEDED........PLZ

    My problem is like this- I am reading an image file from the Jar file and then writing some part of image to outside of Jar file and when am taking that written part as an image it is not working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! any Idea h

  • ? Moving Solaris Oracle database to Linux Redhat Oracle

    Thanks in advance. Is it possible to take a cold database backup (datafiles, backup of control file, Sql*net, Initsid.ora) from Oracle on Solaris and move it to a Redhat Linux Oracle with the same database version 9.2.0.8 and bring up the database on