Query  for report to show Invoices, Payments and Discounts

Hi All
I am hoping someone can help me with this query.
What the customer needs is the invoices for a specific date range, the payments applied to the invoices and the discount amount
Eg...
Invoice    payment   discount
100         90              10   
This would be easy to get from the ORCT and RCT2 tables.
However, sometime the users add the payment on account and reconciles the invoices and a manual journal for the discounts.
So it would be best to look at the OITR and ITR1 tables?
This is what I have so far and it almost balances...
I am using this query to create the report in crystal,
To create the discount amount from the incoming payment window i said (T0.ReconSum - T3.TrsfrSum)
I also took out the vat amount within that formula.
With the amounts from the manual journal, i just took the amount as is.
select T2.CardCode, T2.CardName, T0.SrcObjTyp, T0.SrcObjAbs, T0.ReconSum, T3.TrsfrSum, T4.ReconDate, T2.U_FundedNonFunded, (T5.Debit - T5.Credit), T6.PymntGroup
from ITR1 T0
             inner join OCRD T2 on T0.Shortname = T2.CardCode
             left outer join ORCT T3 on T3.DocEntry = T0.SrcObjAbs  and T3.CardCode = T0.ShortName
             inner join OITR T4 on T4.ReconNum = T0.ReconNum
             left outer join JDT1 T5 on T5.TransId = T0.TransId and T5.ObjType = T0.SrcObjAbs and T0.ShortName = T5.ShortName
             inner join OCTG T6 on T6.GroupNum = T2.GroupNum
            where T3.DocDate <= getdate() or T5.ContraAct = '1127331'
the account 1127331 is the Discount GL account.
Based on the example the Payment + discount = Invoices
however not all the customers are balancing..
any ideas? it looks like my query is getting only the invoices where a payment has been done. The amounts just dont seem to match.
Thank you
Jerusha

