To get PO number against invoices at header level only

hi
I have this query to retireve payments against invoices
SELECT ai.gl_date, aca.amount paymentamount, aca.bank_account_name,aca.check_number,aca.DOC_SEQUENCE_VALUE voucher_num,
       aca.payment_method_lookup_code, aca.vendor_name suppliername,ai.base_amount functional_amount,   pha.segment1 po_num,
       aca.check_date paymentdate, aida.period_name, aida.creation_date
  FROM ap_invoices_all ai,
       ap_vendors_v avv,
       ap_invoice_payments_all aipa,
       ap_checks_all aca,
       ap_invoice_distributions_all aida,
       po_distributions_all pda,
       po_headers_all pha,
         HR_ORGANIZATION_UNITS_V hrov
WHERE ai.vendor_id = avv.vendor_id
   AND aca.vendor_id = ai.vendor_id
   AND aipa.check_id = aca.check_id
   AND aipa.invoice_id = ai.invoice_id
   AND ai.invoice_id = aida.invoice_id
   ANd pda.po_distribution_id=aida.po_distribution_id(+)
   AND pda.po_header_id = pha.po_header_id(+)
   AND pda.destination_organization_id=hrov.organization_id
    and aca.STATUS_LOOKUP_CODE !='VOIDED'
     and  aca.DOC_SEQUENCE_VALUE='212366'
order by to_char(ai.gl_date,'MM')
18 records are shown
for aca.doc_sequence_value='212244 no rows returned
i found the reason as to this 212244 has no PO number
so i had to rewrite the query using ANSI JOINS
SELECT ai.gl_date, aca.amount paymentamount, aca.bank_account_name,aca.check_number,aca.DOC_SEQUENCE_VALUE voucher_num,
       aca.payment_method_lookup_code, aca.vendor_name suppliername,ai.base_amount functional_amount,   pha.segment1 po_num,
       aca.check_date paymentdate, aida.period_name, aida.creation_date
  FROM ap_invoices_all ai
     join  ap_vendors_v avv on(ai.vendor_id = avv.vendor_id)
      join ap_invoice_payments_all aipa on (aipa.invoice_id = ai.invoice_id)
      join ap_checks_all aca on (  aipa.check_id = aca.check_id  and aipa.invoice_id = ai.invoice_id)
       join ap_invoice_distributions_all aida on (  ai.invoice_id = aida.invoice_id)
    left join  po_distributions_all pda on (pda.po_distribution_id=aida.po_distribution_id)
      left join po_headers_all pha on(  pda.po_header_id = pha.po_header_id)
        left join HR_ORGANIZATION_UNITS_V hrov on  (pda.destination_organization_id=hrov.organization_id)
    where aca.STATUS_LOOKUP_CODE !='VOIDED'
     and  aca.DOC_SEQUENCE_VALUE='212366'
order by to_char(ai.gl_date,'MM')
now i get the correct data for 212244 
but when i run the same query for 212366 i get 19 records  as one invoice in this 076998 has 3 line items and one line item dont have PO
BUT the requirement is to get  only PO information at the header level not line levelkindly guide
thanking in advance

When you need only PO numbers, link only the 3 tables to make your query simpler.
ap_invoice_distributions_all aida,
po_distributions_all pda,
po_headers_all poh
Only po based invoices will be selected for these tables

