Compare two invoices with same distribution line count

I am trying to pull data out of Oracle Payables - invoices for which the invoice amount ,the vendor and distribution line count is same.
I could achieve pulling invoices with same Vendor having same amount.But finding hard to compare the counts.
Can anyone share ideas on how to achieve this ... Tried self join but did not work.
The query which I used is as follows :
select invoice_num,invoice_id,invoice_amount,vendor_id,
(select vendor_name from apps.po_vendors where vendor_id=aia.vendor_id) vendor_name,
(select count(*) from apps.ap_invoice_distributions_all aid where aid.invoice_id=aia.invoice_id) line_count
from apps.ap_invoices_all aia
where invoice_amount in (select aiab.invoice_amount
from apps.ap_invoices_all aiab
where aiab.creation_date >='01-AUG-2012'
and vendor_id=aia.vendor_id
group by aiab.invoice_amount
Having (count(aiab.invoice_amount) >1))
and aia.creation_date >='01-AUG-2012'
Thanks in Advance.

I did try your query with sample records and counts are also correct plz chk the following, for me counts are correct as per your logic -
select aia.invoice_num,aia.invoice_id,aia.invoice_amount,aia.vendor_id,
(select vendor_name from
(select 'XX' vendor_name, 'A' vendor_id from dual union all
select 'XY' vendor_name, 'B' vendor_id from dual union all
select 'XZ' vendor_name, 'C' vendor_id from dual union all
select 'XA' vendor_name, 'D' vendor_id from dual ) po
where vendor_id=aia.vendor_id) vendor_name,
(select count(*) from
(select 1 invoice_id from dual union all
select 1 invoice_id from dual union all
select 1 invoice_id from dual union all
select 2 invoice_id from dual union all
select 3 invoice_id from dual ) aid
where aid.invoice_id=aia.invoice_id) line_count
from
select 10 invoice_num, 1 invoice_id,100 invoice_amount, 'A' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 11 invoice_num, 1 invoice_id,100 invoice_amount, 'A' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 12 invoice_num, 1 invoice_id,100 invoice_amount, 'A' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 13 invoice_num, 2 invoice_id,100 invoice_amount, 'B' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 14 invoice_num, 2 invoice_id,100 invoice_amount, 'B' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 15 invoice_num, 3 invoice_id,100 invoice_amount, 'C' vendor_id ,'01-SEP-2012' creation_date from dual union all
select 16 invoice_num, 4 invoice_id,100 invoice_amount, 'D' vendor_id,'01-OCT-2012' creation_date from dual) aia
where aia.invoice_amount in (select aiab.invoice_amount
from
select 10 invoice_num, 1 invoice_id,100 invoice_amount, 'A' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 11 invoice_num, 1 invoice_id,100 invoice_amount, 'A' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 12 invoice_num, 1 invoice_id,100 invoice_amount, 'A' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 13 invoice_num, 1 invoice_id,100 invoice_amount, 'B' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 14 invoice_num, 1 invoice_id,100 invoice_amount, 'B' vendor_id ,'01-AUG-2012' creation_date from dual union all
select 15 invoice_num, 1 invoice_id,100 invoice_amount, 'C' vendor_id ,'01-SEP-2012' creation_date from dual union all
select 16 invoice_num, 1 invoice_id,100 invoice_amount, 'D' vendor_id,'01-OCT-2012' creation_date from dual) aiab
where aiab.creation_date >='01-AUG-2012'
and aiab.vendor_id=aia.vendor_id
group by aiab.invoice_amount
Having (count(aiab.invoice_amount) >1))
and aia.creation_date >='01-AUG-2012'
o/p
INVOICE_NUM,INVOICE_ID,INVOICE_AMOUNT,VENDOR_ID,VENDOR_NAME,LINE_COUNT
10,1,100,A,XX,3
11,1,100,A,XX,3
12,1,100,A,XX,3
13,2,100,B,XY,1
14,2,100,B,XY,1
-------

