Last invoice & last payment in month

good morning all the experts,
hallow all, I have a query like this:
SELECT
T0.[CardCode]as 'Customer Code', T0.[CardName]as 'Customer Name', T1.[PymntGroup]as 'T.O.P',
T2.[DocDate]as 'Invoice Date', T2.[DocNum] as 'Invoice Doc', T2.[DocDueDate] as 'Invoice Due Date',
T2.[DocTotal] as 'Tot Invoice', T3.[DocNum] as'Payment Doc', T3.[DocDueDate] as 'Payment Due date' ,
T3.[DocDate] as 'Payment Date', T3.[DocTotal] as 'Tot payment'
FROM
OCRD T0  INNER JOIN OCTG T1 ON T0.GroupNum = T1.GroupNum INNER JOIN
OINV T2 ON T0.CardCode = T2.CardCode INNER JOIN
ORCT T3 ON T2.ReceiptNum = T3.DocEntry
WHERE
T2.[DocDate] >=[%0]and
T2.[DocDate] <=[%1]and
T0.[CardName] =[%2]
if anyone can help me to display like this:
1. final invoice to customer A in one month
2. A customer shows the last payment in one month

Your query combined all invoices and payment tables. In this case, you may only get either last invoice or payment date.  There is no way to get both unless it is the same.
Thanks,
Gordon