Similar Messages

  • Surcharge at the header level only to the customer in the sales document

    Hi guys,
    I have requirement to charge the surcharge at the header level only to the customer in the sales document, the condition type as well as the value should not be distributed to item level
    I have marked the condition as header. But still the value is copied to the item as well,
    If I mark the condition as Group condition, then it distributes the total value to each item in the document according to Qty
    Is there any other way, I could set up through config,
    Regards,
    Rao.

    Hi,
    In T.Code VTFL, check what is maintained for field Pricing Type. If it is B then change it to G or depending on your business select a suitable value.
    This should resolve your issue. Let me know in-case the issue still persisits.
    Regards,
    Rohan Gudavalli

  • How to get the text field in the header for only first page of the report

    Hi,
    I am developing reports in BI Publisher Enterprise where i am facing problem i.e., i have to get some text field in header,for only first page in the result but it is displaying in all the other pages of the report in result.So,please if you have any idea of how to solve it, please reply.It is required as early as possible.
    Thanks in Advance

    Invalid path? What are you doing? Writing the report output to an invalid directory?
    Where are your terms and conditions? It would be very easy just to put them in a database table and select them in your report query.

  • Tolerance for Invoice at header level

    Hi,
    In our business process we use unplanned delivery cost for freight. It is allowed upto 5% of purchase order value. If it is more than purchasing need to review with vendor.
    In this scenario I want to set the tolerance limit in LIV when ever invoice value exceeds PO value by 5% system has to block the invoice.
    I used tolerance key PP, but it will not work at header level. It is specific to each PO line item.
    Please advice if there is any we can block the invoices when tolerance limit exceeds the PO value for total goods received.
    Best Regards

    Jaya,
    Unfortunately there are no tolerance keys designed to work in the manner that you desire. All the standard tolerance keys work at the item level.
    The only solution I can think of would be do some sort of validation on the unplanned delivery cost field via a user exit/BADI in MIRO.
    Hope this helps {or probably not:)!}
    H Narayan

  • Aggregating on header-level only

    Hi experts,
    I'm facing the following scenario:
    I've got an infoprovider which contains item-level keyfigures.
    The correspoding headers have keyfigures which cannot be disaggregated to the items.
    It would not be a problem to provide a header-level infoprovider,
    and an item-level infoprovider, but I cannot find a way to bring both sources together
    in the same query.
    A concrete example:
    The header-level infoprovider contains the confirmed quantity of an production-order.
    The item-level infoprovider contains the component-materials used by this prod-order and it's quantity.
    In the target report I'd like to see the confirmed quantity of a prod-order as well as the components-level.
    The problem is, that if I provide the prod-order-quantity on the item-level, that they will be aggregated multiple-times (according to the number of components used by a prod-order).
    Example:
    Data:
    ProdOrder     Component     Conf.Qty     CompQty
    111     X     10     3
    111     Y     10     2
    112     X     10     1
    Wanted result, when aggregated on ProdOrder-Level:
    111     10     5
    112     10     1
    Actual result, when aggregated on ProdOrder-Level:
    111     20     5
    112     10     1
    Is there any way to solve that?
    I'm still fighting with the idea of exception-aggregation, but it seems as if I had not understood the concept yet.
    Best regards,
      Marco

    Hi AL,
    that's correct, and works quite good as long as I have got the prod.order in my drilldown.
    What I unfortunately did not describe: I need the "first value" of each prod-order-component cummlulated...
    So to correct my initial need:
    Wanted result, when aggregated on ProdOrder-Level:
    111     10     5
    112     10     1
    Wanted result, when aggregated completly:
    20     6
    In the way you described, I'll get
    10 6
    because always the "first value" is displayed and no summation is done anymore (for that keyfigure)

  • Report on Service Contracts Authoring header level only

    Created a Discoverer report that returns most of the header level data for Service Contracts Authoring. Issue is that for Summary/Parties it is returning all contacts. I want to see if I can limit the return to what the user is seeing at the application level (Role, Name, Email etc...) for the Contacts. I have found articles that suggest main line is what I want to return but had no luck. I have tried what I thought would be other unique identifiers from the okc_contacts_v, okx_party_contact_v, but the returns for each contact were identical. Thanks for any input on this subject.

    Hi,
    Try to figure what security rule the application uses.
    you need to look at the view that lies behind the application screen.
    To do that you need to change the profile "Hide Diagnostics menu entry" for your user to: No using sysadmin.
    Then go to the application screen where you see the needed data and go to Help->diagnostics->Examine.
    enter password for APPS.
    Then chose in "Block" the SYSTEM and in "Field" Chose "Last Query".
    You'll get the sql behind the last query you made in the screen.
    Copy it to the SQL tool and start drilling into the view/s.
    Try to find the security applied in the sql and use the same in your query.
    At the end of this process you'll get the same security in your view as in the application.

  • Why release strategies for PO at header level only

    We have release strategy for Purchase Requisitions and Purchasing documents like PO, Contract and SA.
    In case of PREQ we have a choose for either item level release or header level release, whereas in case of PO, Contract and SA only header level release is possible.
    My question is why SAP has provided only the header level Release Strategy for PO, Contract and SA? I wan to know the reason and logic behind this.

    Hi,
    For PR's, there is no header level data. Becuause vendor number is optional since it is internal document from the user dep. to pur org. That's why, vendor number fields is at item level in the source of supply screen. But this is optional field.
    That's why, you can release PR line items one by one or all at a time.
    If you are releasing all line items at a time, need header level release.
    If you release line item by line item, need item level release.
    But in the case PO/Contract/SA, these are final reference documents and sending to the vendor as external documents.
    That's vendor number is at header level field and line item in the PO are related to the single vendor.
    That's why u cann't release line item by item, i.e., item level release.
    You can relase all the  items in the PO or u can reject entire PO, not a single line item.
    That's why, only header level release is possible for the PO/Contract/SA.
    Regards
    KRK

  • Make invoice with item level only not by batch level

    Hii
    i made a delivery doc say material 'A' having batch1,batch2,batch3 with different qty .
    exp:(VL03N)
    material a batch1 10ton
    material a batch2 20ton
    material a batch3 30ton
    Now i wanted to club all this qty and do invoice with single item for 'Material A' ,it shouldn't come with batch level wise material .
    so in vf01 it should look like this .
    material a 50 ton .
    Plss suggest what should i do for this cases ?? if poosible for changes in routine vbrk/vbrp in copy control then kindly suggest /
    sourav .

    Hi,
    Is your requirement for printing the invoice or while creating the invoice [VF01] Please confirm.
    regards,
    Chetan

  • Number of invoices which has been cleared.

    Dear all,
    How can I get the number of invoices which has been cleared based on vendor and company code for a selected fiscal year and period?
    Thanks you very much.

    Hi SCNT,
    Check in MIR6
    OR
    You can always use transaction SE16 on table BKPF, provide the document date & fiscal year and then click on the tab "Number of entries" in the top, the system throw the number of invoices in the system for that selection.
    Regards,
    Rahul.

  • Payment block in FB60-header level

    Hi,
    I am having trouble posting AP transactions and blocking them for payment when posting them at FB60. I blocked the transaction (at the header level) before the system generates a document number but when I look in vendor line open items the block isn't there and I have to re-enter it there.
    Could you please help me with what could be the possible reason for same.
    Regards,
    Abhishek

    Hi,
    Actually the problem that I am faing is that we have not put any payment block in Vendor Master data.
    However, while entering the invoice in FB60, in the payment tab we want to block the invoice (at header level), so as to block all the open items. But after teh selection of payment block field when we save the invoice, it does not take the payment block but is free for payment.
    We are required to again to through every open item in the invoice to block them. Which is okay6 in case of small number of open items.
    Hope i clarify my question.
    regards,
    Abhishek

  • Clear IDOC creation when only header level changes are made ME22N.

    Hi All,
    when the PO is  on changed in the header level only(for example header texts and header code)  and when we execute RSNAST00 one BADI getts triggered which checks if the Item category is 9 and  badi will clear the IDOC creation.
      If the PO item category is = 9, the IDOC must not be created. This badi works fine if the changes are made at
    1)at Item level
    2)both header level and Item level
    In case of 1 and 2 we have both header segment E1EDK01 and item segments E1EDP01.As a result it checks for the item category in the item segment.so idoc is not created.
    3)BADI is not working when the changes are made at the header level only. The IDOC is getting created even though the PO has the item category as 9.
    I found in this case only header segments are availble while debugging and the item segments are not there to check the condition for the item category.
    Please any one can suggest me possible solutions to  clear idoc creation when only header level changes are made ME22N.
    The BADI used is as below.
      DATA : lwa_data TYPE edidd.
      DATA : lw_dp01 TYPE e1edp01.
      DATA : lwa_control TYPE edidc.
      CHECK idoc_control-rcvprn = '3PL' AND idoc_control-idoctp = 'ORDERS05'.
      LOOP AT idoc_data INTO lwa_data.
        IF lwa_data-segnam = 'E1EDP01'.
          lw_dp01 = lwa_data-sdata.
          IF lw_dp01-pstyp = '9'.
            CLEAR create_idoc.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDMETHO
    Thanks in advance.

    Hi all,
    Is there  any way that I can get the item category details when Only header level changes are made to the PO in ME22N and only header segments are available in the IDOC.
    Is this possible:- Fetch the po number and item category details from ekpo table that matches with  the header segment po number and then check for item category value  to clear the idoc creation?
    Any information is helpfull.
    Edited by: Selina.selk on Nov 20, 2009 1:39 PM
    Edited by: Selina.selk on Nov 20, 2009 2:49 PM

  • Discount value not updating at contract header level

    Dear Friends
    I am facing problem of updating discount value at contract header level. The scenario is u2026. my client used to provide certain service to their customer. For that they maintain quantity contract & bill them as per billing plan. When customer avail three or more  services they get 10% extra discount. Now the problem is after continue for some days if some customer wants to drop  one item we are cancelling the line item by assigning proper cancellation procedure but the  system is not reversing the 10% discount.
    Example u2013
    Contract valid for 1st Jan 2009 to 31st Dec 2010(Value for each service = 10)
    (Total no of item-3)
    (Discount-10%)
    Here bill value for each month is  10x3-(30x0.10) =27
    At the month of march 2009  customer decided to drop for one item so hence forth the bill value should be 10x2=20
    But the system is calculating 10x2-(20x0.10)=18
    We need to update the value at contract header level only to satisfy some CRM functionality.
    Please suggest how to solve this issue

    Hi,
    If that is  item condition then you can not change it at header level
    check in M/06 make it at header level  in change which can be made tab
    Regards
    Kailas Ugale

  • Adding Variant in Header Level in the Sales Order

    Field "Card Verification Value" (CVV) is part of the Standard from Support Package SAPKH47028 onwards. But if you like you can use a variant for screen SAPMV45A4440 and set
    field "Card Verif.Code" to invisible in this variant.
    This is the reply from SAP after implementing the new support pack. Now there is an additional field in VA01 that I am trying to remove.
    I can add the variant in Table Settings but that is on Item Level in the Sales Order (VA01). How do I do it in Header Level?

    Hi,
    Go to SHD0 ,write down the Transaction code , transaction variant then go to Tab " With Processing'.
    Now you will be in T Code VA01 ,press enter and you will get all the variants maintained in Header Level.
    Now you can activate / deactivate as per your requirement.
    Best Regards,
    Ankur

  • Printing invoices with VF31 in only one spool request

    Hello,
    we want to print a number of invoices with VF31 using only one spool request, as at this time we become one spool request for each document.
    The problem is that VF31 calls indirectly RSNAST00 and this program makes a call to the print program where we have OPEN_FORM and END_FORM each time, so this creates one spool request every time the program is called.
    Is there a way to print in only one spool request without doing big changes to programs?
    Thanks and regards.

    Hi,
    To append to an existing spool, see the SAP Notes 85318 and 16410.
    For spools to be appended the parameters 'New spool request' and 'Do not Append Print Jobs' must be set to 'No' by the application creating the spools.
    For Sapscript, when the application call the function module OPEN_FORM in your print program, you can transfer a structure ITCPO to the parameter OPTIONS. Via ITCPO-TDNEWID, you can select the option 'New Spool Request'.Via ITCPO-TDFINAL, you can can select if the spool is closed.
    Regards,
    Aidan

  • Sample reading at Header level (Preliminary step) arlready unsuccessful

    Hi All,
    In condition technique     I am getting following message  u201CSample reading at Header level (Preliminary step) already unsuccessful  .
    I can see this in one of the attribute of condition thru access trace. Also one of the field of access seq is not displaying for attribute.
    Please let me know if there is any OSS notr os some solution for it.
    Thanks

    Thanks TG,
    But my condition is not time /date stamped. It has two fields Plant=Vendor and product.
    At Product master I can see the price . My table is also populating value of Plant and product.
    But some how product the field is not populating in side access seq while checking trace at condition tab of item.
    Root>> Condition_determination>>Step>> Attributes
    Attributes----Sample reading at Header level (Preliminary step) arlready unsuccessful
    Access Knumh
    Access UsageData
    Access Text     -
    Sample reading at Header level (Preliminary step) arlready unsuccessful
    Access Success-- False
    >>> Attribute
               Attrribute Table field--- INVENT_LOC
               AttributeCase name----INVENT_LOC
               Inventory class vale---49D23455......................
    Since access seq has two fields Product and INVENT_LOC. This field Product is not populating in attribute section.
    Thanks

Maybe you are looking for

  • How can I set a report to have an audit trail?

    I am using Business Objects Enterprise and am having a difficult time getting an audit trail set up for reports. If reports are scheduled, then the audit trail exists. But if the reports are manually generated, no audit trail exists. Any suggestions

  • How to convert a table exists in db into an ore.frame object ?

    Hi: I can get the "ore.frame "object that is returned by ore.ls() while have created by ore.create(),but I want to make a table in db as "ore.frame" object and I can operate it in R console.But how? thanks very much.

  • Possible to connect the iPad VGA accessory to a DVI display?

    I have the VGA accessory. It connects to an old CRT/VGA display and looks pretty good but my current display is a LCD/DVI unit. Is there an adapter available that can adapt from the VGA female to male DVI? Thanks.

  • QUESTION REGARDING FUNCTION MODULE

    what is the use  ' IT_EVENTS' in the function module 'REUSE_ALV_GRID_DISPLAY'

  • H:dataTable Problem

    Hi, I have a SearchBean class which is a managed bean. It has a SearchResults Class. The SearchResults class has a few integers, and a ArrayList of SearchData. This works <h:outputText value="#{jci_SearchBean.searchResults.searchDataList[0].title}" /