How to add a receipt number in the following Query for PO Report

Hi Guys,
I need a help regarding following query.
Its a PO report for 11.5.10.2
select distinct pv.segment1 supplier_number,
pv.vendor_name supplier_name,
pha.segment1 po_number,
pha.revision_num revision_num,
pha.authorization_status po_status,
to_char(pha.creation_date, 'DD/MM/YYYY') creation_date,
pha.currency_code currency_code,
pla.sum_amount_ordered sum_amount_ordered,
pda.sum_quantity_ordered sum_quantity_ordered,
pda.sum_amount_received sum_amount_received,
pda.sum_quantity_received sum_quantity_received,
(pla.sum_amount_ordered - pda.sum_amount_received) sum_accrued, --AVI
( pda.sum_quantity_ordered - pda.sum_quantity_received) quantity_accrued, --AVi
to_char(rsl.date_receipt, 'DD/MM/YYYY') date_receipt,
-- rsl.receipt_num receipt_number,
ppa.segment1 project_code, ppa.project_status_code, --10.0.0.4
aia.invoice_num invoice_num,
aia.invoice_date invoice_date, --AVI 
aia.creation_date invoice_creation_date, --AVI 
aia.amount invoice_amount_allocated_to_po, --AVI
pla.purchase_basis,
pla.category_id,
-- pda.item_description,
haou.name organisation, --10.0.0.3
pda.sum_quantity_billed sum_quantity_billed , --10.0.0.3
gcc1.CONCATENATED_SEGMENTS,
gcc2.CONCATENATED_SEGMENTS
from po_headers_all pha,
po_vendors pv,
pa_projects_all ppa,
hr_all_organization_units haou,
(select po_header_id,
sum(quantity * unit_price) sum_amount_ordered,
org_id,
purchase_basis,
category_id
-- pla.item_description,
from po_lines_all
group by po_header_id, org_id
, purchase_basis,
category_id
-- pla.item_description
) pla,
(select pla.po_header_id,
pda.project_id,
sum(pda.quantity_ordered) sum_quantity_ordered,
sum(pda.quantity_delivered * pla.unit_price) sum_amount_received,
sum(pda.quantity_delivered) sum_quantity_received,
sum(pda.quantity_billed) sum_quantity_billed, --10.0.0.3
accrual_account_id
from po_distributions_all pda, po_lines_all pla
where pla.po_line_id = pda.po_line_id
group by pla.po_header_id, pda.project_id,accrual_account_id
) pda,
(select po_header_id, charge_account_id,
-- rsh.receipt_num,
min(rsl.creation_date) date_receipt
from rcv_shipment_lines rsl
where rsh.SHIPMENT_HEADER_ID=rsl.SHIPMENT_HEADER_ID
group by po_header_id,charge_account_id
) rsl,
(select distinct aia.invoice_num, pda.po_header_id , aia.invoice_date --10.0.0.3
, aia.creation_date , sum(aida.amount) amount
from po_distributions_all pda,
ap_invoice_distributions_all aida,
ap_invoices_all aia
where pda.po_distribution_id = aida.po_distribution_id(+)
and aia.invoice_id(+) = aida.invoice_id
Group by
aia.invoice_num, pda.po_header_id , aia.invoice_date --10.0.0.3
, aia.creation_date) aia,
(select haou2.organization_id, haou2.name
from fnd_flex_value_sets ffvs,
fnd_flex_value_norm_hierarchy ffvnh,
fnd_flex_values_vl ffvv,
hr_all_organization_units haou1,
FND_FLEX_VALUE_CHILDREN_V ffvcv,
hr_all_organization_units haou2
where ffvs.FLEX_VALUE_SET_NAME = 'CAP_CODE_BU'
and ffvs.FLEX_VALUE_SET_ID = ffvnh.flex_value_set_id
and ffvnh.parent_flex_value like 'PO%'
and ffvv.FLEX_VALUE_SET_ID = ffvnh.flex_value_set_id
and ffvv.FLEX_VALUE between ffvnh.child_flex_value_low and ffvnh.child_flex_value_high
and substr(haou1.name, 1, Instr(haou1.name, '-')) =
substr(ffvv.DESCRIPTION, 1, Instr(ffvv.DESCRIPTION, '-'))
and haou1.organization_id = fnd_global.org_id
and ffvcv.parent_flex_value = ffvnh.parent_flex_value
and ffvcv.flex_value_set_id = ffvs.flex_value_set_id
and substr(haou2.name, 1, Instr(haou2.name, '-')) =
substr(ffvcv.DESCRIPTION, 1, Instr(ffvcv.DESCRIPTION, '-'))
union --10.0.0.1
select f.organization_id, f.name --10.0.0.1
from hr_all_organization_units f --10.0.0.1
where f.organization_id = fnd_global.ORG_ID --10.0.0.1
) bu
, po_line_locations_all plla --10.0.0.4
, gl_code_combinations_kfv gcc1
,gl_code_combinations_kfv gcc2
where pv.vendor_id = pha.vendor_id
and pla.po_header_id = pha.po_header_id
and pda.po_header_id = pha.po_header_id
and pha.po_header_id = rsl.po_header_id(+)
and pda.project_id = ppa.project_id(+)
and pha.po_header_id = aia.po_header_id(+)
and aia.po_header_id = pha.po_header_id
and pla.org_id = haou.organization_id
and pha.authorization_status in ('APPROVED', 'OPEN')
and plla.po_header_id = pha.po_header_id --10.0.0.4
and plla.closed_code in ('APPROVED', 'OPEN', 'CLOSED FOR INVOICE', 'CLOSED FOR RECEIVING', 'CANCELLED') --10.0.0.4
and bu.organization_id = haou.organization_id
AND gcc1.code_combination_id = pda.accrual_account_id
AND gcc2.code_combination_id =rsl.CHARGE_ACCOUNT_ID
In the following query I have commented receipt_num using the table rcv_transaction_headers.
If I uncomment it the query results huge number of unexpected report.
How can I add receipt number to the following query?
Should I use rcv_transactions. If yes, what would be the join conditions.
Kindly help as its urgent.
Thanks in advance.
Regards
Avijit