Similar Messages

  • Two Invoices with respect to One Goods Receipt

    Dear Experts ,
    We have got a query from a user like this....
    With respect to one Goods receipt can we do two invoices??
    i.e GR with a quantity 50No for Material 'A'
    Two invoices with Material A and Quantity of 50 for a single Goods Receipt..
    How it is possible????
    Please guide me...
    Regards
    MK

    Hi MK
    If u have activated duplication check for invoices then u can not pass two invoices with same Po number and similar data
    U can set duplication check in SPRO
    Path
    SPRO>Materials Management>Logistics Invoice Verification>Incoming Invoice>Set Check for Duplicate Invoices
    here u can tick Required options for UR company code
    Vishal...

  • Can anybody tell how to compare two documents with two pointers controlled with the same mouse

    can anybody tell how to compare two documents with two pointers controlled with the same mouse ??

    I saw what I need but in a game to find the differences between two photos (two screens, two pointers controlled by one mouse), and I need a program to make the same thing   (compare a chosen files)

  • Vendor Invoice with Same Reference Number in two fiscal years.

    Vendor Invoice entered in SAP.
    DocumentNum 1600000612  Reference "47026723WA" Vendor Number "637278" Year "2008"
    DocumentNum 1600000667  Reference "47026723WA" Vendor Number "637278" Year "2009"
    We are thinking SAP will not allow/generate invoice with same Reference number. How can we restrict from entering Vendor invoices with Same Reference Number from same Vendor.
    Thanks
    Raghuram

    Restrict it through message control
    Transaction code OBA5
    Message NO.121
    Make it error for batch and online.
    Thanks,
    Ravi

  • Does Oracle E-Biz 11i support intercompany Invoice with a negative line?

    We are using Oracle E-Biz GL/AP/AR/FA (Oracle E-Biz 11.5.2.10). Now we are facing this issue: When we create an intercompany Invoice with a negative line it does not generate proper inter-company entries.
    For eg:
    Invoice Amount 1000 for company1
    Distribution:
    Company2.account.company1 : 300
    Company3.account.company1 : 300
    Company4.account.company1 : 500
    Company5.account.company1 : -100
    when transfer to GL process is done following entries are generated.
    Company1.Liab account.company1 Credit 1000
    Company2.Exp account.company1 Debit 300
    Company3.Exp account.company1 Debit 300
    Company4.Exp account.company1 Debit 500
    Company5.Exp account.company1 Credit 100
    on posting following Intercompany transactions are generated.
    Company2.Interco Payable account.000 Cr 300
    Company3.Interco Payable account.000 Cr 300
    Company4.Interco Payable account.000 Cr 500
    Company5.Interco Recievable account.000 Dr 100
    Company1.Interco Recievable account.000 Dr 1000
    where as the correct entry should be :
    Company2.Interco Payable account.company1 Cr 300
    Company3.Interco Payable account.company1 Cr 300
    Company4.Interco Payable account.company1 Cr 500
    Company1.Interco Payable account.company5 Cr 100
    Company5.Interco Recievable account.company1 Dr 100
    Company1.Interco Recievable account.company2 Dr 300
    Company1.Interco Recievable account.company3 Dr 300
    Company1.Interco Recievable account.company4 Dr 500
    Have you faced this kind of issue? Does Oracle support intercompany Invoice with a negative line (credit)? If 11i doesn't support this feature, does Oracle E-Biz 12 support this feature?
    Your insights will be very helpful.

    Hi,
    Now we are trying to convert the 11g-Database UTF-8 characterset to AL32UTF8 characterset.Why do you need to change the database characterset?
    As per metalink Notes, there is no very clear steps on how to deal with Apps Environment after DB characterset change using CSALTER.Did you go through these documents?
    Note: 788156.1 - AL32UTF8 / UTF8 (Unicode) Database Character Set Implications
    Note: 260192.1 - Changing the NLS_CHARACTERSET to AL32UTF8 / UTF8 (Unicode)
    Note: 124721.1 - Migrating an Applications Installation to a New Character Set
    Note: 225912.1 - Changing the Database Character Set ( NLS_CHARACTERSET )
    1) After DB characterset change, do we have to run Autoconfig, after editing the DB XML file to reflect new characterset value.Yes.
    2) Does the same apply to Application CONTEXT file also for APPL_TOP, etcAre you also changing the application tier characterset? However, I would say you will have to run AutoConfig in both cases.
    3) when shud we run adadmin- filesystem cahracterset conversion. Before or after autoconfig.Run the "Convert character set" via adadmin, then run AutoConfig -- See "Oracle® Applications Maintenance Utilities" manual for details.
    Also i am facing issues in connecting to sqlplus from applmgr user after the DB characterset change.
    It just core-dumps.Did you implement all the steps mentioned in the documents? What is the complete error message? What does "echo $NLS_LANG" return as oracle and applmgr users?
    Regards,
    Hussein

  • Two Switches with same MAC+Priority running STP

    Hi
    what will happen if two switch with same MAC-ADDRESS and same STP priority will run STP , how will elect to the root bridge ???? how the STP process will handle this situation?
    thanx

    Well, first off, no two switches (or switchports) will have the same MAC (if they do, you're buying switches from the wrong, very bad place).
    Every port of the switch will have (at least) one MAC of it's own.
    Given the same priority for all switches/bridges on the LAN, the lowest switch/bridge MAC on the LAN will win as the root.
    VLANS take on the MAC of the administrative interface ("CPU"): i.e., xxxx.xxxx.5000, the first port (i.e., fa0/1) is xxxx.xxxx.5001, the second (fa0/2) is xxx.xxxx.5002, and so on
    If you do a "show interface", the MAC / bia is displayed in the second line.
    Good Luck
    Scott

  • Two account with same UPN in Active Directory

    Is it possible to have two accounts with same UPN in AD? 
    I'm using Windows Server 2012 R2

    To expand on what Mr X said. Active Directory allows you to assign just about anything to the userPrincipalName attribute, as long as the value is unique. The value of this attribute is generally referred to as the UPN. But you could assign values with no
    "@" symbol, for example, or more than one "@" symbol. Also, Active Directory does not require that any value be assigned. It is an optional attribute.
    If no value is assigned to the userPrincipalName attribute, then the user can use a "default" UPN, which is <sAMAccountName>@<DNS domain name>, where <sAMAccountName> is the "pre-Windows 2000 logon" name of the user
    (the value of the sAMAccountName attribute), and <DNS domain name> is the DNS name of the domain.
    If a user has a value assigned to userPrincipalName that does not match this "default" form, then they can logon with either UPN, as long as no one else has either value assigned to their userPrincipalName attribute. You will note that Active
    Directory enforces uniqueness in the domain on sAMAccountName values.
    If in domain "domain.com" a user has a sAMAccountName of "jsmith" but userPrincipalName "[email protected]", then another user can have userPrincipalName of "[email protected]" (as long as no one else
    has that value assigned to userPrincipalName). They can each logon with their assigned values for userPrincipalName. But the first user can no longer also logon with their "default" value, based on their sAMAccountName, because it is now
    used by someone else. But if you attempt to assign a value to userPrincipalName that is also assigned to another user, you get an error.
    Bottom line, only one person can logon with any given UPN.
    Richard Mueller - MVP Directory Services

  • Two records with same  key (Infocube)

    Hi,
    I was trying to do, in a update rule, an "IF" condition with two key figures.
    IF Kf1 > Kf2. result = Kf1 else result = Kf2.
    But the data in the source (datamart Infocube to infocube) have tow records with the same characteristics combination (the same keys)and different amount in the keyfigures, then the result of my "if" condition is not the expected because I understood in the infocube only exists one characteristics combination. :S
    I was seeing those records in the manage transaction of the infocube.
    Some reason for this?
    Thanks and regards
    Victoria Leó

    This can happen with parallel loads.  Two rows with same set of Char values but in different packets of the same Request, being loaded at the same time.
    It really shouldn't be an issue - your update rule will make the KF change as desired.  Your queries aggregate KFs based characteristic values, not Dim IDs, so you'll get the totals you expect.
    Here's some more info:
    There is an RSRV Test that lets you check a dimension for a cube to see if multiple DIM IDs exist for the same combination of Chars - <b>Multiple Entries in Dimensions of a (Basis) InfoCube</b>
    Output looks like:
    12:02:24 o'clock on 08/25/2006: Start test run for user PIZZAMAN:)
    Dimension ZFM_C521: DIMID 61,215 and 61,214 have same characteristic values
    Dimension ZFM_C521: DIMID 61,880 and 61,879 have same characteristic values
    Dimension ZFM_C521: DIMID 61,366 and 61,365 have same characteristic values
    Dimension ZFM_C521: DIMID 61,368 and 61,367 have same characteristic values
    12:02:24 on 08/25/2006: Test run for user PIZZAMAN:) completed
    You can run the Correct Error option to have it update fact rows to use one of the DimIDs if you want, but unless you have lots of them, I even wouldn't bother.
    Here's the description of the test:
    <u>Description</u>
    This elementary test recognizes whether there are several lines that have different DIMIDs(dimension table key), but have the same SIDs for the selected dimension table for the InfoCube specified. (This can occur by using parallel loading jobs). This has nothing to do with an inconsistency. However, unnecessary storage space is occupied in the database.
    <u>Repairs</u>
    Since the different DIMIDs with the same SIDs are normally used in the fact tables, they cannot simply be deleted. Therefore, all of the different DIMIDS in the fact tables are replaced by one DIMID that is randomly selected from the equivalent ones. Before a change can be made to the database, the consent of the user is requested.
    DIMIDs that have become unnecessary are deleted in the connection. In doing so, not only are the DIMDs deleted that were released in the first part of the repair, but so are all of those that are no longer used in the fact tables (including aggregates). The consent of the user is again requested before this change is made.

  • Two methods with same name but different return type?

    Can I have two methods with same name but different return type in Java? I used to do this in C++ (method overloading or function overloading)
    Here is my code:
    import java.io.*;
    public class Test{
    public static void main(String ar[]){
    try{          
    //I give an invalid file name to throw IO error.
    File file = new File("c:/invalid file name becasue of spaces");
    FileWriter writer = new FileWriter(file ,true);
    writer.write("Test");
    writer.close();     
    } catch (IOException IOe){
         System.out.println("Failure");
    //call first method - displays stack trace on screen
         showerr(NPe);
    //call second method - returns stack trace as string
            String msg = showerr(NPe);
            System.out.println(msg);
    } // end of main
    public static void showerr(Exception e){
         StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
         e.printStackTrace(pw);
         try{
         pw.close();
         sw.close();
         catch (IOException IOe){
         IOe.printStackTrace();     
         String stackTrace = sw.toString();
         System.out.println("Null Ptr\n" +  stackTrace );
    }//end of first showerr
    public static String showerr(Exception e){
         StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
         e.printStackTrace(pw);
         try{
         pw.close();
         sw.close();
         catch (IOException IOe){
         IOe.printStackTrace();     
         return sw.toString();
    }//end of second showerr
    } // end of class
    [\code]

    Overloading is when you have multiple methods that have the same name and the same return type but take different parameters. See example
    public class Overloader {
         public String buildError(Exception e){
              java.util.Date now = new java.util.Date() ;
              java.text.DateFormat format = java.text.DateFormat.getInstance() ;
              StringBuffer buffer = new StringBuffer() ;
              buffer.append(format.format(now))
                   .append( " : " )
                   .append( e.getClass().getName() )
                   .append( " : " )
                   .append( e.getMessage() ) ;
              return buffer.toString() ;
         public String buildError(String msg){
              java.util.Date now = new java.util.Date() ;
              java.text.DateFormat format = java.text.DateFormat.getInstance() ;
              StringBuffer buffer = new StringBuffer() ;
              buffer.append(format.format(now))
                   .append( " : " )
                   .append( msg ) ;
              return buffer.toString() ;
         public String buildErrors(int errCount){
              java.util.Date now = new java.util.Date() ;
              java.text.DateFormat format = java.text.DateFormat.getInstance() ;
              StringBuffer buffer = new StringBuffer() ;
              buffer.append(format.format(now))
                   .append( " : " )
                   .append( "There have been " )
                   .append( errCount )
                   .append( " errors encountered.")  ;
              return buffer.toString() ;
    }Make sense ???
    Regards,

  • Clearing WHT on advance & Invoice with same value

    Hi SAP Gurus
    Could anybody suggest me what transaction code to be used or need any configuration change for clearing both the doc i.e. WHT deduct on advance payment with WHT deducted on Invoice with same value.
    In this scenario no further payment should be made.
    I have linked both the doc through TCode F-54 and try to clear both the doc with TCode F-44 but in this transaction no tds has been reveresed by the system and showing difference.
    In Partial advance payment the system has automatically reversed the TDS. No problem occured in this scenario.
    Regards
    Aman
    Edited by: Amandeep Garg on Mar 17, 2008 10:43 AM

    Hi Ahmed
    Thanx for your response...............
    But I have already used the same. Is there not any transaction other than F-53 in which bank is not  invovled.
    Regards
    Aman

  • Two idocs with same idoc number in idx5

    We are using an idoc to file scenario where idocs are bundled using bpm and posted to ftp. here the issue is we are getting two idocs with same idoc number in idx5. due to which the file in ftp is getting overwritten.
    Could anyone suggest me what to do in this regard.

    Hi,
    >>>check your sender system is sending same IDoc twice ?
    if you send the same IDOC twice they both get different numbers as IDOC number is taken from the IDOC num range
    unless you're able to send the same IDOC twice with the same IDOC num somehow
    Regards,
    Michal Krawczyk

  • Need to prevent invoices with 0 price line items to accounting .

    Hi All,
    I have a requirement where in  I need to prevent the invoices with 0 price line items to accounting if item category is relevant for pricing.The invoices which have 0 price line items and item category has specific 0 price need not to be prevented  for accounting.
    Please provide your input to meet the requirement.
    Thanks In Advance.

    Hi,
    Please go through the below link !!! follow this and it will resolve ur issue
    Re: How to prevent invoices with 0 prices to be sent to accounting,
    Regards,
    Krishna O

  • Struts- two actions with same path in struts config

    hai
    I am having html:select tag with two options (View And Download) in a form.My form signature is like <html:form action="select">.I mapped two options(View,Download) with same action path.When i click view it doesn't forwards(remains idle) and no error is shown.But i click download it forwards to the appropriate page.If iam having two tags with same action path the second is only working.This problem doesn't comes when iam having one tag alone.
    My code is here:
    -----------Select.jsp----------------
    <html:form action="Select">
    <html:select property="id">
    <html:option value="view">View</html:option>
    <html:option value="download">Download</html:option>
    </html:select>
    </html:form>
    ----------------Struts-config.xml------------
    <form-beans>
    <form-bean name="viewForm" type="ViewForm"/>
    <form-bean name="download" type="DownloadForm"/>
    </form-beans>
    <action-mappings>
    <action path="/Select"
    name="viewForm"
    type="ViewAction"
    input="/Select.jsp">
    <forward name="success" path="/Success.jsp"/>
    </action>
    <action path="/Select"
    name="downloadForm"
    type="DownloadAction"
    input="/Select.jsp">
    <forward name="success" path="/Welcome.jsp"/>
    </action>
    </action-mappings>
    Can i have action tag with same paths like this.If not please provide me a solution

    I have created two success pages.
    I have created two findForward in my ActionClasspublic ActionForward execute(ActionMapping mapping,...............)
    if(a==view)
    return mapping.findForward("success");
    else
    return mapping.findForward("success1");
    ----------------Struts-config.xml------------
    <form-beans>
    <form-bean name="viewdownloadForm" type="ViewdownloadForm"/>
    </form-beans>
    <action-mappings>
    <action path="/Select"
    name="viewdownloadForm"
    type="ViewdownloadAction"
    input="/Select.jsp">
    <forward name="success" path="/Success.jsp"/>
    <forward name="success1" path="/Success1.jsp"/>
    </action>

  • Unable to monitor two databases with same name on two different hosts

    I have got two databases with same name on two different hosts. I added one database to the list of monitored databases. Now If I try to add the other one , I get the message that the database is already being managed.
    Can't we monitor two databases with same name on two different hosts?

    you can... while saving the target,give a different name.. for eg target-2

  • How to separate two contact with same name

    Hi, anyone knows how to separate two contacts with same name in Contacts?  Actually they are two persons from two gmail contacts with same name but different contact numbers, different emails....etc, but Contacts assume they are same person and merge them as one!

    FG,
    In Lion, you have the File > Duplicate option. You will then have two copies of your document open, and the one on top will have the temporary filename "OriginalFileName copy", and your next responsibility is to File > Save (or Command-S) and rename the duplicate. At this point, you edit the copy's name, to perhaps ...copy 1, or whatever you wish. The document you had open when you initiated the File > Duplicate will still be there on your screen, waiting for you to Close it or continue editing.
    Jerry

Maybe you are looking for

  • Youview checking for updates failed

    Im not to sure about this noticed my youview box checking for updates at start up also starting up very fast seeing i have it set to low power mode (ECO Mode High) seemed odd when i checked for updates manualy it says it failed to download no error c

  • Difference between Pre-Calculated Queries in BI 7.0 and BW 3.5

    Hi Can somebody tell me the difference between pre-calculated queries (web templates) in BI 7.0 and BW 3.5? Is there any difference in Reporting Agent functionality in creating or scheduling the queries? Thanks in advance.

  • I can't find a download of the 10.2.0.4 Orcale client runtime version.

    Hello. I can't find a download of the 10.2.0.4 Orcale client runtime version. I am able to find the instant client but this isn't working for me. Can someone help me find the download location for the runtime version. I am trying to load the client o

  • Maximum tabs in tab interaction in Captivate 7

    I am using the tab interaction in Captivate 7. I wanted to add seven tabs. But the interaction is allowing only five tabs. Can we increase this?

  • Restricting Export to Excel of internet explorer in BEx Browser

    Hi, Is there any way we can restrict the user to export the data into Excel. I have disabled this option in the template. But when the report opens through Browser, user right clicks on any part of the screen and he can export the data to the Excel.