Query to determine which customer invoices are subjected to apply payment

Hi you all experts.
I have two tables (OINV and a custom made named DEPOSITS) the first one as you know keeps the record of all customer invoices. The second one keeps record of last payment from customers (this table is filled before applying payments and it consists in only two fields: ClientID and Amount.
I will upload incoming payments through DTW, but since I only have the amount of the payment and not the invoices to where this money will be posted; I come to you for advice.
For instance, my Customer1 just pay 5,000USD and has following invoices (in order of DueDate):
- InvoiceA: 1,000
- InvoiceB: 700
- InvoiceF: 3,000
- InvoiceD: 5,000
- InvoiceC: 10,000
I need to create a query that gaves me wich Invoice (with the higher due date) can be cover with the amount given, and if cannot be covered completely, to apply the remaining balance of the Deposit and keep the invoice open as partial paid.
The expected result from this would be:
- Invoice A: 1,000 PAYED. Remaining balance of payment 4,000USD.
- Invoice B: 700 PAYED. Remaining balance of payment 3,300USD (4000-700)
- InvoiceF: 3,000 PAYED. Remaining balance of payment 300USD (3300-3000)
- InvoiceD: 300 PARTIALLY PAYED. Remaining balance of payment 0USD (300-300)
Thanks a lot,
Israel.

Hi Israel,
Query may only do calculation column wise easily. How about just create left part. The calculation between lines can be done by Excel formula after export the query result.
Thanks,
Gordon

Similar Messages

  • How to determine which archive logs are needed in flashback.

    Hi,
    Let's assume I have archive logs 1,2,3,4, then a "backup database plus archivelogs" in RMAN, and then archive logs 5+6. If I want to flashback my database to a point immediately after the backup, how do I determine which archive logs are needed?
    I would assume I'd only need archive logs 5 and/or 6 since I did a full backup plus archivelogs and the database would have been checkpointed at that time. I'd also assume archive logs 1,2,3,4 would be obsolete as they would have been flushed to the datafiles in the checkpoint.
    Are my assumptions correct? If not what queries can I run to determine what files are needed for a flashback using the latest checkpointed datafiles?
    Thanks.

    Thanks for the explanation, let me be more specific with my problem.
    I am trying to do a flashback on a failed primary database, the only reason why I want to do a flashback is because dataguard uses the flashback command to try and synchronize the failed database. Specifically dataguard is trying to run:
    FLASHBACK DATABASE TO SCN 865984
    But it fails, if I run it manually then I get:
    SQL> FLASHBACK DATABASE TO SCN 865984;
    FLASHBACK DATABASE TO SCN 865984
    ERROR at line 1:
    ORA-38754: FLASHBACK DATABASE not started; required redo log is not available
    ORA-38761: redo log sequence 5 in thread 1, incarnation 3 could not be accessed
    Looking at the last checkpoint I see:
    CHECKPOINT_CHANGE#
    865857
    Also looking at the archive logs:
    RECID STAMP THREAD# SEQUENCE# FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# RESETLOGS_CHANGE# RESETLOGS
    25 766838550 1 1 863888 10-NOV-11 863892 863888 10-NOV-11
    26 766838867 1 2 863892 10-NOV-11 864133 863888 10-NOV-11
    27 766839225 1 3 864133 10-NOV-11 864289 863888 10-NOV-11
    28 766839340 1 4 864289 10-NOV-11 864336 863888 10-NOV-11
    29 766840698 1 5 864336 10-NOV-11 865640 863888 10-NOV-11
    30 766841128 1 6 865640 10-NOV-11 865833 863888 10-NOV-11
    31 766841168 1 7 865833 10-NOV-11 865857 863888 10-NOV-11
    How can I determine what archive logs are needed by a flashback command? I deleted any archive logs with a SCN less than the checkpoint #, I can restore them from backup but I am trying to figure out how to query what is required for a flashback. Maybe this coincides with the point that flashbacks have nothing to do with the backups of datafiles or the checkpoints?

  • Vendor invoices are blocked automatically with payment blck A instead of R

    There is an issue with a specific vendor.This vendor's invoices are blocked automatically with payment block A instead of
    payment block R.
    I know that invoices are blocked when posted if there is a price variance exceeding 3% and/or 100 Euro with payment block R.The invoices with payment block A are not included in the report Z1PE which is used by the Production Planning in order to monitor the blocked invoices and these invoices remain blocked for a long time until the vendor requests their payment.Could you please check why this happens?

    HI,
    Discuss with your MM Consultant, in MM there is a facility to block the invoice automatically in certain scenarios.
    Thanks & Regards,
    Shashi Kanth.

  • Few customer invoices are appearing in open as well as cleared items.

    when I am running FBL5N for a particular customer, few line items are coming  as open as well as cleared items.
    Please suggest how to overcome from this.
    Thanks.

    Hi
    Once it cleared, then it will not appear in open item. This will happen only for partial payment even though we cleared. For that particular invoice, we done partially 2,3 times and cleared, in that payment doc any one doc containing future date. So that you should give the date which having future date in fbl5n.
    For example: Invoice date 10.12.2011, payment done(posting date) 11.12.2011,12.12.2011,.....20.12.2011
    But whenever checking in fbl5n, we always check with current date. Invoice is cleared. so that it will show cleared item, but according the current date its open only. So that it will show open item also. If you are changing into final date with reference of payment doc, then it will not appear in open item
    Regards
    Mani.S

  • Customer invoices are not getting cleared when lockbox file imported in sap

    Hello ,
      When the lockbox file is imported into SAP , it is not able to clear customer invoices. It creates SAP documents and payment advices but not able to apply the payments to customers accounts.
      Can anyone suggest on this with possible solutions.
    Regards,
    suresh

    Hi,
    You have to check the invoices are being match. The options are the following according to selection screen in FLB2:
    Document numbers (BELNR)
    Reference document numbers (XBLNR)
    Document number first, if not found: reference doc. number
    Reference document number first, if not found: doc. number
    Document number first, then reference and amount
    You have to check if the information which is coming in the file is the same present in the invocies in the ERP.
    Also check the settings in OBAX and OBAy.
    REgards,
    Renan Correa

  • Query to see which system events are being traced?

    I had an Oracle consultant working on our database recently. He left with some system level tracing running at level 16 (support) and the trace files are filling the disk. Is there a query I can do to determine which events are being traced so that I can disable them. I think the syntax to disable them would be:
    alter system set events '<event number> trace name context off';
    Thank you

    Thank you.
    From reading the posts I see that I can do:
    set serveroutput on;
    DECLARE
    lev BINARY_INTEGER;
    BEGIN
    dbms_system.read_ev(10046, lev);
    dbms_output.put_line(lev);
    END;
    and if I get a level of '0', that means that tracing is turned off for that event. This is helpful, and I suppose I could write a script to check all event numbers using dbms_system.read_env(<event_number>,<level>). However, I was hoping that there was a view I could query but I guess there's not.
    Thank you

  • Customer invoices are blocked for dunning automatically when we run F150

    HI All
    when we are running the dunning (T.Code F150) for one of the customer invoice items are blocking for dunning automatically.
    the customer master setting for dunning block fields is empty and there is no changes for this field.
    These invoices are created recently and could please help to find a solution for not happened the same in hte next dunning runs?
    thanks in advance
    Best regards
    Venu

    Hi,
    Customer automatically gets blocked if the Customer has NO Line Items which can be considered for Dunning.
    Before running the Dunning check weather the customer master us updated with DUNNING Variant and also check for the weather the  Line items are over due and if so check the Dunning Procedure for Dunning INTERVAL and also the Arrear Days for each Internal.
    Hope this will Help you .
    Thanks
    Goutam

  • How can I determine which programs/files are using disc space?

    A question for the professionals:
    What program on my MacBook Pro can I run to determine which programs and files are taking up the percentage of disc space?  I am running at 72 gb, which is great, but I need to know what is using up the rest of it.  Thank you in advance to any helpful solutions.
    Matthew

    activity monitor for RAM (its already in your utilities folder) http://support.apple.com/kb/HT1342.  OmniDiscSweeper for hard drive http://www.omnigroup.com/products/omnidisksweeper/  (needs to be downloaded)

  • Help Determining Which Methods/Classes Are Being Used

    Hello,
    I'm having issues with my company's Java application and because I've luckily narrowed the classes down to a meager 30+ I need some help pinpointing my problem.
    I realize there are a lot of Java monitoring applets/applications and some are deployment-specific but I need something very detailed-- I haven't found the features I need.
    Specs:
    Jrun4, Java 1.4, Windows Server 2003
    I would like to have a monitor that tells me exactly (real-time) what classes, methods, variables, etc. are being called in real-time. Looking at the JRun launcher console for one process gives me this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
    01/16 14:05:33 error Software caused connection abort: socket write error
    java.net.SocketException: Software caused connection abort: socket write error
            at java.net.SocketOutputStream.socketWrite0(Native Method)
            at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
            at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
            at jrun.servlet.io.MetricsOutputStream.write(MetricsOutputStream.java:75)
            at java.io.BufferedOutputStream.write(BufferedOutputStream.java:106)
            at jrun.servlet.http.WebOutputStream.write(WebOutputStream.java:64)
            at jrun.servlet.file.FileServlet.pipeData(FileServlet.java:419)
            at jrun.servlet.file.FileServlet.service(FileServlet.java:254)
            at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
            at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)This is cute, but not really helpful. I would like to determine what was passed to the process, from where and what went wrong.
    For example,
    Instead of this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
    01/16 14:05:33 error Software caused connection abort: socket write errorI would get something like this:
    Generating report:quadbase.reportdesigner.ReportAPI.QbReport with export type:PDF
            Page variables: test.jsp ($var1= "I'm"; $var2= "Going"; $var3="To"; $var4="Break"; $var5 = null)
            Calling: test2.jsp
            With: jrun.bin.db.foo.Bar();
    01/16 14:05:33 error Software caused connection abort: socket write error
            Problem: $var5 = null;Sorry if I'm rambling, I just want to know what is where and who it's calling when it breaks. Then I could deduce which class, what variable, what page, etc. My application is very complicated and seemingly mundane changes can throw it all off.
    Any ideas?

    We'll look into usage tracking. We're on the standard edition, so I'm not sure if it's available. Also, some of these reports may be quarterly -- so there may be a long wait to see if the view is used and I need to know fairly soon. (If it's not used, it saves us some work in a project transition going on.)
    I certainly don't understand the underlying structure of the product, but it seems like there should be some way to determine if a view is used by a report. I apologize if I'm not using the correct terminology. Thanks for your help -- we'll keep looking into it.

  • SharePoint Databases - How to determine which ones are being used and which ones aren't

    I am not sure where to exactly post this question.  On the SQL Server side or on a SharePoint side.
    I am a SQL Server Database Administrator who is monitoring some SharePoint databases.  On a daily basis it seems that they are creating new databases but don't delete the databases that they are no longer using.  For example, they might be testing
    on a development server and if things aren't working properly instead of asking that the databases be deleted they just go ahead and create new databases to do what ever they need to do.  Is there a way on the SQL Server side to determine which SharePoint
    databases are being used and which ones aren't being used?  Or does one determine this information through the SharePoint Central Administration console?
    lcerni

    Hello,
    The following query gives you the databases now in use.
    SELECT
    DISTINCT d.name
    FROM
    sys.dm_tran_locks
    tl INNER
    JOIN sys.databases
    d
    ON
    tl.resource_database_id
    = d.database_id
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • How to determine which Visual C++ Redistributables are really required?

    A client's PC came with a whole load of unwanted Desktop-Applications pre-installed, which were consequently removed. Unfortunately, there are still various generations of Visual C++ runtimes to be found on the system. - Is there a reliable way
    to determine which of those are still needed after cleaning up those unwanted apps?
    ________________ drahnier

    Hi,
    Let's take Microsoft Visual C++2010 Redistributable Package as example:
    The Microsoft Visual C++ 2010 Redistributable Package installs runtime components of Visual C++ Libraries required to run applications developed with Visual C++ on a computer that does not have Visual C++ 2010 installed.
    This package installs runtime components of C Runtime (CRT), Standard C++, ATL, MFC, OpenMP and MSDIA libraries.
    While, I don't think there any reliable way to determine which of those package still needed after removed them.
    In my opinion, these package doesn't occupy too much space, why not keep them in case an application that need them.
    Roger Lu
    TechNet Community Support

  • How to determine which photos are not in an album?

    I have @ 5500 photos in V2.01 vor Os 10.2.8. I would like to determine which photo's are not in an album. I know I can write a perl script to do print this information, but it might be nicer if done from within iTunes.

    Billy,
    There is a way that will take a little time but will give you the results.
    Write down the name of all your Albums and number them.
    In iPhoto add the new numbers (corresponding to the albums) as keywords.
    After all the number keywords have been added you need to give the images in each album that numbered keyword.
    Highlight an album in the source column, select all, then assign them the number keyword for that album.
    do this for all the albums.
    Make sure your view is set to view keywords.
    You should be able to see any photo that does not have one of those number keywords.
    there might be a simpler way, but I don't have iPhoto 2 to test for you.
    Lori

  • Query to show which are not used till Jan 2011

    Hi Friends !
    Need to make a BeX query to know which all queries are used till Jan 2011. Which Stats Cube we need to use? "0BWTC_C05"? Please advise how to make this report. We need this report to clean up our BI Prod system.
    With Regards
    Rekha

    use the info provider -- >0TCT_DS02 or 0TCT_DS01
    Check the below query and the MP -- which provides query runtimes.
    Query Runtime- 0BWTC_C10_Q014
    Average Time per Query (0BWTC_C10_Q021)
    Average Time per Query (0BWTC_C10_Q507)
    Which are Based on InfoCube: BW statistics MultiProvider (0BWTC_C10)
    or you can use the table RSDDSTAT_OLAP in BI7.0 or RSDDSTAT  in BW3.x version.
    based on the table you can get the requeired inforamtion wht u r looking for.
    Regards
    KP

  • Query SQ01: Table for customer revenue

    Hi,
    I have created a query using amongst other table KNKK. The requirement his now to get for a customer (in all sales-areas and company code) the total revenue for a give year. What is the best way to acheive this? Is there a table i could use which stores this kind of information?
    Kind regards

    Table VBREVE-RVAMT is the revenue amount
    I think you must get the G/L Account Number for the customer and pass it here.
    table CO01 gives the GL account based on customer account group,
    Or you can get the Sales Document of the customer and pass it to table VBREVE.
    or just try passing the customer to field VBREVE-KUNAG and check.
    Just give a try
    Problem is that only some of our customer invoices are updated in VBREVE, that is we are only doing revenue recognition for some invoice types.

  • Payment terms for Customer Invoice with a credit line item

    Hi all,
    We have a business scenario where we create customer invoices on a weekly basis. The payment terms for these items are a certain payment discount if paid within 365 days. Included in these invoices are credit items which relate to refunds that are due to the customer.
    Below is a scenario for Customer XXXX:
    Invoice 1 Baseline date 12.01.2007
    Invoice 2 Baseline date 08.02.2008
    Invoice 3 Baseline date 15.02.2008
    I have set up a payment run for this customer to direct debit their items. In my scenario I only want to pick up the first two invoices.
    Therefore I set up the payment run to pick up those items which are due up to 09.02.2009, setting the next payment run posting date to 10.02.2009. I would expect the system to pick up only the first two invoices.
    What the system does is that it pays/collects the first two invoices in total, but then selects only the credit items of invoice 3. I would expect it to ignore Invoice 3 altogether.
    In another example if I had the same invoices, but invoice 3 did not have any credit items involved, then it does ignore invoice 3 as
    expected.
    I need to understand why for the credit items within a customer invoice are treated differently in relation to payment terms.
    Thanks
    Natalie

    In the customer master assign a different credit memo term than the payment term.
    Try changing the credit memo term for 3rd Invoice as such it do not fall in your selection criteria.

Maybe you are looking for

  • Release reason for blocked sales orders (VKM1 & 3)

    We have a business requirement for a mandatory reason when sales orders are released in credit management in the same way that rejected orders have a reason code linked to them. Has anybody else done anything similar?

  • CLASSIFICATION VIEW / MATERIAL MASTER

    HI EXPERTS, I am facing a problem regarding classification view of a material master. In my organisation for a perticular material type I have to maintain CLASSIFICATION view. But by mistake I forgot to maintain classification view of some material.

  • Can a Color Box display the transparent color [16777216]?

    I was trying to force a Color Box to display the transparent color [16777216 = "2 to the 24th"], but I didn't have much luck. Instead of displaying transparent, the Color Box wanted to paint a replica of the coloring tool's "transparent" icon, which

  • Multiple Projector Control?

    I am interested in figuring out the least expensive way to project 4 different video streams on 4 different projectors from my Mac. Ideally I would like to run these off my 17" G4 laptop because it is small and I don't use it that much (the monitor o

  • Does anyone know how to transfer pictures from a galaxy tab to macbook

    does anyone know how to trsnfer pics from the galaxy tab to macbook