hi
I think your join with OJDT is wrong in this part : T5.ObjType = T0.SrcObjAbs
you should write
T5.ObjType = T0.SrcObjTyp
(I think you don't need this part at all )
try this:
select T2.CardCode, T2.CardName, T0.SrcObjTyp, T0.SrcObjAbs, T0.ReconSum, T3.TrsfrSum, T4.ReconDate, T2.U_FundedNonFunded, (T5.Debit - T5.Credit), T6.PymntGroup
from
ITR1 T0
inner
join OITR T4 on T4.ReconNum = T0.ReconNum
inner
join OCRD T2 on T0.Shortname = T2.CardCode
left
outer join ORCT T3 on T3.DocEntry = T0.SrcObjAbs and T3.CardCode = T0.ShortName
left
outer join JDT1 T5 on T5.TransId = T0.TransId and T5.ObjType = T0.SrcObjTyp and T0.ShortName = T5.ShortName
inner
join OCTG T6 on T6.GroupNum = T2.GroupNum
where
T3.DocDate <= getdate() or T5.ContraAct =
'1127331'
please let me know if it works now
shachar

Similar Messages

  • Do we have the report to show PO Price and invoice actual price

    Dear Guru,
    I'm finding the report to show PO Price and Actual Price after invoice.
    The actual price is mean that we may have other debit/credit price as subsequent posting in MIRO.
    So we would like to compare PO price and actual Price.
    Please kindly advice.
    Thank you very much.
    Best Regards,
    Saiya

    Hi,
    Please check ME81N --> Order value analysis.
    SAM
    Edited by: Saminathan Gopalan on Jul 22, 2010 6:05 PM

  • For me it showing your payment type is invalid....am using hdfc-mastercard...

    for me it showing your payment is invalid....am using hdfc-mastercard-debit

    Sign into your account using the iTunes app and make sure all of the payment information is current and correct, including the 3 digit security code from the back of the card.

  • Generate report to show all users and groups in Shared Services in EPM 11x

    Hi,
    Is there any way to generate a report (like a migration report or job status report) which can be generated through workspace/shared services 11.1.1.3 so that my admin can look at all the users and groups created. Something that I can view and probably print out? Any suggestions?
    ~Adeeba

    Yes, I knew this one. This basically shows me the users and groups assigned specific provision access. Is there any way to view a report that shows which users and groups have access to dimensions of an individual planning application?
    ~Adeeba

  • Report to show open PO and all AP Invoices

    Hi all!
    At this moment I have two reports that my customer asked.
    One shows all open PO by cost center and project and goes like this:
    SELECT T2.PrjName, T1.Project, T0.OcrCode 'Centro de custo', sum(t0.LineTotal) 'Total', T1.Docstatus
    from POR1 t0
    INNER JOIN OPOR T1 ON T1.DocEntry = T0.DocEntry
    INNER JOIN OPRJ T2 ON T2.PrjCode = T1.Project where (T1.Project > '0' or T0.OcrCode > '0') and t1.Docdate > '[%0]' and t1.docstatus='o'
    GROUP BY T2.Prjname, T0.OcrCode, T1.Project
    The other shows all AP invoices (open and close) by cost center and project:
    SELECT T2.PrjName, T1.Project, T0.OcrCode 'Centro de custo', sum(t0.LineTotal) 'Total', T1.Docstatus
    from POR1 t0
    INNER JOIN OPOR T1 ON T1.DocEntry = T0.DocEntry
    INNER JOIN OPRJ T2 ON T2.PrjCode = T1.Project where (T1.Project > '0' or T0.OcrCode > '0') and t1.Docdate > '[%0]' and t1.docstatus='o'
    GROUP BY T2.Prjname, T0.OcrCode, T1.Project
    Now what the customer wants is one report showing this information, so he can see the totals of open PO and all invoices by project. He wants the docdate too. Is this possible? And showing the totals by project or by cost center.
    Thank you all.
    Kind regards,
    Pedro Santos

    Hello Gordon,
    Thank you for your answer.
    You're right, the second query was not the right one.
    Here it is, the query with the AP invoices by project/cost center:
    SELECT T2.PrjName, T1.Project, T0.OcrCode 'Centro de custo', sum(t0.LineTotal) 'Total'
    from PCH1 T0
    INNER JOIN OPCH T1 ON T1.DocEntry = T0.DocEntry
    INNER JOIN OPRJ T2 ON T2.PrjCode = T1.Project where (T1.Project > '0' or T0.OcrCode > '0') and t1.Docdate > '[%0]'
    GROUP BY T2.Prjname, T0.OcrCode, T1.Project
    About the total and the docdate on the same report, I had a colleague helping me with that and he made it. It's not perfect but it serves the customer's needs. If you want I can show you the query.
    Regards,.
    Pedro Santos

  • A/R invoice+payment and A/R invoice PLD reports

    We are using PLD to generate our reports. Our A/R Invoice+payment report is different from our AR invoice. We have designed to report formats for this in PLD. However, PLD allows to preview only one report that has been made default. Is there an option that we can use to select the type of report to print especially for these reports?
    Regards,
    Asif

    Hi
    I don't think there is any alternative way beside selecting PLD everytime you print the layout .
    I believe it is done by same person (both A/R+ payment and A/R invoice )
    If not you can do :
    1. make your PLD  default  by user  or
    2. In most cases ,only few customer pays right away , you can set PLD default by Business partner or customer who does that
    Hope this helps
    Bishal

  • Report to List Incoming Payments and related Invoices

    Hi Experts,
    I would like a query which lists Incoming Payments and also the related Invoices which were paid.
    Is there a table which links together the ORCT and OINV tables?
    Thanks
    Greig

    Hi Greig,
    Link to ORCT - OINV( SELECT * FROM ORCT T0  INNER JOIN OINV T1 ON T0.DocEntry = T1.ReceiptNum )
    Link to ORCT -RCT1 - OINV( SELECT * FROM ORCT T0  INNER JOIN RCT1 T1 ON T0.DocNum = T1.DocNum
    NNER JOIN OINV T2 ON T0.DocEntry = T2.ReceiptNum)
    Try this,
    Lists of Incoming Payments and related Invoices.
    SELECT T0.DocNum,
    COUNT(T0.DocEntry) 'No of Invoice'
    FROM RCT2 T0
    INNER JOIN OINV T1 ON T0.DocEntry = T1.DocEntry
    GROUP BY T0.DocNum
    Regards,
    Madhan.
    Edited by: Madhan Babu C on Aug 28, 2009 9:23 AM

  • Budget Report to show the fixed and variable split for Materials

    Hello Gurus,
    Could you tell me if there is a budget standards report that will show the fixed and variable split for Materials? Example: Labor, Equip., QC and Overheads? 
    I need it for the correctly rolled-up 'final material number' step.  The report that does this now (without fixed and var split) is the Indented BOM Comparison (sret - cost mgmt-product costing - cost mgmt-customized reports - cost estimate comparison - costed multilevel compare rpt - Indented BOM Comparison).
    Thanks,
    Jefferson

    one simple way is in your final itab declare a slno type i field
    data : begin of itab occurs 0,
    slno type i,
    <other fields>
    end of itab.
    after filling the data in itab.
    loop at itab.
    itab-slno = sy-tabix.
    modify itab.
    endloop.
    in fieldcatalog also you have to define that slno field as the first column.
    but it will change its order if you are sorting the output or filtering the output.
    regards
    shiba dutta

  • Query or Report to show last restart times and patches that were installed?

    Hi,
    Is there a query available that I can run that will show a the last restart times and patches that were last installed for servers in our environment? I found a couple examples for getting last restart time but not sure how to combine it with patches that
    were installed? TIA

    Hi,
    Could you please post your query on this thread? You could check the query for reference.
    SCCM Query: Uptime and Last Reboot Time
    Note:
    Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
    Best Regards,
    Joyce
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Report to show workbook, worksheets and owner

    Hi,
    I need to be able to produce a report to show all of the workbooks stored on the db. I need to be able to list the owner, workbook name and the sheets.
    I have been looking at Eul_user_queries but there is way too much data there for what I need.
    Any help would be appreciated.
    Thx
    Dennis

    You can find the workbooks and owners in the EUL5_DOCUMENTS table. The worksheet information is stored in the DOC_DOCUMENT long raw column. This column is encrypted, so it is impossible (so far, many have asked and tried, but no one has succeeded) to get worksheet details.
    You may also be able to get worksheet details from the EUL5_QPP_STATS table. That has information about all workbooks and sheets, but a worksheet needs to have been run to be included here.
    Another way would be to use the EUL5 business area (ORAHOME_FOR_BI_TOOLS/discoverer/EUL.eex). Import that BA (if you haven't already), and it may be easier to manage the EUL_USER_QUERIES data.
    I may have a query using QPP_STATS, but it will be a while before I can find it and post it.

  • Witholding tax at the time of Invoice, payment and advance

    Dear experts,
    I have few questions as below. It would be great if you can help me out in this :
    In vendor master I have two WTH tax codes for invoice and payment and marked as liable.
    Incase of invoice (FB60) posting system is calcu;ating correctly and posting, but while posting no popup for to rectify the WTX code also no base amount is populating in WTH tax tab of invoice posting. Is this correct way??
    While making payment for the same invoice through F-53, system is again calculating on same open item and no popup, until I go to WTH tax tab and delete the tax amount. What is lacking in my customising of WTH tax code (payment type), to restrict WTH tax calcutaing twice ??
    While making advance payment by F-48, system not calculating WTX tax and showing tax code is mandatory, even though tax code (V0-tax exempt) entered, no WTH tax calculation happening. I have checked all Field status of document type and recon account, nothing is mandatory. I dint know why?? Please help in this regard.
    Thanks in advance.
    Regards
    Abhi

    Hi madhu
    Thanks for explaining the process it works.
    Regarding the error I was facing earlier to enter the tax code in F-48 for the tax category was marked as ' * ' in the advance reconciliation GL. I have removed them and now the error is not coming.
    But now for the same or advance payment with F-48, I am not able post the document, though the payment WTX code is showing but not calculating the amount for the same.
    The error is
    "Withholding tax amount exceeds total bank line item amounts."
    Message no. 7Q320
    How to post it. Please help.
    Regards
    Abhi

  • Select Query for Report

    Hi All
    I have a table called Agent. Each Agent processes requests.
    So accordingly Request is another table.
    Now the Agent can process the request successfully, fail or it could be
    in progress.
    So accordingly I have a status column in the Request table which can have the following values
    New - when the request is allocated to the agent
    Open- When the agent opens the request
    Action- when the agent acted upon the request
    Sold - when the agent was successful in processing the request
    Fail - when the agent could not process the request
    In the Request table there is column called requestDate which is the
    date when the Request was first inserted (i.e when its New)
    Now whenever the agent acts upon the request from the front end
    the status change is logged in a RequestLog table.
    So when the agent changes the status to Open, an entry is logged into
    RequestLog table.
    So when the agent open the request an entry in the RequestLog table
    would go with the status as open , the reference of the requestId &
    the date on which the status is changed
    Similar entries will be logged for each request when the agent acts on
    the respective requests like if its Sold then the status will be sold,
    the date of sale & the corresponding request Id will be logged into the
    RequestLog table.
    In the Request table the status will be changed to "Open" or "Sold" but the
    requestDate will not change & it will remain the date when it was inserted
    Now I want to generate a Report which shows the list of all agents within a state
    with all total number of requests they have handled, how many are in Opened status,
    how many are in Sold status & how many are in Fail status. I also have to show the
    average time(in days) it took for each agent to Open the request, make the sale or qualify it
    as Fail. This average time I want it for an agent & not request specific.
    & In the end I have to show the grand total of all the requests handled by all the agents,
    grand total of opened status requests,grand total of Sold status requests,grand total of Fail status requests as well as the total average time it took to Open ,total average time it took to sale & total average time it takes to Fail
    I have dabbled with simple SQL but not a complex report type like above. So I would need help from all you experts.
    Here is what I plan to do
    my from clause would include the Agent, Request, RequestLog table
    where Request.requestdate between <fromDate> and <toDate>
    group by agent.agentname,
    Select would have count(agent.requestid),
    Now how do i show the list of Open requests, sold requests & fail requests in different columns since all these values are in the same column.
    Also I am aware of the average fnction but I need help on how to use the same in such a scenario.
    Do post your thoughts on the same.
    Regards

    Hi All
    I have made some queries to fetch the Report data. I would want you to post your comments on the same.
    This is my first query which returns the total count of request per dealer, how much are in open, sent & dead state & total per status.
    select AGENT.COMPANY_NAME,count(REQUEST.REQUEST_ID) TOTAL ,
    sum(decode(REQUEST.status,'Open',1,0)) OPEN,
    sum(decode(REQUEST.status,'Sent',1,0)) SENT,
    sum(decode(REQUEST.status,'Dead',1,0)) DEAD
    from AGENT, REQUEST
    where
    AGENT.STATE='ACT'
    and REQUEST.REQUEST_TYPE='B'
    and REQUEST.CONFIRMATION='Y'
    and AGENT.DEALER_ID = REQUEST.DEALER_NUMBER
    group by grouping sets(AGENT.COMPANY_NAME, ())
    Then I have to retrieve the average number of days it takes to change the request to Open, average number of days it takes to change the request to Sent & average number of days it takes to change the request to Dead
    per Agent. The base date is stored in REQUEST table (request_date column) & the subsequent change of status is stored in activity_date column
    of ACTIVITY table
    Here is what I do get the average number of days it takes to change the status for the Agent
    select AGENT.COMPANY_NAME,
    avg( decode (REQUEST.status,'Open',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_OPEN,
    avg( decode (REQUEST.status,'Sent',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_SENT,
    avg( decode (REQUEST.status,'Dead',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_DEAD
    from REQUEST, ACTIVITY, AGENT
    where
    AGENT.STATE='ACT'
    and REQUEST.REQUEST_TYPE='B'
    and REQUEST.CONFIRMATION='Y '
    and REQUEST.dealer_number = AGENT.DEALER_ID
    and REQUEST.STATUS = ACTIVITY.STATUS
    group by grouping sets(AGENT.COMPANY_NAME, ())
    I hope this is the right way for calculating average number of days
    Since most part of the queries is the same
    I tried to merge both the queries into one because I need to render the report in that fashion. But the moment I merge the query its giving absurd results.
    Do post your thoughts on the same
    Regards

  • Need a report that shows sales shipments and billing by date

    We need a report that will show sales shipment and billing information by date.  Specifically, we need to find orders that were shipped in one month/period, but were not invoiced until the next month/period.  Does a standard report exist?

    I dont think it is possible. You will have to customize.
    For list of deliveries, you can use VL06O.
    For billing due list, you can use VF04.
    Regards,
    GSL.

  • Query for Report Asset By Location

    Dear All,
    I want to record asset using add on SAP. I want to make a query report that show asset per location. I'm using field U_User01 to record location of FA. The report will contain Code of FA, Name of FA, location, Acquisition value, Accum Depr and Net book value. This report will be made per period.
    Is there any one can help me to make the query ?
    Thanks a lot for your help

    Hai..is there anyone that can help me to solve this problem ? Thanks for the help

  • SSRS- report builder showing recent sites and server as blank

    Hi All,
    A client of ours when executes Report builder is not able to see Report models as report builder just gets open but do not create connection to server.
    We have done the following settings for same:
    Used both name and IP of system and added the same to Trusted Sites in IE settings
    Also we have used port number along with URL for report builder.
    We have given all rites to user on reporting services (SQL)
    But it is still not showing report models. 
    Kindly help us.  It is very urgent.
    Thanks in advance
    -Regards
    Kumud 

    Hi Kumud,
    According to your description, your client can't see the created report models in Report Builder. Right?
    In this scenario, the reason why the client can't see the report models because he doen't connect to report server. Please click the
    Connect at the left bottom of Report Builder and type the report server url manually to reconnect the report server. 
    If the connection is failed, please check if there any process on client side which occupies the port for report server URL. Here are two articles for your reference to do troubleshooting.
    Report Builder 3.0 error : Connection Failed. Unable to connect to the server that is specified in the URL
    Connecting to Report Server
    Since the Semantic modeling language (SMDL) report models are deprecated. Although you can you continue to use existing report models as data sources in SQL Server 2012 or later version Reporting Services reports you should consider updating your reports
    to remove their dependency on report models.
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

Maybe you are looking for

  • Can we release the standard price for a material whose Price control is "V"

    Hi experts, Could you please clarify my doubt that can we release the standard cost of a material whose price control is "V". Our user is trying to release the std price. But its not getting released. If the material is of ML relevant I could have ch

  • Calling a Oracle Stored Procedure which will take a while to complete

    Hey. I'm calling a Oracle stored procedure which goes of and do a whole lot of things and therefore takes a fair while to complete. Currently I am doing this: String sql = "begin concorde.start_transfer(); end;"; HibernateUtil.getSessionFactory().ope

  • Connecting to non-secure listener port over TCPS

    Hi, I am trying to connect to non-SSL port over TCPS. When I use tnsping, it hangs. When I do an OCIServerAttach, it hangs. Client is 10.2 And Database server is 9.2 and higher.. Any way I can find out why this is happening?? -Harsha

  • Asset Issue to Employee Vendor

    Dear All, Scenario to be mapped PO is raised against an Asset. GR is done and It has to be issued to an Emloyee vendor. this has to be shown in inventory in order to issue to a vendor, but it is an asset. How this can be mapped in SAP Regards. Edited

  • Need help with Error code (-1202) in itunes store

    ITunes Store keeps giving me error code 1202  when I try to click links. I'm using itunes 11 also itunes music page shows blank white screen. And the iTunes Match section doesn't show any pictures and looks like a website when it's on HTML format.  T