Similar Messages

  • DME file prints last invoice only

    Hi Experts
    I have an issue with DME file generates with vendor's last line item only.
    I have created the DMEE tree of type PAYM. If payment has a multiple invoices I want to output them in the file for each FPAYP-XBLNR. But in my case it is printing only last invoice.
    Could anyone help us to solve the issue please.

    Hi
    any reply would be appreciated please

  • Vat no-paid till the last invoice

    Hello everybody,
    In France is obligatory for machinery purchases that have several invoices, to pay the VAT at the final invoice. however the VAT sometimes appears in the invoices and sometimes not.
    If the VAT does not appear in the invoice, there is no problem as the automatic payment program deals with it. (F110)
    But if the VAT appears in the invoice, What can be done for differ the payment till the last invoice? I mean, for the example above, how to pay 1000 instead of 1195?
    Is there any program for that?
    1000 frais                                                            fournisseurs  1195                  
    195 tva
    1000 fournisseurs                                            banc    1000
    thanks

    Hi,
    In France you need to to use the deferred tax functionality, i.e. VAT becomes liable to be paid when the payment happens and not at the time of invoice.
    Have a look at the detailed config document from the link below:
    [Deferred Tax - France|http://help.sap.com/bp_bblibrary/600/Documentation/V99_BB_ConfigGuide_MED_EN_US.doc]
    cheers.

  • Get Last Invoice Day and No of days based on Invoice date

    Hi,
    Can you please provide me logic on how to get the Last Invoice day from the invoice dates .
    Also want to the know the no. of days in the month based on invoice date,
    Thanks,
    Pra.

    Hi
    Getting this information there is few standard functions available. Try to find out & utilize it.
    or else you should have to write code in customer exit.
    swetha

  • Getting data in a query on last date of all previous months

    Dear Experts,
    I need your help with a query.
    I am trying to create a query which when run should pick the number of Open Sales Order on the last date of all the previous months from the start of company.
    I could create the query for fetching the required data on last day of the previous month, say today is 25th June 2014, so my query only fetches data for May 31st 2014 but I need data for all previous month, May 31st 2014, April 30th 2014, March 31st 2014 & so on.
    Please advise how to achieve this is SQL query.
    Thanks & regards,
    Nitin

    Hi,
    Try this:
    Select *
    from(
    SELECT T0.[DocNum] as #,t0.cardcode as C, t0.docdate
    FROM ORDR T0
    WHERE T0.[DocStatus] = 'o' and T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-1,0)),10) OR T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-2,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-3,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-4,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-5,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-6,0)),10) or T0.[DocDate]  = CONVERT(VARCHAR(10), DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,getdate())-7,0)),10)
    group by t0.cardcode,docdate,T0.[DocNum]) S
    pivot
    (count(#) for c in([cvt01],[cvt02],[cvt03],[cvt04],[cvt05],[cvt06],[cvt07],[cvt08],[cvt12])) P
    Note: Replace Cvt01,02...with your customer code.
    Thanks & Regards,
    Nagarajan

  • Reg Price diff for latest invoice and last invoice without user exit or bac

    Hi gurus,
    This is regarding the price difference of the latest invoice document price with respect to the price of last time the document was invoiced.Without using the customer exit or back-end developement. need info if this can be done on the front-end using the front-end tool bex designer using the CKF, RKF , Variables or conditions etc
    say for instance the user wants to get the price differences with respect to the invoices for a certain period that is from 01/01/2008 to 06/30/2008( dynamic entry can be any range).
    Once the user enters the range for the billing document date as 01/01/2008 to 06/30/2008 the query should return the report as
    Sold-to(customer) Material, Bill doc date and the price difference. these are the four columns the users needs in the report.
    now the bill-doc date will the latest invoice date for the sold-to & material, but the price difference will be the price of the last invoice date(for the sold-to , material) - the latest invoice date price.
    Example. between 01/101/2008 - 06/30/2008
    customer : 2765 , material : XAWE33636FD this particular customer-product had 3 invoices on 02/15/2008 , 04/18/2008 and 06/03/2008.
    price on 02/15/2008 : $1.09
    price on 04/18/2008: $1.87
    price on 06/03/2008: $3.84
    so the report should look like
    customer material bill doc date price diff
    2765 XAWE33636FD 06/03/2008 3.84- 1.87( latest invoice price - last invoice price)
    Thanks
    appreciate responses

    HI,
    Try this:
    EXIT_SAPMM06E_013
    *"      XEINA STRUCTURE  EINAU OPTIONAL
    *"      YEINA STRUCTURE  EINA OPTIONAL
    In debug find out what values are stored in XEINA and YEINA. One is the old value and the other is the new value.
    Regards,
    Subramanian

  • How to create report which includes records of current month and last 7 days of previous month.

    Hi Experts,
    I need to create a report which includes records of current month and last 7 days of previous month.
    I will get records of current month by this formula :- month({PROBSUMMARYM1.OPEN_TIME})=month(currentdate)
    Please tell me how to add the records of last 7 days of previous Month for the same report.
    Thanks in Advance.

    Hi Ajay,
    If you have more than a year data in your database then your formula will return wrong results. ie. If your data consist of 2012,2013,2014 data then below formula will return all 8th month data irrespective of year. So, you need to check year also here
    month({PROBSUMMARYM1.OPEN_TIME})=month(currentdate)  and
    Year({PROBSUMMARYM1.OPEN_TIME})=Year(currentdate)
    Now add Abhilash second statement in OR so, your formula should look like :
    (month({PROBSUMMARYM1.OPEN_TIME})=month(currentdate)  and
    Year({PROBSUMMARYM1.OPEN_TIME})=Year(currentdate))
    OR
    Date({PROBSUMMARYM1.OPEN_TIME}) IN [DateAdd('d',-7,Maximum(LastFullMonth)), Maximum(LastFullMonth)
    -Sastry

  • Currency Translation based on Last Day of the Acquistion month

    Dear all,
                Request to help me in understanding how we can calculate the currency translation rate as per the last day if the acquistion month..
    For Example if the  Acquistion date : 01/01/2008 (mm/dd/yyyy) the currency translation should happend based on the rate maintained as on 31/01/2008.
    Thanks
    Pavan Kumar Prakhya

    First, you will need to convert the actual acquisition date to the end date of the Fiscal Period. This can be done by using two separate Function Modules. First, get the actual Fiscal Period by entering the date and Fiscal Year Variant into the DATE_TO_PERIOD_CONVERT Function Module. Use the Fiscal Year and Fiscal Period from this and determine the end date of the Fiscal Period by using Function Module LAST_DAY_IN_PERIOD_GET with Fiscal Year, Fiscal Period and Fiscal Year Variant as your inputs.
    For the conversion, use the Function Module CONVERT_TO_LOCAL_CURRENCY. The inputs for this would be the last date of the Fiscal Period, the amount to be converted, the from currency code, the to currency code, blank in rate, AS01 in type of rate and X in read TCURR. This assumes, however, that month-end rates (rate type = AS01) have been loaded into your source system and these rates have been transferred to your BW environment.

  • How to get the last day of the next month?

    Hi all.
    I need to get the last day of the next month. E.g. if the date is 20.03.2008 I need to get 30.04.2008.
    Is there any FM for it?
    TIA, Nikolai.

    hi Nikolai,
    pls. have a look athe following piece of code:
    PARAMETERS : p_date TYPE sy-datum.
    DATA : gv_res TYPE sy-datum.
    CALL FUNCTION 'CALCULATE_DATE'
    EXPORTING
    *   DAYS              = '0'
       months            = '2'
       start_date        = p_date
    IMPORTING
       result_date       = gv_res.
    ==> Now you have (gv_res) 2 months later as today
    gv_res+6(2) = '01'. ==> gv_res is first day of next-next month
    gv_res = gv_res - 1. ==> gv_res is last day of next month
    hope this helps
    ec

  • How to get the last day of the previous month

    Hello Team,
    If  my input date is today , then i need to find out the last day of the previous month for the same.
    Can someone help me  to find out .. how can this be done.
    Regards,
    Ravi

    Hi,
    Try the below code.
         // get a calendar object
        GregorianCalendar calendar = new GregorianCalendar();
        // convert the year and month to integers
        int yearInt = Integer.parseInt(year);
        int monthInt = Integer.parseInt(month);
         int dayInt = Integer.parseInt(day);
        // adjust the month for a zero based index
        monthInt = monthInt - 1;
        // set the date of the calendar to the date provided
        calendar.set(yearInt, monthInt, dayInt);
        int day = calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
        return Integer.toString(day);
    Regards
    Venkat

  • How to create a recurrent event on the first or last work day of the month

    The lightning calendar allows selection of the first and last day of the month for recurrent events but for business I need to use the first and last WORK day of the month (Monday - Friday) to schedule particular tasks. In the calendar preferences under 'View' I can select the days that make up the work week but this does not transfer to an option in recurrent events. Is there another way to do this or is it just not available?

    Hi there,
    do know for the UlltimateBootCD4Win? This from CD bootable WinXP-BartPEedition with additional tools gives you the ability to make such things like partitioning, backup or formatting your HDD.
    It has many more applications which help you to maintain your system without booting your original OS.
    So I think that this CD will solve your partitioning issues.
    Heres a link: www.ubcd4win.com/
    Just try it and tell me your opinion.
    Nice weekend and greetings from the sunny south ;)

  • TS1967 I followed all the steps in this and it mostly worked, the problem was the library is missing the last 3 and a half months of music adds and ratings. Is there any way to get them back?

    Seriously this kind of *****. I have lots of music and freaked when it was all gone and I'm still freaking that I have to find the last 3 and a half months of music and rate it all over again. What can I do?
    When I plugged my iPod in it said there was songs on the iPod not in the library and I clicked the option to add them to my library but it didn't seem to work.

    check out this post by Zevoneer.
    also, there are PhoneView and iRip.
    edit: and start backing up !! you might want to bookmark this article for future reference: The Complete Guide to Backing Up your iTunes Library

  • Formula to calculate the last day of the subsequent month

    Hi - I am trying to create a formula in CR9 that will take a date field and translate it to the last day of the subsequent month.  For example, I have a date of today, 2/3/2009.  I need it to print on the report 3/31/2009.  I have made some progress to get me the 1st day of the subsequent month, but I need it to be the last day of the subsequent month.
    The formula I am have currently is:
    DateSerial(Year({Name.JOIN_DATE}), Month({Name.JOIN_DATE}) + 1, 0)+1
    this will give me 3/1/2009, but I need 3/31/2009.
    Any help appreciated. 
    Thanks!

    Hi Joe,
    You can use the following logic which also takes into account the extra day in a leap year.  You will need 5 formulas for this:
    First create a formula that calculates current month, call it @Current Month MM
    Month(Name.JOIN_DATE)+1
    Next create another formula called @Current Month Start Date which will give you the beginning of the month.
    totext(Date (year(currentdate),tonumber({@Current Month MM}) ,1 ))
    Next create another formula called @Current Year yyyy
    Year(Name.JOIN_DATE)
    Next, create a formula called @DaysofMonth with the following logic:
    if tonumber({@Current Year yyyy}) mod 4 = 0 then
    choose(month(date({@Current Month Start Date})),31,29,31,30,31,30,31,31,30,31,30,31) else
    choose(month(date({@Current Month Start Date})),31,28,31,30,31,30,31,31,30,31,30,31)
    Lastly create a formula called @Ending Date of Month
    totext(Date (year(currentdate),tonumber({@Current Month MM}) ,{@DaysOfMonth} ))
    I hope this information proves useful.
    Regards,
    Zack H.
    Edited by: Zack H on Feb 3, 2009 5:34 PM
    Edited by: Zack H on Feb 3, 2009 5:38 PM

  • HT1766 I cannot backup my iphone, it keeps telling me the backup is corrupt and not compatible. All forums have suggested I delete the last backup but that was months ago and I'm afraid if I do that and it still doesn't work, I won't have anything saved

    I cannot backup my iphone, it keeps telling me the backup is corrupt and not compatible. All forums have suggested I delete the last backup but that was months ago and I'm afraid if I do that and it still doesn't work, I won't have anything saved. Can anyone help?

    Try to connect in recovery mode, explained in this article:
    iOS: Unable to update or restore
    Before that, back up your device, explained here:
    iOS: Back up and restore your iOS device with iCloud or iTunes
    How to back up your data and set up as a new device
    You can check your warranty status here:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • Run process chain on last three days of the month

    Hello
    I need to run process chain on last three days of the month. For example , It should run on 28, 29 and 30th dates of June.
    There is no option to put a code in the start process of the process chain.
    I can run it every day and put a code in the infopackage/DTP so that empty load (0 records) will be done on other days.
    This doesnt sound as a good option.
    Do u know any other options?

    Hi
    See the code and details how to do it, and change the code as per your requirement.
    http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    Triggering  the Process Chains at Particular Date using Events
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/triggering%20%20the%20process%20chains%20at%20particular%20date%20using%20events.pdf
    BI-ABAP (Trigger Process Chains on evry month 3rd and 4th day).
    https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=81428842 
    Thanks
    Reddy

Maybe you are looking for

  • Hyperlink to a Page in the current document ? LiveCycle v8.2

    Can anyone help me with the syntax to hyperlink to a page in the current PDF ? I have not been able to locate any information on this ! This is a fill able XFA form & am attempting a Table of Content TextBox on the Main page with links to different p

  • How to capture the output of another program into a File/String

    I needed to capture the output of a dos program in an String/file I tried doing Runtime.getRuntime.exec("ipconfig /all >tmp.txt"); but still I am unable to capture the output frm the program which I would like to capture in a file or String.Can anyon

  • My iphoto libary has become unreadable, what should I do?

    When I try to open my IPhoto appears this: Your photo library is either in use by another application or has become unreadable. I already restarted my computer, but still doesn´t open. What whould I do? Or how could I get back my pics?

  • Connecting my all in one to my TV

    Hiya guys! I have a Wind Top AE2260 & would like to connect it to my TV. I have the HDMI cable which I connected to both, but don't seem to be able to get it to work, I am trying to use the tv as a monitor to watch my blu-rays. Any help would be real

  • MOPZ and landscape upgrade

    Dear Gurus, We have ECC and CRM and SCM systems. We are going to upgrade ECC to the next stack. Can MOPZ tell me if I need to update CRM and SCM also or not? Regards Vladimir Kogan