Query for Payment PO

Dear all expert,
I want to make a query that pull information from PO, down payment Invoice, AP Invoice and Journal Transaction. The column that appear in that query is :
- Column 1 : PO Date
- Column 2 : PO Number (all PO with series number prefix is SPK)
- Column 3 ; PO Value
- Column 4 : Down payment invoice Value for the PO. If there is more than 1 DP Invoice that use for the PO, it will group become 1
                    row
- Column 5 : AP Invoice value for the PO. If there is more than 1 DP Invoice that use for the PO, it will group become 1 row.
- Column 6 : Sum of JE transaction that account code is group mask '1'
I'm using an UDF called "SPK" to link the transaction (PO, DP, AP and JE). This UDF SPK value is same with PO number.
So, i want to put all PO information on the left and the other information (DP, AP and JE) on the right and it will show the value if the UDF_SPK on the transaction (AP, DP and JE)  = PO number.
Please help about this query...
Thanks a lot
Edited by: Ho  We I on Aug 14, 2009 2:10 PM

Hi!
SELECT T0.DocNum ,T0.DocDate, T0.CardCode, T0.CardName,
T1.ItemCode,T1.Dscription, sum(T1.Quantity) as Quantity, sum(T1.Price) as Price,max(T1.TotalSumSy) as Total_sum, max(T0.DocTotal) as Total
FROM OPOR T0 INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OPDN T2 ON T2.DocEntry = T1.TrgetEntry
INNER JOIN PDN1 T3 on T3.DocEntry = T2.Docentry
INNER JOIN OPCH T4 ON T4.DocEntry = T3.TrgetEntry
INNER JOIN PCH1 T5 ON T5.DocEntry = T4.DocEntry
LEFT JOIN OOEI T6 ON T6.DocEntry = T3.TrgetEntry
LEFT JOIN OEI1 T7 ON T7.DocEntry = T6.DocEntry
Group By
T0.DocNum ,T0.DocDate, T0.CardCode, T0.CardName,
T1.ItemCode,T1.Dscription