Sandeep is correct. I don't have time to tell you the correct query, but mine is something like this based on Sandeep's information:
SELECT rsh.receipt_num
FROM   rcv_transactions      rcvt,
       po_lines_all          pla,
       rcv_shipment_headers  rsh
WHERE  rcvt.shipment_header_id   = rsh.shipment_header_id
AND    rcvt.PO_LINE_ID          = pla.PO_LINE_ID
AND    pla.item_id              = (select distinct inventory_item_id
from mtl_system_items
where segment1 = '1216107-2')

Similar Messages

  • How to add text after number in the same cell? "200 units", "3Kg", "17 sqm"

    Dear Sirs,
    I have problem with adding text after a number in the same cell.
    For instance, in excel I am able to do this:
    200 units -----> this is on the same cell. Any number I type, "units" will follow automatically.
    I know that we can just type "200 units" but its in text format so it cannot be calculated supposedly I want to multiply it by others number.
    I know that we can do this by splitting into two cells, one on the left for the number "200" and another one on the right for the text "units".
    It would be helpfull if we could do this function such as "20 years", "3Kg" etc.
    Sorry to trouble you all.
    Thank you
    Q

    This is a case of uneven implementation in Numbers. This sort of functionality is available to format numbers used to label axis ticks on various charts, but not to format numbers in a cell. This feature should be requested.
    As an aside, perhaps a spreadsheet that actually managed numeric units as part of the calculation would be powerful and useful in avoiding formula bugs, something like is available in Google calculations. If you are unfamiliar with this, try one of the following examples typed into any Google search entry field:
    150 miles per gallon in liters per 100 kilometers
    100 * 20 yards / 40 minutes in mph
    Read more at http://www.google.com/intl/en/help/features.html#calculator

  • How to add 2 more field to the  Header of FBL5N ALV report output

    Hi All,
    I have copied and made some modification to the standard transaction FBL5N and added some fields to the ALV report line Items but how to add fields to the header part i.e if you execute the transaction FBL5n, you will get the ALV report, in the header part customer no, company code then I need to add the 2 more fields. can any one tell me that which structure or where I need to add these fields to be appear in ALV output screen.
    Thanks in advance.
    Swapna.

    Hi Mohamed,
    If you copied Z-FM successfully, then you have to go to subroutine TOP_OF_PAGE to add your field:
    *&      Form  TOP_OF_PAGE
    FORM top_of_page.
      DATA: b_suppress   LIKE boole-boole,
            opfi_text    LIKE eptext OCCURS 10 WITH HEADER LINE,
            n_color      TYPE i.
    *  IF     NOT it_items-bukrs IS INITIAL               "737295
    *     AND NOT it_items-konto IS INITIAL               "737295
    *     AND NOT it_items-koart IS INITIAL.              "737295
      gs_items = gt_alv.
    *  ENDIF.                                             "737295
    * skip first call at top of page:
      IF NOT gd_first_top IS INITIAL.
        CLEAR gd_first_top.
        EXIT.
      ENDIF.
      IF x_grid = c_x OR x_inet = c_x.                          "1012201
        PERFORM grid_top_of_page.
        EXIT.
      ENDIF.
    *... open FI: get header text.
    * first fill some RFXPO fields for general info:
      CLEAR: s_rfxpo, wa_kna1, wa_lfa1, wa_ska1.
      s_rfxpo-bukrs = gs_items-bukrs.
      s_rfxpo-kkber = gs_items-kkber.
      s_rfxpo-koart = gs_items-koart.
      s_rfxpo-konto = gs_items-konto.
      s_rfxpo-vrbez = gs_variant-variant.
      s_rfxpo-waers = gs_items-waers.
    * update master record:
      PERFORM fill_master_rec  USING gs_items-koart
                                     gs_items-konto
                                     gs_items-bukrs. " note 698396
      CALL FUNCTION 'OPEN_FI_PERFORM_00001640_E'
        EXPORTING
          i_rfxpo             = s_rfxpo
          i_kna1              = wa_kna1
          i_lfa1              = wa_lfa1
          i_ska1              = wa_ska1
        IMPORTING
          e_suppress_standard = b_suppress
        TABLES
          t_lines             = opfi_text.
    *... display open FI text:
      IF x_konto_sort = 'X'.
        LOOP AT opfi_text.
          CASE opfi_text-color.
            WHEN 1.
              FORMAT COLOR 1.
            WHEN 2.
              FORMAT COLOR 2.
            WHEN 3.
              FORMAT COLOR 3.
            WHEN 4.
              FORMAT COLOR 4.
            WHEN 5.
              FORMAT COLOR 5.
            WHEN 6.
              FORMAT COLOR 6.
            WHEN 7.
              FORMAT COLOR 7.
          ENDCASE.
          WRITE: / opfi_text-text.
        ENDLOOP.
        FORMAT RESET.
      ENDIF.
    *... display other header text:
      IF b_suppress NE 'X'.
        PERFORM display_custom_header.
        PERFORM display_ccard_lines.
      ENDIF.
    " Put your field somewhere...
    ENDFORM.                               " TOP_OF_PAGE
    Good luck,
    Thanks,

  • How  to add an extra field in the output of a predefined report

    Hi everybody,
    I have to add an extra  field  by name  "DAYS"(VTBFHAPO-ATAGE) in the output of a predefined report" RFTMBL01".
    please provide me the code and where to add in the predefined report

    Hi  Pasquale Isolato
    the predefined alv report name is "RFTMBL01" . If u r  with system  please check the code and the field name i have to add ids"DAYS'.
      if u are not with  system please reply me so that i will sen the code also
    Thanks in advance

  • How to terminate the running query for a report?

    Hi,
    When I run a report, the SQL query takes too long.
    This causes an overload on database.
    How do I stop query from running after some time?

    It is NOT possible in OBIEE 10g.
    In OBIEE 11g, When a scheduled report job is in running status, you can now cancel the running job from the Report Job History page.
    Check this Section 6.9, ["Canceling a Running Job." |http://docs.oracle.com/cd/E23943_01/bi.1111/e22257/view_manage_rpt_his.htm#cancel_runj]
    And only possible since 11.1.1.5
    regards
    Jorge
    p.s If this answers your question then please mark my answer as "Correct" or "Helpful"

  • Order by problem.......how to Ascending order by date from the following query

    hi
    i have following query to show the monthly sales after summing up monthly sales total but i have facing a problem this query is not properly perform order by clause according to the months like jan,feb,mar etc... please tell me where i made mistake
    SELECT     CashName AS AccountName, LEFT(DATENAME(month, CashDate), 3) + ' - ' + DATENAME(year, CashDate) AS Months, SUM(Total) AS NetSales
    FROM         dbo.CashSales
    GROUP BY LEFT(DATENAME(month, CashDate), 3) + ' - ' + DATENAME(year, CashDate), CashName

    Select AccountName, Months, NetSales from
    (SELECT CashName AS AccountName, LEFT(DATENAME(month, CashDate), 3) + ' - ' + DATENAME(year, CashDate) AS Months, SUM(Total) AS NetSales,
    DATEADD(month, DATEDIFF(month, 0, CashDate), 0) as dt
    FROM dbo.CashSales
    GROUP BY LEFT(DATENAME(month, CashDate), 3) + ' - ' + DATENAME(year, CashDate), CashName, DATEADD(month, DATEDIFF(month, 0, CashDate), 0)
    t
    Order By dt

  • How to add page numbers (centred) at the foot of a page?

    Even this is confusing!
    I typed my question hit return and was told I couldn't post a blank message.
    How do I post my message?
    I simply want to know how to add a page number at the foot (centred) of a page.
    Oh! Great! Now I see, I should have known to scroll way down to find "post message".
    Anne

    What kind of document: word processing? Spreadsheet? something else?
    What program are you using to create the document?

  • How to add A single row at the middle of the table in a Webi report

    Hi,
         I created a Webi report using Universe(Created universe using bex query).Now i have a requirement to display a row at the middle of a report. Can you please tell me ,how to add a sigle row at the middle of a Webi report.
                                                    Thanks in advance
    Regards
    Monika

    Hi Monika,
    It is not really possible to add a row (I assume you mean of unrelated data) to the middle of a table in a report. You can add a new table with a single row between two tables. For instance you could add a new one row table, or even single cells which are positioned relatively between two tables. Possibly a block on top of another. But this gets tricky.
    Can you explain in more detail what you are trying to do?
    Thanks

  • How do I add my serial number to the trial version?

    How do I add my serial number to the trial version?
    Downloaded the trial version of CS6, purchased it, and now I'm trying to add the serial number, but don't know where to enter it.

    On the Trial page , where it shows "x" days left.
    On bottom you will find a button "License this software " , click on that and follow the onscreen instruction.

  • How to add a large number of keywords to the e-mail filter?

    Hello.
    I would like to know how to add a large number of keywords to a filter.
    The thing I want to accomplish, is it to add around 4000 e-mail addresses to a filter list, which checks the body of incoming e-mails, which get forwarded to me.
    I don't want to outright delete them, but I would love it if it detects that the forwarded message contains one of the e-mail addresses, it would add a tag to the message.
    Is it in any way possible to make a filter like this, which doesn't slow Thunderbird down to ass-crawl speed?
    I tried to copy the whole list into the small filter tab, but It had no discernible effect on my messages, since some of the previously received ones, which I was sure contained the keywords, were not tagged. All it did was make the program super slow and I was forced to delete the filter.

    You can look at creating a exclusion crawl rule:
    http://technet.microsoft.com/en-us/library/jj219686(v=office.15).aspx
    You can also modify your content source starting addresses and remove onedrive:
    http://technet.microsoft.com/en-us/library/jj219808(v=office.15).aspx
    Blog | SharePoint Field Notes Dev Tools |
    SPFastDeploy | SPRemoteAPIExplorer

  • How to find Goods Receipt Number particular to Service Entry Sheet Number.

    Hi Experts,
      In one of my reports  i need to bring purchase order ,service entry sheet, goods receipt number .
    In ekbe i am getting the purchase order and its service entry sheet while keeping BEWTP = 'D'.
    so i am getting purchase orders and their service entry sheet numbers in belnr.
    Now i want to get the corresponding goods receipt number .
    But i am getting goods receipt number against the purchase order but not against service entry sheet , in same EKBE 
    while keeping BEWTP = 'E' movement type = '101'.
    My doubt here is how to get the corresponding goods reciept number for a service entry sheet.
    if i have three service entry sheet numbers for a purchse order i have three goods receipt numbers
    but how to get the relation between them  which GRN to which service entry sheet
    . is there any table which stores the service entry and its grn.
    If i am any thing functionally wrong  which i wrote above please correct me and give ur inputs.
    Thanks
    vamsi
    Edited by: vamsi talluri on Aug 20, 2009 7:21 PM

    Hi Sarath,
         If the Purchase order Item category is 'D' then it is a service order then it can have N service entry sheet numbers and once each service entry sheet is accepted it will be available for Goods reciept .. so that information will be avaiable..
    U can obtain the GRN against the Service entry sheet in EKBE itself.
    BELNR refers to GRN
    LFBNR refers to Service entry sheet number.
    And hence i am closing the thread.
    Thanks
    vamsi

  • How to add a phone number to an existing contact o...

    Hi all,
    Should be simple but apparently it is not: how to add a phone number to an existing contact on the E71 ?
    I can not believe Nokia made a mess out of such a simple, basic function!
    dovale 

    I just want to add another telephone number to an existing contact. I don't want to Add detail, Edit label, etc., just to add another telephone number! Simple.
    Apparently  the solution is this:
    On main screen write any number 0123456789 >> Press >> Option >> Save to Contacts >> Update Existing (Scroll or name your last saved contact or where you wanted to add new number) then save! 
    It is an amazingly anti intuitive and convoluted solution but I'm afraid that the entire UI of S60 3rd addition is one big UI mess!
    dovale 

  • How to add a ChartOfAccounts object into the database.

    how to add a ChartOfAccounts object into the database. please shows sample code
    thanks

    Dim CoA As SAPbobsCOM.ChartOfAccounts
                CoA = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oChartOfAccounts)
                CoA.Code = 11223344
                CoA.ExternalCode = "a1234"
                CoA.ForeignName = "f Test Account"
                CoA.Name = "Test Account"
                CoA.AccountType = SAPbobsCOM.BoAccountTypes.at_Other
                CoA.ActiveAccount = SAPbobsCOM.BoYesNoEnum.tYES
                CoA.FatherAccountKey = 100001
                If CoA.Add <> 0 Then
                    MessageBox.Show(oCompany.GetLastErrorDescription)
                Else
                    MessageBox.Show("Added Account")
                End If
    Remember the father account key must be a valid account number in the company where you are trying to add the new account.  (The G/L Account code seen in the SBO client)

  • How to add a radio station to the library

    just loaded itunes 6 (windows box) and can't find out how to add a radio station to the library

    If your current stations in WMP are .pls or .m3u URL's, they may work in iTunes also. Use the "Open Stream" command from the Advanced menu and put in the URL that includes .pls/.m3u. If the URL is a .mwv variety, those are Windows proprietary format and not supported by iTunes. Same with .ra streams (Real Audio).
    .pls & .m3u usually indicate MP3 based streams supported in iTunes. It's up to the original radio station/streaming site to select the format and make it available. Shoutcast.com & Live365.com are great resources for mp3 based streams.

  • Does anyone know how to add a preface page at the beginning of the book in ibooks author once the book is written? No matter how I try to add a Preface page, it goes to the end of the book.

    Does anyone know how to add a preface page at the beginning of the book in ibooks author once the book is written? No matter how I try to add a Preface page, it goes to the end of the book.

    Thanks. I've tried this and apparently the template I'm using is one of those where it doesn't work. I've tried dragging it as well as cutting a pasting but it always travels back to the end of the book. Maybe I can try changing the template temporarily, move the preface page, and then convert back to the original template. I'll experiment a little.

Maybe you are looking for

  • Header Text in Sales Order

    Hi Experts, I have problem when i am creating the sales order i want to put some text in the Header Data. But when i navigate through the menu go to--> Header --> Text, the moment i select that it is giving ABAP short Dup with errors "Exception condi

  • Turn off location in calendar ios8

    Location field in calendar won't turn off in iOS 8. This is an older iPad but don't know which one. I tried Settings  then Privacy then Location Services then Calendar. My setting is Never. But I still get the map stuff (I use the location field for

  • CP1252.txt error message

    Hello InCopy Community: I have a new user that has InCopy CS6 (version 8.0.1) installed on their Windows System 7 computer.  Most of the time, the software opens the files successfully. However, on some files the InCopy user receives the following er

  • Migrating Samba/LDAP from Linux to OSX Server

    Hi all. I've inherited a fairly "pure" implementation of OpenLDAP and Samba 3.x, running on a Debian server. While it's stable enough, making user changes is not terribly easy, and involves using LDAP and then smbpasswd, for example. I can manage thi

  • Asks for a new  address when actavation on adobe system?

    I put the correct adress in but it did not like the orginal address. I'm not going o add more addresss to my files.