Similar Messages

  • For pAyment Terms Changes , where we can maintain the relevant Enteries

    Hi Gurus,
    My Query - For Payment Terms where we can Maintain The Relevant enteries other than Customer Master from FI point of view.
    pls guide me in this..
    Thanks in Advance
    poonam

    Hi Poonam,
    Payment term we are maintaining in customer master in two places.
    1) - Company code data page --> On payment transaction tab --> This is for FI
    2) - Sales area data page --> Billing document tab --> This is for SD
    Hope it helps,
    Regards,
    MT

  • Query for Vendor Payment in SAP

    Hello All,
    I am a sap abap developer with little knowledge in SAP MM and SAP FI modules.
    As per some requirement of my company ,i have created a PO then its GR and finally IR.
    Now when i checked EKBE table (History per Purchasing Document) , i found two record in this table out of which one with
    VGABE = 1 (Good Receipt) & another with  VGABE = 2 (Invoice Receipt) .
    Now my requirement is ,i want a entry in this table with VGABE = 5 (Payment) but i don't know how to do payment of vendor in sap so that this table will populate with a entry for payment type.
    Please help me and let me know what will be the flow with tcodes to do the vendor payment in sap.
    Please reply ASAP.
    Thanks in advance.
    Regards.
    Abhinav Goel.

    Hello Mr.Raman,
    Thanks for your response to my query.
    As per my company requirement i have to track duplicate payment made to the vendor against same PO.
    So for that after completing the cycle PR-PO-GR-IR-F-53 finally i found two records in BSAK table out of which :
    One record was  with my accounting document no from my invoice receipt of type RE.
    Another record was with the vendor payment clearance document with type KZ.
    Now again i have done payment to the vendor using F-53 tcode and now i found one more record with belnr = last payment document no and augbl = new payment document no. with type KZ.
    So if i use below mentioned logic to track for duplicate payments made to the vendor ,then it will be fine or if not can you suggests me the needful changes in the logic.
    1.) Check If record exists for my belnr no from invoice recipt in bsak.
    2.) Take AUGBL No for this BELNR No and check if record exists for this AUGBL with type KZ.
    Note:Means payment is done to the vendor upto this logic.
    3.) Now if with the found record with type KZ any other record found with type KZ it can be taken of as duplicate payment made to the vendor.
    Please suggest me if above mentioned logic is fine.
    Regards.
    Abhinav Goel.

  • Adhoc query for Off cycle Payments(infotype 0267)

    Dear All,
    I have a rquirement to create a query for off cycle payments infotype(0267).
    It should show the payment done for each wage type.
    Can we pick the data from PC_payresult from table RT - Results Table.
    If yes, please let me know the process and if not, is there any other way to get the splits of offcycle payment.
    Regards,
    Prasad.

    Hi All,
    Do any one know how to create this query?
    Do we have any standard reports regarding the splits of offcycle payment infotype(0267)..
    Regards,
    Prasad.

  • Query to include payment status cash / cheque for payment received.

    Hi,
    We would like to amend the following query such that a user can select incoming payments received in cash or by cheque, with the total value of payment made.
    SELECT T1.CardCode, T1.CardName,T3.SlpName, T0.DocDate as 'Posting Date', T0.DocNum as 'AR
    Invoice Number',
    T0.DocTotal as 'AR Invoice Total', T0.DocTotalFC as 'AR Invoice Total FC', T1.DocDate as
    'Payment Date',
    T2.DocNum as 'Incoming Payment Number ',T2.CheckSum as 'Amount'
    FROM OINV T0 INNER JOIN ORCT T1 ON T0.ReceiptNum = T1.DocEntry INNER JOIN RCT1 T2 ON
    T1.DocNum = T2.DocNum
    Left Join OSLP T3 ON T3.SlpCode= T0.SlpCode
    where T1.DocDate >=[%0] and T1.DocDate <=[%1] ORDER BY T1.CardName
    The above query retrieves only the bank tarnasctions, cash transactions are not recorded.
    Please advice how can it be done?
    Regards

    Try this one to get the number:
    SELECT T1.CardCode, T1.CardName, T0.DocDate as 'Posting Date', T0.DocNum as 'AR Invoice Number',
    T0.DocTotal as 'AR Invoice Total', T0.DocTotalFC as 'AR Invoice Total FC', T1.DocDate as 'Payment Date',
    T1.DocNum as 'Incoming Payment Number ', T1.CashSum, T1.TrsfrSum, T1.CreditSum,
    T2.DueDate as 'Check Due Date' , T2.CheckNum as 'Check Number', T2.CheckSum as 'Amount', T3.SlpName
    FROM OINV T0 INNER JOIN ORCT T1 ON T0.ReceiptNum = T1.DocEntry LEFT JOIN RCT1 T2 ON T1.DocNum = T2.DocNum
    Left Join OSLP T3 ON T3.SlpCode= T0.SlpCode
    where T0.DocDate >=[%0] and T0.DocDate <=[%1]
    For your 2nd question, it will be difficult to use one query for all.  You may have to create different queries to separate different payment means.

  • Query for Incoming Payments

    Hi Guys,
    I written a query for incoming payments  for some particular account heads and i have tried this.
    But did not achieved the  desired result.
    Anybody please modify the query.
    SELECT T1.[DocNum], T0.DocNum,  T0.AcctCode, T0.SumApplied,  T0.AcctName ,
    (Select sum(SumApplied) from rct4 where T0.docnum = t1.docentry and T0.acctcode='355102'),
    (Select sum(SumApplied) from rct4 where T0.docnum = t1.docentry and T0.acctcode='211417'),
    (Select sum(SumApplied) from rct4 where T0.docnum = t1.docentry and T0.acctcode='355103'),
    (Select sum(SumApplied) from rct4 where T0.docnum = t1.docentry and T0.acctcode='211436')
    FROM RCT4 T0 
    Left outer  JOIN ORCT T1 ON T0.DocNum = T1.DocEntry INNER JOIN NNM1 T2 ON T1.Series = T2.Series
    WHERE T2.[SeriesName] ='Spares' and t1.docdate between [%0] and [%1]
    Regards,
    Vamsi

    Hi Vamsi,
    Try this:
    SELECT T1.DocNum, T0.DocNum,
    (Select SumApplied from rct4 where docnum = t1.docentry and T0.acctcode='355102') AS '355102',
    (Select SumApplied from rct4 where docnum = t1.docentry and T0.acctcode='211417') AS '211417',
    (Select SumApplied from rct4 where docnum = t1.docentry and T0.acctcode='355103') AS '355103',
    (Select SumApplied from rct4 where docnum = t1.docentry and T0.acctcode='211436') AS '211436'
    FROM RCT4 T0
    INNER JOIN ORCT T1 ON T0.docnum = T1.DocEntry
    INNER JOIN NNM1 T2 ON T1.Series = T2.Series
    WHERE T2.SeriesName ='Spares' and t1.docdate between [%0\] and [%1\]
    Thanks,
    Gordon

  • Query for allowed payment methods of BP

    Hi there,
    i would like to make a query where i get all allowed paymentmethods of a BP. Unfortunatly i do not know in which table i can find this information. The query for checking the standard paymentmethod is quite easy but i do not know in which table i get the information of the allowed (checked) paymentmethods.
    thx for your help.
    best regards
    Manuel

    Another question: is there an easy way to update all BP (so that it is allowed) with a paymentmethod without using DTW?
    If I try it with an update query i think it is not the right way because it is not really an update of an existing record it's adding a new allowed paymentmethod.
    br
    Manuel

  • TDS Amount on Vendor Advance Shows positive value in *QUERY* for TDS Report

    Hi Everybody,
    I have made a query for List of TDS Report with Vendor informations as required by my client. In which the value of TDS on Vendor Advance Payment appears as positive value instaead of negative value. Please suggest how to rectify.
    Thanks,
    Paul

    Dear,
    If you have cleared the advance in F-54, then this will reverse the tax amount. That could be the reason for tax amount in debit.

  • SAP Query for AR Aging Report

    Hello Gurus-
    I am trying to build a query for Aging report, and would like to include something like this:
    Customer-Reference-Payment terms-Due date-Current-31-60days-61-90days-91-120days-over120days-toatal amount.
    I have an infoset which includes BSID, KNA1, KNB1. I have maintained local fields:
    Due Date  =     Baseline date + cash discount days
    Statement Date = My input date.
    Current    = Condition (DUEDTE >= STATDTE - 30) formula (Amount)
    31 - 60 Days = Condition (DUEDTE >= STATDTE - 60 AND DUEDTE < STATDTE - 30) formula (Amount)
    61 - 90 Days = similar to above
    91 - 120 Days = similar to above
    Amount  = - 1 * (If Debit credit indicator = "H" then "Amount in local currency") otherwise "Amt in Loc.Cur"
    Over 120 Days = similar to above
    When I enter a statement date of today it works hunky dory...it all looks good...my current column looks good and do the rest. When i want to run this query as of couple of months ago (if today is 12/19/08 and i wanted to run my aging report for 10/31/08) it should give me aging as of my statement date 10/31/08 but it does not. It calculates the total amount as of today. I know because of local field "Amount" where i gave amount in local currency, but how would I tell that it should pick up amount in local currency till the statement date?
    Any input in this regards is highly helpful.
    Thanks,
    RNarayan

    Hi Ram,
    On your aging report you want to see invoices which are still not paid (or still open) as of a certain date. This date is "key date". You need to define a variable for key date (which is normally system date if you run today) but it could be a past date.
    So key date is let us say Oct 31st (X) and the system date is Dec 19th. When you run the report as of Oct 31st all invoices that are posted prior to Oct 31st (posting date less than X) and are still in BSID will show on your report. There is no issue here.
    Let us say an invoice was created on Oct 25th (Y) and was paid on Nov 15th (Z). The clearing date is Z. That means if you run the aging report today this invoice will not show.
    But you want to run the report on Oct 31st. This means X is greater than Y but is less than Z.
    Clearing date and posting date are part of BSAD. Report run date is the user input and is a variable.
    With the above concept and with the help of an ABAP programmer you should be able to solve the problem.
    Regards
    Sharabh

  • What is the query for Accounts Payable Trial Balance (APXTRBAL) in 11.5.10?

    Hi Guys,
    What is the query for Accounts Payable Trial Balance (APXTRBAL) in 11.5.10?
    I have to write an AP Invoice Aging Report in Discoverer to show all unpaid invoices that have been transferred into GL... Business wants it to match one-to-one with the AP Trial Balance standard report...
    Business wants to run the report for any date in a past...
    The report has two parameters:
    As Of Date - the same as As of Date for the AP Trial Report
    Trial Balance Run Date - the date when Trial Balance was run...
    Conditions are:
    TRUNC(Invoice Date) <=TRUNC(NVL(TO_DATE(:As Of Date),SYSDATE))
    TRUNC(NVL(Payment Date,'01-JAN-5000')) > TRUNC(NVL(TO_DATE(:As Of Date),SYSDATE))
    TRUNC(Invoice Creation Date) <= TRUNC(NVL(TO_DATE(:Trial Balance Run Date),SYSDATE))
    Distr Accounting Date <= TRUNC(NVL(TO_DATE(:As Of Date),SYSDATE))
    NVL(Distr Creation Date,Invoice Creation Date) <= TRUNC(NVL(TO_DATE(:Trial Balance Run Date),SYSDATE))
    Show_Flag = 'YES', where:
    Show_Flag = CASE WHEN ( NVL(Cancelled Date,'01-JAN-1901') > NVL(:As Of Date,SYSDATE) AND NVL(Inv Amount Aud,0) = 0 ) THEN 'YES' ELSE ( CASE WHEN NVL(Inv Amount Aud,0) = 0 THEN 'NO' ELSE 'YES' END ) END
    There is a difference between the logic of my report, and the logic of AP Trial Balance...
    Could you please advise what I'm missing?
    Thanks,
    Iana

    What is the query for Accounts Payable Trial Balance (APXTRBAL) in 11.5.10? You can get the code by opening the report in Reports Builder and get the query.
    Or, enable trace/debug as per (FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12 [ID 296559.1]).
    Thanks,
    Hussein

  • Can not query AP Payment Batch.

    Hi All,
    Our payables department setup a payment batch today and it completed without any error. When we try to query the batch by batch name, the query returns nothing. We can see the rest of the batches that were processed today but not this one.
    Is this a known bug or something?
    We are on 11.5.9/9i.
    The invoices in this batch show 'Selected for Payment' status. I truncated ap_selected_invoices (after backing it up) but these invoices still show 'selected for payment' status.
    Thanks
    A/A
    Edited by: asgar_amin on Nov 30, 2010 12:15 PM

    Is there any other way to unselect these invoices??
    Anyone please??

  • Business Content for "payment history and ageing report"

    Hi,
    We have AP and AR modules implemented in R/3. And recently the client is implementing Collections Management module in R/3. There is a requirement which has come in which we need to provide the a report by customer the past payments made for the last 6 months and the recievables ageing for 1-30 days, more than 30 days and 90 days. A  sample is:
    Division                 Past-due payment history                                            Receivables Ageing
    Customer         CM-5  CM-4  CM-3  CM-2  CM-1  CM                               1-30days   >30 days  90 days
    A                     04/10  05/10  06/10  07/10  08/10  09/10                            150          200       300
    etc, where CM = Current Month
    After going through the requirement we have found that data for this requirement can be taken from AR module itself as Collections Management data is not being used. In this scenario, if I want to develop a payment history and recievables aging report in BW from AR module, which data sources can be used. I am new the finanace module so if any links to good stuff is greatly appreciated.
    Thanks and Regards
    Vijay

    0FI_AR_4 datasource is the BSID/BSAD line items from R3 and the standard DSOs and Content will give you the ability to do aged debtor reports
    You will have to create your own aged debtor reports in WB as the std ones are pants.
    You create an aging bucket for each aging based on the following example criteria..
    CKF 0-30 days = RKF 0-30 Days Open + RKF 0-30 Days subsequently cleared
    (ie you are tryign to restate the ledger to a point in time)
    RKF 0-30 Open is..
       posting date <= key date
       item status = 0
       net due date on a constant selection of 0 and -30
    RKF 0-30 Subsequently cleared is..
       cleared date > key date
       posting date <- key date
       net due date on a constant selection of 0 and -30
    For payment History - I wouldn;t bother with the standard KNB5 extractor (although you can have a look at ti) _ I find it a bit too high a level
    I would create a realised payment terms report which looks at the following calculations:
      cleared date - net due date (realised payment terms)
      net due date - doc date (offered payment terms)
    And then create a query for all item status = C transactions which aren't payments (ie not equal to doc type DZ) and show the above calculations weighted per Customer Payment Term
    Many ways to skin a cat - the two above will help you on your way
    and

  • Can any one send select query for this?

    Hi,
    can any one plese send select query for the following query.please send as early as possible.
    Loop through the I_BSID internal table to fill records in I_OUTPUT.Combine data from I_BSID, I_KNKK, I_KNKK_KNKLI, I_KNA1 and I_KNVV into I_OUTPUT based on the linking conditions .Field Description Source are
    I_OUTPUT-BUKRS     Company code     I_BSID-BUKRS
    I_OUTPUT-KUNNR     Customer number     I_BSID-KUNNR
    I_OUTPUT-NAME1     Customer Name     I_KNA1-NAME1
    I_OUTPUT-KNKLI     Credit account     I_KNKK-KNKLI
    I_OUTPUT-KDGRP     Customer Group     I_KNKK-KDGRP
    I_OUTPUT-KLIMK     Credit Limit     I_KNKK_KNKLI-KLIMK
    I_OUTPUT-KVGR1     Business Unit     I_KNVV-KVGR1
    I_OUTPUT-REBZG     Invoice Number     I_BSID-REBZG
    I_OUTPUT-BLDAT     Invoice Date     I_BSID-BLDAT
    I_OUTPUT-WAERS     Document Currency     I_BSID-WAERS
    I_OUTPUT-DUE_DATE     Due Date     Based on below
    Calculation
      Get the Payment terms days combining I_BSID and I_T052 based on the linking conditions mentioned above.    Note : a) Baseline Date : If baseline date I_BSID-ZFBDT is blank , use the Document Date.b) Payment Term Days :If I_BSID-ZBD3T is not blank, take this as Payment Term Days for Due date calculation.
                       If I_BSID-ZBD3T is Blank, then get payment term days from I_T052 based on I_BSID-ZTERM. If there are more than one record in I_T052 for the given Payment term, get the day part from baseline date and select the first record where the day limit I_T052-ZTAGG is greater than the day part.If I_BSID-ZBD3T is blank and I_BSID-ZTERM is also blank, then take Y000 (Due Immediately) as Payment term and proceed with the above logic. Set the payment term field blank while printing.
    Calculate Due date : For Debits, Determine Due Date = Baseline Date + Payment term Days(not discount days)                                                          For  Credits  Due date = Baseline date.Then, move the amount I_BSID-DMBTR to respective buckets (Not yet Due, Current Due, Past due 1-30, Past Due 31-60 etc.)  Based on the due date.
    Thanks&Regards,
    praveen kumar.A

    HI,
    To get Open Items you can use Function module:
    data:i_items TYPE STANDARD TABLE OF rfpos.
    CALL FUNCTION 'CUSTOMER_OPEN_ITEMS'
    EXPORTING
    bukrs = p_bukrs
    kunnr = wa_customer-kunnr
    TABLES
    t_postab = i_items
    EXCEPTIONS
    no_open_items = 1
    OTHERS = 2.
    Table I_items will have all the open items for that Customer in the given company code.
    Well for Clear Items: Try
    GET_CLEARED_ITEMS or FMITPOFM_CLEARED_ITEMS_GET.
    Hope it helps.
    Manish

  • Copying Comments from Outgoing Payments form to its checks for payment

    Hi!, is there a way to pass the comments from the Outgoing Payments to the comments of the check for payment of the same outgoing payment?
    We want to see in the checks for payments comments field, the same comment from the outgoing payment which the check was originated.
    Thank you!

    If you are talking about bringing the Outgoing Payment comments to the Check Journal Remarks field, you could do it using a formatted search.  Save the following SQL and link the query to the Journal Remarks field
    SELECT T0.Comments FROM [dbo].[OVPM] T0 WHERE T0.DocNum = $[OCHO.TransRef]

  • Invoice block for payment

    Hi,
    We know that after booking invoice through MIRO, the document created may go for block for payment. This we need to release either by MRBR or FB02.
    My query is based on what configuration in spro do this invoice goes for block for payment?
    Thanks & Regards,
    Indranil

    HI,
    In spro-Logistic Invoice Verification-Invoice Block here you will get setting for same
    and spro-Fin Acctg-AR&AP-Business Transactions-Outgoing Payments-Outgoing Payments Global-Payment Block Reasons-define Payment Block
    1 ) Tolerances are defined in customizing to configure which variance to be accepted and which one to be blocked.
    check following link also
    [http://help.sap.com/saphelp_470/helpdata/en/a8/b99539452b11d189430000e829fbbd/content.htm]
    [http://wiki.sdn.sap.com/wiki/display/ERPSCM/MM-IV-LIV-CRESetTolerancesforIncoming+Invoice]
    Regards
    Kailas Ugale

Maybe you are looking for

  • How do I create this rollover effect?

    http://www.gunnar.ca/layout.htm I am attempting to design a site. I have the idea for the layout and have created it using tables at the address above. I realize I should be using css to create the layout instead of tables. First of all - is this lay

  • RV document type psoting line item wise...

    Hi experts, My requirement is i am posting a Invoice with 2 line items ( service related Billing) from SD module with doc type RV. i am getting the  report in FBL5N 6700147 6700147 RV 22.07.2009 22.07.2009 123.00 6700147 6700147 RV 22.07.2009 22.07.2

  • HT2513 ical issues...cannot access it

    I changed my gmail password, I am able to get my gmail. but not able to access my calendar now?? this is what I get... The server responded with an error., The server did not recognize your user name or password for account "[email protected]." Ma

  • Expose Web Dynpro as Callable Object

    Hi, I created my own webdynpro application which I want to expose it as callable object and in the process I cannot complete the following step: Add DC caf/eu/gp/api/wd and its public part IGPWebDynproCO.  The reason is that I cannot see any DC calle

  • Web service info in SICF

    ECC 6.0, SP16 here. I created a web service from a BAPI recently using the WS creation wizard from SE37 (btw, using wizard from se80 gives the same results). Everything went fine, but when i go to SICF now, i see that my Web service has three extra n