Po_Headers_All.Closed_Code

Hi,
What is difference between AP PO Report and OPEN PO Report ?
1) On what basis Po_Headers_All.Closed_Code column is updated like "Closed"/"OPEN"/"Finally closed" with sample will be helpful

When any line/shipment is open, the po_headers closed code is open.
When all lines are closed, then the closure status is automatically rolled up to the header.
Alternatively, a user can manually change the header status to closed even when the lines are open.
When a PO is closed, you cannot do any receiving or invoicing against it.
However, the CLOSED status is reversible. The buyer can move a PO back into OPEN status.
The user can also manually change the status of the PO header to FINALLY CLOSED. The only difference between CLOSED and FINALLY CLOSED is that you cannot reopen a FINALLY CLOSED PO.
Hope this answers your question,
Sandeep Gandhi

Similar Messages

  • How does CLOSED_CODE updated in PO_LINES_ARCHIVE_ALL table

    Hi,
      How does CLOSED_CODE column will be updated in PO_LINES_ARCHIVE_ALL table. We have setup "Archive On Approve" for archiving.
      Does below is a valid check to verify the line count between lines table and archive table?
      We are comparing the line count in Lines table and Archive table, and if there is difference in count, then it is assumed to be change in the Lines,
      so then direct the PO Approval Worfkflow for re-approval.
      Kindly suggest if below check is correct or not, especially check on CLOSED_CODE='OPEN'.
      In few cases, the lines in PO_LINES_ALL table has CLOSED_CODE = 'CLOSED' but, PO_LINES_ARCHIVE_ALL table has lines with CLOSED_CODE = 'OPEN' even after PO approval.
      Is this expected behavior? When Does CLOSED_CODE will get updated in archive table?
    SELECT COUNT(*)
             INTO x_lines_count
             FROM po_lines_all
            WHERE closed_code = 'OPEN'
              AND po_header_id = x_po_header_id;
           SELECT COUNT(*)
             INTO x_ar_line_count
             from po_lines_archive_all
          where closed_code = 'OPEN'
            and latest_external_flag = 'Y'
            and po_header_id = x_po_header_id;
    IF x_lines_count <> x_ar_line_count THEN
         RESULT: "Change in PO Lines";
    Regards,
    Ram

    Sathyaseelan wrote:
    Hi All,
    After creating requisition from R12 iProcurement , the column document_type_code in the table PO_REQUISITION_LINES_ALL got updated as BLANKET or CONTRACT.
    Need to know how these values was defaulting in the requisition.
    I am able to see the values soon after added the item to shopping cart.
    Regards,
    SathyaI think whatever the item is in the requistion..It should be associated with the blanket or contract agreement..that the reason why you are seeing that document type code
    HTH
    Mahendra

  • Example query for po headers total amount(including tax amount) from po_headers_all table in  r12

    HI
    there is no such column like po_amount in po_headers_all table then how can i get po total amount(including tax amount) from po_headers_all table  or else tell me how to get data from views  in R12
    As we are using sql developer tool to build queries in our project
    With regards
    siva

    PO line total is not included the tax, to View the tax amount (N) Action-> manage tax
    1) You have to sum up the lines to get the PO total,
      select ph.segment1 po_num, sum ( (pl.unit_price * pl.quantity)) price
        from po_lines_all pl, po_headers_all ph
       where     pl.po_header_id = ph.po_header_id
             and ph.type_lookup_code in ('STANDARD', 'BLANKET')   --Add as per your requirement
    --          and ph.segment1 = '2017'
    --          and ph.org_id = 7852        --Use when you have multiple OU
    group by ph.segment1
    2) To get the tax
    SELECT *
        FROM (  SELECT lines.line_num line_number,
                       lines.item_description line_description,
                       dist.distribution_num dist_number,
                       dist.code_combination_id dist_code_combination_id,
                       NVL (dist.nonrecoverable_tax, 0) nonrecoverable_tax,
                       NVL (dist.recoverable_tax, 0) recoverable_tax,
                         NVL (dist.nonrecoverable_tax, 0)
                       + NVL (dist.recoverable_tax, 0)
                          total_tax,
                       (NVL (dist.req_line_quantity, 0) * NVL (lines.unit_price, 0))
                          amount,
                       dist.org_id,
                       dist.DISTRIBUTION_ID
                  FROM po_requisition_lines_all lines, po_req_distributions_all dist
                 WHERE     lines.requisition_line_id = dist.requisition_line_id
                       AND NVL (lines.cancel_flag, 'N') <> 'Y'
                       AND NVL (lines.modified_by_agent_flag, 'N') = 'N'
    --                   AND lines.requisition_header_id = :1
              ORDER BY lines.line_num, dist.distribution_num) QRSLT
    ORDER BY LINE_NUMBER, DIST_NUMBER
    Join the po_distributions_all, po_lines_all & po_headers_all tables to get the specific value.
    Thanks

  • Link between PO_Action_History and PO_headers_all

    Hi Gurus,
    What could be the join condition if i join po_headers_all and po_action_history tables?
    Best regards,
    nestor

    Hi nestor;
    I suggest check etrm site etrm.oracle.com to can see table integration,relation etc. Than you can see how you can join those tables
    Regard
    Helios

  • Trigger on PO_HEADERS_ALL or Form Personalization

    Hi Gurus,
    We have a requirement like this, when a po is approved we have to save the po details (po number, po description, supplier name and supplier phone number) in a custom table and later a 3rd party system will use the details to sms the supplier about the po status.
    Kindly let me if it be done with Form Personalization. If so, how ? or i have to create a trigger on po_headers_all to achieve this.
    Thank you.
    Edited by: 863803 on Jun 6, 2011 1:35 AM

    Hi Sandeep,
    Not sure, if the flat file generated by this Conc Request : OUT: Purchase Order (850/ORDERS) will be useful for your requirement. For 850 Order details you can refer below URL.
    http://www.covalentworks.com/edi-850-purchase-order.asp
    You can write a simple PL/SQL program referring PO_Headers_all tables and update the 4 columns of your staging table for your supplier use. Hope this approach will be easier. :)
    Kind Regards,
    S.P DASH

  • Significance of XML_Flag in PO_HEADERS_ALL

    Hello Friends,
    I am facing an issue , where user reported that some PO's are not going to supplier. When i checked for those PO's , they belong to one supplier and for all of them XML_Flag is 'N'.
    I want to understand the siginificance of XML_Flag. How does it get populated and what does the value signify.
    We are using Oracle I procurement, Purchasing 11.5.10.2 .
    Thank you very much for help !
    Regards,
    Amit

    Hi;
    I suggest please check e-trm site for your issue can understand table structure and relation etc..
    Also see:
    Oracle Purchasing Table Structure
    http://www.scribd.com/doc/46903382/Oracle-Purchasing-Table-Structure
    Communication Methods In Oracle Purchasing [ID 556099.1]
    Regard
    Helios

  • How to create custom tye_lookup_code in po_headers_all table in Oracle Purchasing

    I want to know how to create a custom document type/po type like STANDARD, BLANKET, etc in Oracle purchasing.  I went and edit the look up codes for look up type 'PO TYPE' by navigating to set up --> purchasing --> Lookup Codes.  But from UI, I'm not able to edit the page. So I wanted to know, does Oracle allows the user to create a custom PO type? If so, how do i create such one?
    any pointers would be of great help!
    thanks
    sen.
    Message was edited by: Sen2008

    I want to know how to create a custom document type/po type like STANDARD, BLANKET, etc in Oracle purchasing.  I went and edit the look up codes for look up type 'PO TYPE' by navigating to set up --> purchasing --> Lookup Codes.  But from UI, I'm not able to edit the page. So I wanted to know, does Oracle allows the user to create a custom PO type? If so, how do i create such one?
    any pointers would be of great help!
    thanks
    sen.
    Message was edited by: Sen2008

  • SAMPLE RECEIVING OPEN INTERFACE SCRIPT(ROI 이용자를 위한 SCRIPT)

    제품: MFG_PO
    작성날짜 : 2006-05-11
    SAMPLE RECEIVING OPEN INTERFACE SCRIPT(ROI 이용자를 위한 SCRIPT)
    ================================================================
    PURPOSE
    Receiving Open Interface(ROI)를 좀더 쉽게 사용할 수 있도록 만들어진
    tool이라고 할 수 있다. 이 script를 이용을 통해 user는 PO no, user id,
    Org id를 입력하면 script는 PO에서 최소한의 data를 가져와 receiving
    transaction을 생성하기 위해 ROI에 data를 입력한다.
    Receiving Transaction Processor는 insert 된 data를 실행한다.
    Explanation
    Instructions:
    1.Script exroi.sql을 local computer에 copy 하거나 sqlplus 환경의 text
    edior에 script 내용을 cut&paste 한다.
    2.사용가능한 PO no, User id, Org id를 결정한다.
    3.sqlplus prompt에서 아래와 같이 입력한다.
    SQL> @ezroi.sql
    4.PO no, User id, Org id를 입력하라는 prompt를 볼 수 있을 것이다.
    5.exroi.sql script를 관련된 PO data를 가져와 rcv_headers_interface 및
    rcv_transactions_interface tables에 insert 한다.
    만일 PO shipment lind이 closed, cancelled, fully received 되었다면
    ROI table에 data를 insert 하지 않는다.
    Note: 이 script가 data를 validate 하진 않으며,ROI API 자체 validation
    이 실행될 뿐이다.
    6.Script가 끝나면 Receiving Transaction Processor를 실행하여 insert 된
    lines을 처리할 수 있다. Transaction Status Summary 화면을 통해 실행된
    line이 pending 인지 error 상태인지 확인할 수 있다.
    Notes:
    1.Org_id parameter 값을 찾는법:
    a) Application에 접속, Help> Diagnostics> Examine으로 이동.
    Block:$Profile$, Field: ORG_ID 를 선택한다.
    b) ORG_ID 값을 note 해 놓고 ORG_ID prompt시 이 값을 입력한다.
    2.User_Name parameter 값을 찾는법:
    a) Application에 접속, Help> Diagnostics> Examine으로 이동.
    Block:$Profile$, Field: USER_NAME 를 선택한다.
    b) USER_NAME 값을 note 해 놓고 USER_NAME prompt시 이 값을 입력한다.
    Example
    "eZROI.sql' script...
    --*** eZROI ***
    --*** by ***
    --*** Preston D. Davenport ***
    --*** Oracle Premium Applications Support ***
    --*** Oracle Worldwide Global Support Services ***
    --*** Date: 23-JUL-2003 - Beta release ***
    --*** Date: 09-SEP-2003 - Rev A Added multi- ***
    --*** shipment line capability ***
    --*** Parameters: ***
    --*** ORG_ID Organization ID ***
    --*** USER_NAME FND User Name ***
    --*** PO_NUMBER Purchase Order Number ***
    --*** This script intended for a standard Purchase ***
    --*** Order document to be inserted into the Oracle ***
    --*** Receiving Open Interface (ROI) via the standard ***
    --*** Oracle open interface api for a simple Receive ***
    --*** transaction. ***
    --*** Note: This script only considers open Purchase ***
    --*** Orders. This script will not allow over- ***
    --*** receipt, cancelled or closed PO's to be ***
    --*** inserted into the ROI and received ***
    CLEAR BUFFER
    SET VERIFY OFF
    SET LINESIZE 140
    SET PAGESIZE 60
    SET ARRAYSIZE 1
    SET SERVEROUTPUT ON SIZE 100000
    SET FEEDBACK OFF
    SET ECHO OFF
    DECLARE
    X_USER_ID NUMBER;
    X_PO_HEADER_ID NUMBER;
    X_VENDOR_ID NUMBER;
    X_SEGMENT1 NUMBER;
    X_ORG_ID NUMBER;
    X_LINE_NUM NUMBER;
    BEGIN
    DBMS_OUTPUT.PUT_LINE('***ezROI RCV API Insert Script***');
    SELECT PO_HEADER_ID , VENDOR_ID , SEGMENT1 , ORG_ID
    INTO X_PO_HEADER_ID , X_VENDOR_ID , X_SEGMENT1 , X_ORG_ID
    FROM PO_HEADERS_ALL
    WHERE SEGMENT1 = '&PO_NUMBER'
    AND ORG_ID = &ORG_ID;
    SELECT USER_ID INTO X_USER_ID
    FROM FND_USER
    WHERE USER_NAME = UPPER('&USER_NAME');
    INSERT INTO RCV_HEADERS_INTERFACE
    HEADER_INTERFACE_ID ,
    GROUP_ID ,
    PROCESSING_STATUS_CODE ,
    RECEIPT_SOURCE_CODE ,
    TRANSACTION_TYPE ,
    LAST_UPDATE_DATE ,
    LAST_UPDATED_BY ,
    LAST_UPDATE_LOGIN ,
    VENDOR_ID ,
    EXPECTED_RECEIPT_DATE ,
    VALIDATION_FLAG
    SELECT
    RCV_HEADERS_INTERFACE_S.NEXTVAL ,
    RCV_INTERFACE_GROUPS_S.NEXTVAL ,
    'PENDING' ,
    'VENDOR' ,
    'NEW' ,
    SYSDATE ,
    X_USER_ID ,
    0 ,
    X_VENDOR_ID ,
    SYSDATE ,
    'Y'
    FROM DUAL;
    DECLARE
    CURSOR PO_LINE IS
    SELECT PL.ITEM_ID , PL.PO_LINE_ID , PL.LINE_NUM ,
    PLL.QUANTITY , PL.UNIT_MEAS_LOOKUP_CODE ,
    MP.ORGANIZATION_CODE , PLL.LINE_LOCATION_ID ,
    PLL.CLOSED_CODE , PLL.QUANTITY_RECEIVED ,
    PLL.CANCEL_FLAG, PLL.SHIPMENT_NUM
    FROM PO_LINES_ALL PL ,
    PO_LINE_LOCATIONS_ALL PLL ,
    MTL_PARAMETERS MP
    WHERE PL.PO_HEADER_ID = X_PO_HEADER_ID
    AND PL.PO_LINE_ID = PLL.PO_LINE_ID
    AND PLL.SHIP_TO_ORGANIZATION_ID = MP.ORGANIZATION_ID;
    BEGIN
    FOR CURSOR1 IN PO_LINE LOOP
    IF CURSOR1.CLOSED_CODE IN ('APPROVED','OPEN')
    AND CURSOR1.QUANTITY_RECEIVED < CURSOR1.QUANTITY
    AND NVL(CURSOR1.CANCEL_FLAG,'N') = 'N'
    THEN
    INSERT INTO RCV_TRANSACTIONS_INTERFACE
    INTERFACE_TRANSACTION_ID ,
    GROUP_ID ,
    LAST_UPDATE_DATE ,
    LAST_UPDATED_BY ,
    CREATION_DATE ,
    CREATED_BY ,
    LAST_UPDATE_LOGIN ,
    TRANSACTION_TYPE ,
    TRANSACTION_DATE ,
    PROCESSING_STATUS_CODE ,
    PROCESSING_MODE_CODE ,
    TRANSACTION_STATUS_CODE ,
    PO_LINE_ID ,
    ITEM_ID ,
    QUANTITY ,
    UNIT_OF_MEASURE ,
    PO_LINE_LOCATION_ID ,
    AUTO_TRANSACT_CODE ,
    RECEIPT_SOURCE_CODE ,
    TO_ORGANIZATION_CODE ,
    SOURCE_DOCUMENT_CODE ,
    DOCUMENT_NUM ,
    HEADER_INTERFACE_ID ,
    VALIDATION_FLAG
    SELECT
    RCV_TRANSACTIONS_INTERFACE_S.NEXTVAL ,
    RCV_INTERFACE_GROUPS_S.CURRVAL ,
    SYSDATE ,
    X_USER_ID ,
    SYSDATE ,
    X_USER_ID ,
    0 ,
    'RECEIVE' ,
    SYSDATE ,
    'PENDING' ,
    'BATCH' ,
    'PENDING' ,
    CURSOR1.PO_LINE_ID ,
    CURSOR1.ITEM_ID ,
    CURSOR1.QUANTITY ,
    CURSOR1.UNIT_MEAS_LOOKUP_CODE ,
    CURSOR1.LINE_LOCATION_ID ,
    'RECEIVE' ,
    'VENDOR' ,
    CURSOR1.ORGANIZATION_CODE ,
    'PO' ,
    X_SEGMENT1 ,
    RCV_HEADERS_INTERFACE_S.CURRVAL ,
    'Y'
    FROM DUAL;
    DBMS_OUTPUT.PUT_LINE('PO line: '||CURSOR1.LINE_NUM||' Shipment: '||CURSOR1.SHIPMENT_NUM||' has been inserted into ROI.');
    ELSE
    DBMS_OUTPUT.PUT_LINE('PO line '||CURSOR1.LINE_NUM||' is either closed, cancelled, received.');
    END IF;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('*** ezROI COMPLETE - End ***');
    END;
    COMMIT;
    END;
    SET VERIFY ON
    Reference Documents
    Note 245334.1

    I have the same problem on ESXI 5.5 for over a month now, tried the patches, tried the LTS kernel which others say results in an immediate result without patches, nothing seems to work and nobody seems to be able to offer a solution.
    Did you make any progress ??
    Error! Build of vmblock.ko failed for: 3.10.25-1-lts (x86_64)
    Consult the make.log in the build directory
    /var/lib/dkms/open-vm-tools/2013.09.16/build/ for more information.
    make[2]: *** No rule to make target '/var/lib/dkms/open-vm-tools/2013.09.16/build/vmblock/linux/inode', needed by '/var/lib/dkms/open-vm-tools/2013.09.16/build/vmblock/vmblock.o'. Stop.
    Makefile:1224: recipe for target '_module_/var/lib/dkms/open-vm-tools/2013.09.16/build/vmblock' failed
    make[1]: *** [_module_/var/lib/dkms/open-vm-tools/2013.09.16/build/vmblock] Error 2
    make[1]: Leaving directory '/usr/src/linux-3.10.25-1-lts'
    Makefile:120: recipe for target 'vmblock.ko' failed
    Last edited by crankshaft (2014-01-10 11:32:32)

  • Query to fetch vendor number with whom this item was last purchased

    Hi All,
    We have a requirement to fetch the vendor number for an item with whom the item was last purchased. We need to derive this by looking at the open Purchase Order or the Material Transactions for the transaction type of ‘PO Receipt’ whichever is the latest.
    For this we are using the below query, but this query is taking a lot of time and doing an INDEX RANGE SCAN on PO_LINES_N1 & MTL_MATERIAL_TRANSACTIONS_N1
    SELECT MAX (v.segment1)KEEP (DENSE_RANK LAST ORDER BY DECODE
    (UPPER (poh.closed_code),
    'OPEN', poh.creation_date,
    mmt.transaction_date
    poh.creation_date) seg1
    FROM po_headers_all poh,
    po_vendors v,
    mtl_material_transactions mmt
    WHERE poh.po_header_id IN (SELECT pol.po_header_id
    FROM po_lines_all pol
    WHERE pol.item_id = p_inv_id)
    AND v.vendor_id = poh.vendor_id
    AND mmt.inventory_item_id(+) = p_inv_id
    AND mmt.transaction_type_id(+) = 18
    AND mmt.transaction_source_id(+) = poh.po_header_id;
    Can anyone please help me in rewriting this query or if we can use different tables to acheive the same functionality.
    Regards,
    Shruti

    Hi,
    Can anyone please help me with the below query.
    Regards,
    Shruti

  • SQL Query to retriew open GRNs for Purchasning in R12

    Hi All,
    Can anybody help me by providing an SQL Query to retrieve all open GRNs in purchasing. As a part of re-implementation we are loading open balance from the existing system. In order to validate the open GRNs standard report is not apt results.
    Thanks & Regards,
    Sadanand

    Hi Sadanand,
    select
    pv.vendor_id,
    pv.segment1 vendor_num,
    pv.vendor_name,
    pvs.vendor_site_id,
    pvs.address_line1||', '||
    pvs.address_line2||', '||
    pvs.address_line3||', '||
    pvs.address_line4||', '||
    pvs.area_code||', '||
    pvs.city||', '||
    pvs.country ||' - '||
    pvs.zip vendor_address,
    (select organization_code from org_organization_definitions
    where pll.ship_to_organization_id = organization_id) org,
    msi.segment1||'.'||
    msi.segment2||'.'||
    msi.segment3||'.'||
    msi.segment4 item_code ,
    msi.description item_desc,
    msi.primary_unit_of_measure uom,
    pll.quantity qty_ordered,
    (nvl(pll.quantity,0) - nvl(pll.quantity_received,0) - nvl(pll.quantity_cancelled,0)) qty_due,
    -- pod.quantity_delivered,
    poh.segment1 po_num,
    pol.line_num,
    pll.shipment_num,
    pll.need_by_date,
    pol.unit_price,
    jip.tax_line_no,
    jit.tax_name,
    jip.tax_rate,
    jip.tax_amount,
    hrl.location_code shipping_loc
    from
    po_headers_all poh,
    po_lines_all pol,
    po_line_locations_all pll,
    po_distributions_all pod,
    mtl_system_items msi,
    po_vendors pv,
    po_vendor_sites_all pvs,
    ja_in_po_line_location_taxes jip,
    ja_in_tax_codes jit,
    hr_locations_all_tl hrl
    where
    poh.org_id = :p_org_id
    and poh.authorization_status = 'APPROVED'
    and poh.closed_code = 'OPEN'
    and pol.po_header_id = poh.po_header_id
    and ( pol.closed_code = 'OPEN' or pol.closed_code = 'OPEN FOR RECEIVING' or pol.closed_code is null )
    and pll.po_line_id = pol.po_line_id
    and (nvl(pll.quantity,0) - nvl(pll.quantity_received,0) - nvl(pll.quantity_cancelled,0)) > 0
    and ( pll.cancel_flag = 'N' or pll.cancel_flag is null )
    and pod.line_location_id = pll.line_location_id
    and msi.inventory_item_id = pol.item_id
    and msi.organization_id = pll.ship_to_organization_id
    and pv.vendor_id = poh.vendor_id
    and pvs.vendor_site_id = poh.vendor_site_id
    and jip.line_location_id = pll.line_location_id
    and jip.po_line_id = pll.po_line_id
    and jip.po_header_id = pll.po_header_id
    and jit.tax_id = jip.tax_id
    and hrl.location_id (+) = pll.ship_to_location_id
    order by poh.segment1 ,
    pol.line_num ,
    pll.shipment_num ,
    jip.tax_line_no
    Regards
    sanjay

  • BLANKET RELEASE가 INPROCESS 상태에서 더 이상 진행되지 않을 경우 해결 방법

    제품: MFG_PO
    작성날짜 : 2006-05-11
    BLANKET RELEASE가 INPROCESS 상태에서 더 이상 진행되지 않을 경우 해결법
    ======================================================================
    PURPOSE
    승인을 위해 Blanket Release가 submit 되었으나,어떤 이유로 인해
    'INPROCESS' 상태로 되는 경우가 있다.
    'INPROCESS' 상태가 된 그 원인 진단을 위란 workflow가 없는경우(workflow
    purge process에 의해 purge 되는 경우 등...) 아래의 방법으로 해결한다.
    Explanation
    Original workflow activities가 더 이상 존재하지 않아서,
    workflow activity를 종결하거나 document 진행을 시도하면 workflow는 fail
    되며 document는 'INPROCESS' 상태로 fail 된다.
    이를 해결하기 위한 solution을 아래의 steps에 따라 작업한다.
    1.아래 sql을 실행하여 Requires Reapproval로 release를 update 한다.
    Update가 성공적으로 끝나면 commit을 한다.
    Script 실행시 Org_id가 prompt 되므로 document가 존재하는 org id를 입력
    한다.
    -- START OF RESET SCRIPT
    set serveroutput on size 100000
    DECLARE
    CURSOR reltoreset is
    SELECT por.wf_item_type, por.wf_item_key, por.po_release_id, por.release_num,
    por.release_type, por.revision_num, poh.segment1
    FROM po_headers_all poh, po_releases_all por
    WHERE poh.segment1 = ' &PO_NUMBER
    and por.release_num = to_number('&REL_NUM')
    and por.org_id = to_number('&org_id')
    and por.org_id = poh.org_id
    and por.po_header_id = poh.po_header_id
    and por.authorization_status IN ('IN PROCESS', 'PRE-APPROVED')
    and NVL(por.cancel_flag, 'N') = 'N'
    and NVL(por.closed_code, 'OPEN') != 'FINALLY_CLOSED';
    CURSOR errwf(pitem varchar2, pkey varchar2) is
    SELECT ITEM_TYPE, ITEM_KEY
    FROM wf_items
    WHERE PARENT_ITEM_TYPE = pitem
    AND PARENT_ITEM_KEY = pkey
    AND END_DATE is NOT NULL;
    CURSOR maxseq(id number, subtype po_action_history.object_sub_type_code%type) is
    SELECT nvl(max(sequence_num), 0)
    FROM po_action_history
    WHERE object_type_code = 'RELEASE'
    AND object_sub_type_code = subtype
    AND object_id = id
    AND action_code is NULL;
    CURSOR poaction(id number, subtype po_action_history.object_sub_type_code%type) is
    SELECT nvl(max(sequence_num), 0)
    FROM po_action_history
    WHERE object_type_code = 'RELEASE'
    AND object_sub_type_code = subtype
    AND object_id = id
    AND action_code = 'SUBMIT';
    submitseq po_action_history.sequence_num%type;
    nullseq po_action_history.sequence_num%type;
    BEGIN
    dbms_output.put_line('------------------------------------');
    dbms_output.put_line('Data Manipulation Scripts Disclaimer');
    dbms_output.put_line('------------------------------------');
    dbms_output.put_line('As always please ask customer to run the scripts on their test instance
    first ');
    dbms_output.put_line('before applying it on production. Make sure the data is validated for ');
    dbms_output.put_line('correctness and related functionality is verified after the script has been
    dbms_output.put_line('run on a test instance. Customer is responsible to authenticate and verify ');
    dbms_output.put_line('correctness of data manipulation scripts.');
    FOR pos in reltoreset LOOP
    dbms_output.put_line('Processing '||pos.release_type
    ||' Release Number: '
    ||pos.segment1||'-'||to_char(pos.release_num));
    dbms_output.put_line('......................................');
    dbms_output.put_line('Closing Notifications...');
    BEGIN
    UPDATE wf_notifications set status = 'CANCELED'
    WHERE notification_id in (
    select ias.notification_id
    from wf_item_activity_statuses ias,
    wf_notifications ntf
    where ias.item_type = pos.wf_item_type
    and ias.item_key = pos.wf_item_key
    and ntf.notification_id = ias.notification_id)
    AND NVL(status, 'OPEN') = 'OPEN';
    EXCEPTION
    WHEN OTHERS THEN
    null;
    END;
    dbms_output.put_line('Aborting Workflow...');
    BEGIN
    WF_Engine.AbortProcess(pos.wf_item_type, pos.wf_item_key);
    EXCEPTION
    WHEN OTHERS THEN
    null;
    END;
    FOR wf in errwf(pos.wf_item_type, pos.wf_item_key) LOOP
    BEGIN
    dbms_output.put_line('Closing Error Notifications ...');
    UPDATE wf_notifications set status = 'CANCELED'
    WHERE notification_id in (
    select ias.notification_id
    from wf_item_activity_statuses ias,
    wf_notifications ntf
    where ias.item_type = wf.ITEM_TYPE
    and ias.item_key = wf.ITEM_KEY
    and ntf.notification_id = ias.notification_id)
    AND NVL(status, 'OPEN') = 'OPEN';
    dbms_output.put_line('Aborting Error Workflow...');
    UPDATE WF_ITEMS SET
    END_DATE = sysdate
    WHERE ITEM_TYPE = wf.item_type
    AND ITEM_KEY = wf.item_key;
    EXCEPTION
    WHEN OTHERS THEN
    null;
    END;
    END LOOP;
    dbms_output.put_line('Updating Release Status...');
    UPDATE po_releases_all
    set authorization_status = decode(pos.revision_num, 0, 'INCOMPLETE',
    'REQUIRES REAPPROVAL'),
    approved_flag = decode(pos.revision_num, 0, 'N', 'R'),
    wf_item_type = NULL,
    wf_item_key = NULL
    where po_release_id = pos.po_release_id;
    OPEN maxseq(pos.po_release_id, pos.release_type);
    FETCH maxseq into nullseq;
    CLOSE maxseq;
    OPEN poaction(pos.po_release_id, pos.release_type);
    FETCH poaction into submitseq;
    CLOSE poaction;
    IF nullseq > submitseq THEN
    dbms_output.put_line('Deleting PO Action History...');
    DELETE FROM po_action_history
    WHERE object_id = pos.po_release_id
    AND object_type_code = 'RELEASE'
    AND object_sub_type_code = pos.release_type
    AND sequence_num >= submitseq;
    END IF;
    dbms_output.put_line('Done Processing.');
    dbms_output.put_line('................');
    dbms_output.put_line('Please issue commit, if no errors found.');
    END LOOP;
    END;
    -- END OF RESET SCRIPT
    2.Script가 error 없이 끝나면 'Commit;'을 실행한다.
    3.Enter Release form에서 문제의 document를 조회하고, 승인을 위해 submit
    한다.
    Reference Documents
    Note 296458.1

  • SYSTEM FAILURE로 PO STAUTS가 INPROCESS 상태시 해결방법

    제품 : MFG_PO
    작성날짜 : 2006-05-17
    SYSTEM FAILURE로 PO STAUTS가 'INPROCESS' 상태시 해결방법
    ========================================================
    PURPOSE
    Document approval manager가 fails 되어 down 되면 PO는 IN PROCESS 상태가
    된다.이 PO에 대한 available한 workflow가 없고,reprocess 하기 위해
    wfretry를 시도해도 실패한다면 아래 script를 이용한다.
    (Oracle Purchasing - Version: 11.5.9)
    Explanation
    Document approval시 발생하는 Document Approval Manager crashing은 PO의상태를 IN PROCESS로 만드는 원인이 된다.
    Workflow는 완전히 처리되지 못하고 workflow activities processes와
    system 안에서 "lost" 상태가 된다.
    이 때 wf_item_key는 어떤 active한 workflow와도 상응하지 못하기 때문에
    불필요한 상태가 되어 버린다.
    System crash로 인해 session variable data를 잃어버렸기 때문에 wfretry
    를 실행해도 workflow는 restart 되지 못한다.
    Solution :
    아래 steps에 따라 작업한다.
    NOTE: 이 script는 oracle의 승인 및 review 없이 사용할 수 없으며, 예산
    계정을 사용하는 경우 사용할 수 없다.
    1. Please run the following sql update:
    -- START OF RESET SCRIPT
    set serveroutput on size 100000
    DECLARE
    CURSOR potoreset is
    SELECT wf_item_type, wf_item_key, po_header_id, segment1,
    revision_num, type_lookup_code
    FROM po_headers_all
    WHERE segment1 = '&PO_NUMBER '
    and authorization_status IN ('IN PROCESS', 'PRE-APPROVED')
    and NVL(cancel_flag, 'N') = 'N'
    and NVL(closed_code, 'OPEN') != 'FINALLY_CLOSED';
    CURSOR maxseq(id number, subtype po_action_history.object_sub_type_code%type) is
    SELECT nvl(max(sequence_num), 0)
    FROM po_action_history
    WHERE object_type_code IN ('PO', 'PA')
    AND object_sub_type_code = subtype
    AND object_id = id
    AND action_code is NULL;
    CURSOR poaction(id number, subtype po_action_history.object_sub_type_code%type) is
    SELECT nvl(max(sequence_num), 0)
    FROM po_action_history
    WHERE object_type_code IN ('PO', 'PA')
    AND object_sub_type_code = subtype
    AND object_id = id
    AND action_code = 'SUBMIT';
    submitseq po_action_history.sequence_num%type;
    nullseq po_action_history.sequence_num%type;
    BEGIN
    dbms_output.put_line('------------------------------------');
    dbms_output.put_line('Data Manipulation Scripts Disclaimer');
    dbms_output.put_line('------------------------------------');
    dbms_output.put_line('As always please ask customer to run the scripts on their test instance first ');
    dbms_output.put_line('before applying it on production. Make sure the data is validated for ');
    dbms_output.put_line('correctness and related functionality is verified after the script has been');
    dbms_output.put_line('run on a test instance. Customer is responsible to authenticate and verify ');
    dbms_output.put_line('correctness of data manipulation scripts.');
    FOR pos in potoreset LOOP
    dbms_output.put_line('Processing '||pos.type_lookup_code||' PO Number: '||pos.segment1);
    dbms_output.put_line('......................................');
    dbms_output.put_line('Closing Notifications...');
    BEGIN
    UPDATE wf_notifications set status = 'CANCELED'
    WHERE notification_id in (
    select ias.notification_id
    from wf_item_activity_statuses ias,
    wf_notifications ntf
    where ias.item_type = pos.wf_item_type
    and ias.item_key = pos.wf_item_key
    and ntf.notification_id = ias.notification_id)
    AND NVL(status, 'OPEN') = 'OPEN';
    EXCEPTION
    WHEN OTHERS THEN
    null;
    END;
    dbms_output.put_line('Aborting Workflow...');
    BEGIN
    WF_Engine.AbortProcess(pos.wf_item_type, pos.wf_item_key);
    EXCEPTION
    WHEN OTHERS THEN
    null;
    END;
    dbms_output.put_line('Updating PO Status...');
    UPDATE po_headers_all
    set authorization_status = decode(pos.revision_num, 0, 'INCOMPLETE','REQUIRES REAPPROVAL'),
    wf_item_type = NULL,
    wf_item_key = NULL,
    approved_flag = decode(pos.revision_num, 0, 'N', 'R')
    where po_header_id = pos.po_header_id;
    OPEN maxseq(pos.po_header_id, pos.type_lookup_code);
    FETCH maxseq into nullseq;
    CLOSE maxseq;
    OPEN poaction(pos.po_header_id, pos.type_lookup_code);
    FETCH poaction into submitseq;
    CLOSE poaction;
    IF nullseq > submitseq THEN
    dbms_output.put_line('Deleting PO Action History...');
    DELETE FROM po_action_history
    WHERE object_id = pos.po_header_id
    AND object_type_code IN ('PO', 'PA')
    AND object_sub_type_code = pos.type_lookup_code
    AND sequence_num >= submitseq;
    END IF;
    dbms_output.put_line('Done Processing.');
    dbms_output.put_line('................');
    dbms_output.put_line('Please issue commit, if no errors found.');
    END LOOP;
    END;
    -- END OF RESET SCRIPT
    2. If the above sql update completes without error the please issue a
    commit:
    commit;
    If the above sql update errors then issue a rollback:
    rollback;
    3. When the above sql updates are complete, then query up the purchase
    order in theEnter Purchase Order form and resubmit the document for
    approval.
    Reference Documents
    Note 297980.1

  • RECEIVING OPEN INTERFACE TABLE의 STRUCK RECORDS 정보 취합 SCRIPT

    제품 : MFG_PO     
    작성날짜 : 2005-01-27     
    RECEIVING OPEN INTERFACE TABLE의 STRUCK RECORDS 정보 취합 SCRIPT
    =================================================================
    PURPOSE
    RCV_TRANSACTIONS_INTERFACE table에 있는 struck receipt records의 정보를
    취합하여, struck 원인 및 해결에 도움을 줄 수 있다.
    (Oracle Purchasing - Version: 11.5.2 to 11.5.9)
    Explanation
    Receiving Open Interface Tables에 걸려 있는 receipt struck의 source
    document의 추가 정보를 어떻게 취합할 수 있을것인가?
    (RCV_TRANSACTIONS_INTERFACE)
    Source document는 아래 중 하나가 될 수 있다.
    * Purchase Order
    * Return Material Authorization (RMA)
    * Internal Requisition
    아래에 소개하는 scripts는 interface tables에 많은 수의 records가 있을때,
    많은 수의 records의 정보를 한 번에 취합하길 원할때 사용하면 유용하다.
    만약 interface tables에 단지 몇 개의 records만 있다면 Note: 171257.1
    - Oracle Procurement (Purchasing)/iProcurement Diagnostic Tests 에 소개
    되어져 있는 적당한 diagnostic script를 이용하는편이 낫다.
    Example
    1.Error가 발생한 Purchase Order receipts의 추가 정보를 취합하는 script:
    SELECT SUBSTR(POH.SEGMENT1,1,10) "PO Number",
    POR.RELEASE_NUM "Release Num",
    POL.LINE_NUM "Line Num",
    RTI.INTERFACE_TRANSACTION_ID "Intf Trx Id",
    RTI.TRANSACTION_DATE "Trx Date",
    RTI.PROCESSING_MODE_CODE "Proc Mode",
    RTI.TRANSACTION_STATUS_CODE "Trx Status",
    RTI.PROCESSING_STATUS_CODE "Proc Status",
    SUBSTR(PIE.ERROR_MESSAGE,1,75) "Error Message",
    POH.ORG_ID "Op Unit Id",
    RTI.PO_HEADER_ID "PO Hdr Id",
    RTI.PO_RELEASE_ID "Rel Id",
    RTI.PO_LINE_ID "PO Line Id",
    RTI.PO_LINE_LOCATION_ID "Line Loc Id",
    RTI.QUANTITY "Intf Qty",
    POLL.QUANTITY "Order Qty",
    POLL.QUANTITY_RECEIVED "Qty recvd",
    POD.QUANTITY_DELIVERED "Qty Delv",
    NVL(POLL.CLOSED_CODE,'OPEN') "Closed Code",
    OOD.ORGANIZATION_CODE "To Inv Org",
    RTI.DESTINATION_TYPE_CODE "Dest Type",
    RTI.TRANSACTION_TYPE "Intf Trx Type",
    NVL(POLL.QTY_RCV_EXCEPTION_CODE,'NONE') "Qty Exception",
    POLL.QTY_RCV_TOLERANCE "Qty Tolerance",
    POLL.RECEIVE_CLOSE_TOLERANCE "Receipt Tolerance"
    FROM RCV_TRANSACTIONS_INTERFACE RTI,
    PO_HEADERS_ALL POH,
    PO_RELEASES_ALL POR,
    PO_LINES_ALL POL,
    PO_LINE_LOCATIONS_ALL POLL,
    ORG_ORGANIZATION_DEFINITIONS OOD,
    PO_DISTRIBUTIONS_ALL POD,
    PO_INTERFACE_ERRORS PIE
    WHERE POH.PO_HEADER_ID = RTI.PO_HEADER_ID
    AND POR.PO_RELEASE_ID(+) = RTI.PO_RELEASE_ID
    AND POL.PO_LINE_ID = RTI.PO_LINE_ID
    AND OOD.ORGANIZATION_ID(+) = RTI.TO_ORGANIZATION_ID
    AND POLL.LINE_LOCATION_ID = RTI.PO_LINE_LOCATION_ID
    AND POD.LINE_LOCATION_ID = POLL.LINE_LOCATION_ID
    AND RTI.INTERFACE_TRANSACTION_ID = PIE.INTERFACE_TRANSACTION_ID(+);
    2.Error가 발생한 RMA receipts의 추가 정보를 취합하는 script:
    SELECT RTI.INTERFACE_TRANSACTION_ID "Interface Transaction ID",
    RTI.PROCESSING_STATUS_CODE "Processing Status",
    RTI.PROCESSING_MODE_CODE "Processing Mode",
    RTI.TRANSACTION_STATUS_CODE "Transaction Status",
    RTI.TRANSACTION_TYPE "Transaction Type",
    RTI.TRANSACTION_DATE "Transaction Date",
    RTI.OE_ORDER_HEADER_ID "Order header Id",
    OOH.ORDER_NUMBER "Order Number",
    OOH.ORG_ID "Oper Unit Id",
    RTI.OE_ORDER_LINE_ID "Order Line Id",
    OOL.INVENTORY_ITEM_ID "Order Item",
    OOL.FLOW_STATUS_CODE "Line Flow Status Code",
    RTI.QUANTITY "Intf Qty",
    RTI.UNIT_OF_MEASURE "Intf UOM",
    OOL.ORDERED_QUANTITY "Qty Ordered",
    OOL.SHIPPED_QUANTITY "Qty Shipped",
    OOL.FULFILLED_QUANTITY "Qty Fulfilled",
    OOL.OPEN_FLAG "Open Flag",
    OOL.CANCELLED_FLAG "Cancelled",
    WH.ORGANIZATION_CODE||' - '||WH.ORGANIZATION_NAME
    "Ship To Organization",
    WH1.ORGANIZATION_CODE||' - '||WH1.ORGANIZATION_NAME
    "Ship From Organization",
    OOL.BOOKED_FLAG "Booked",
    SUBSTR(PIE.ERROR_MESSAGE,1,75) "Error Message"
    FROM RCV_TRANSACTIONS_INTERFACE RTI,
    OE_ORDER_LINES_ALL OOL,
    OE_ORDER_HEADERS_ALL OOH,
    ORG_ORGANIZATION_DEFINITIONS WH,
    ORG_ORGANIZATION_DEFINITIONS WH1,
    PO_INTERFACE_ERRORS PIE
    WHERE OOL.HEADER_ID = RTI.OE_ORDER_HEADER_ID
    AND OOL.LINE_CATEGORY_CODE = 'RETURN'
    AND OOL.LINE_ID = RTI.OE_ORDER_LINE_ID
    AND OOH.HEADER_ID = RTI.OE_ORDER_HEADER_ID
    AND OOL.SHIP_TO_ORG_ID = WH.ORGANIZATION_ID(+)
    AND OOL.SHIP_FROM_ORG_ID = WH1.ORGANIZATION_ID(+)
    AND RTI.INTERFACE_TRANSACTION_ID = PIE.INTERFACE_TRANSACTION_ID(+)
    ORDER BY RTI.INTERFACE_TRANSACTION_ID;
    3.Error가 발생한 Internal Requisition receipts의 추가 정보를 취합하는
    script:
    SELECT RTI.RECEIPT_SOURCE_CODE "Receipt Source Code",
    RTI.REQUISITION_LINE_ID "Intf Req Line Id",
    RTI.SHIPMENT_HEADER_ID "Ship Hdr Id",
    RTI.SHIPMENT_LINE_ID "Ship Line Id",
    RTI.ITEM_ID "Item Id",
    RTI.QUANTITY "Intf Qty",
    RTI.UNIT_OF_MEASURE "UOM",
    RTI.FROM_ORGANIZATION_ID "From Org Id",
    RTI.TO_ORGANIZATION_ID "To Org id",
    PRH.REQUISITION_HEADER_ID "Req Hdr Id",
    PRH.SEGMENT1 "Req Num",
    PRL.REQUISITION_LINE_ID "Req Line Id",
    NVL(PRL.QUANTITY_DELIVERED,0) "Qty Delv",
    NVL(PRL.QUANTITY_CANCELLED,0) "Qty Canc",
    PRL.QUANTITY "Qty Ordered",
    PRL.QUANTITY - (nvl(PRL.QUANTITY_CANCELLED,0) +
    NVL(PRL.QUANTITY_DELIVERED,0))"Qty Remaining",
    PRL.SOURCE_TYPE_CODE "Source Type",
    PRH.TRANSFERRED_TO_OE_FLAG "XFR to OE Flag",
    NVL(PRL.CANCEL_FLAG,'N') "Cancelled",
    NVL(PRL.CLOSED_CODE,'OPEN') "Closed Code",
    LIN.LINE_ID "ISO Line Id",
    NVL(LIN.ORDERED_QUANTITY,0) "ISO Line Qty",
    NVL(LIN.SHIPPED_QUANTITY,0) "ISO Ship Qty",
    NVL(FULFILLED_QUANTITY,0) "ISO Fulfilled Qty",
    NVL(LIN.CANCELLED_QUANTITY,0) "ISO Cancelled Qty",
    NVL(LIN.OPEN_FLAG,'N') "ISO Line Open",
    NVL(LIN.BOOKED_FLAG,'N') "ISO Line Booked",
    NVL(LIN.CANCELLED_FLAG,'N') "ISO Line Cancelled",
    OOH.ORDER_NUMBER "ISO Order Number",
    PIE.COLUMN_NAME "Intf Column",
    SUBSTR(PIE.ERROR_MESSAGE,1,75) "Error Message"
    FROM RCV_TRANSACTIONS_INTERFACE RTI,
    PO_REQUISITION_HEADERS_ALL PRH,
    PO_REQUISITION_LINES_ALL PRL,
    PO_INTERFACE_ERRORS PIE,
    OE_ORDER_LINES_ALL LIN,
    OE_ORDER_HEADERS_ALL OOH
    WHERE PRL.REQUISITION_HEADER_ID = PRH.REQUISITION_HEADER_ID
    AND RTI.REQUISITION_LINE_ID = PRL.REQUISITION_LINE_ID
    AND LIN.SOURCE_DOCUMENT_ID = PRH.REQUISITION_HEADER_ID
    AND LIN.SOURCE_DOCUMENT_LINE_ID = PRL.REQUISITION_LINE_ID
    AND LIN.SOURCE_DOCUMENT_TYPE_ID = 10 --Internal Requisition
    AND OOH.HEADER_ID = LIN.HEADER_ID
    AND PIE.INTERFACE_TRANSACTION_ID(+) = RTI.INTERFACE_TRANSACTION_ID
    ORDER by PRH.SEGMENT1;
    Reference Documents
    Note 263368.1

    Any suggestion/advise please!
    Thanks,
    Genoo

  • 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')

  • REP -1401 Fatal PL/SQL error occurred.

    Hi All,
    In my rdf report i have a formula column with the following code in it..
    function CF_PO_NumberFormula return Char is
    cursor cur_pending_po
    is
    select distinct pll.po_header_id
                   from
                   PO_LINE_LOCATIONS_ALL pll,
                   po_lines_all pla
                   where 1=1
                   and pll.po_line_id=pla.po_line_id
                   and pll.org_id=pla.org_id
                   and pll.org_id=5050
              and pla.item_id=:inventory_item_id
                   and (pll.quantity-pll.quantity_received)>0
                   AND EXISTS(SELECT 1 FROM PO_HEADERS_ALL PHA
              WHERE PLL.PO_HEADER_ID=PHA.PO_HEADER_ID
              AND PHA.APPROVED_FLAG='Y'
              AND PHA.CLOSED_CODE IS NULL)
                   order by pll.po_header_id;
    po_num     varchar2(4000);
    begin
    po_num:=null;
    for rec_cur_pending_po in cur_pending_po
    loop
    select segment1||','||po_num into po_num
    from
    po_headers_all
    where 1=1
    and po_header_id=rec_cur_pending_po.po_header_id;
    end loop;
    return rtrim(po_num,',');
    exception
         when others then
         po_num :=null ;
    return po_num;
    end;
    when i am running the report, it is getting errored out..following is the log file message...
    Arguments
    P_ORGANIZATION_ID='5100'
    P_FROM_DATE='2009/08/31 13:30:00'
    P_TO_DATE='2009/09/02 13:30:00'
    APPLLCSP Environment Variable set to :
    XML_REPORTS_XENVIRONMENT is :
    /app/oapps/11.5.5/opm7ora2/8.0.6/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
    XENVIRONMENT is set to: /app/oapps/11.5.5/opm7ora2/8.0.6/guicommon6/tk60/admin/Tk2Motif_UTF8.rgb
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    AMERICAN_AMERICA.UTF8
    REP-1401: 'cf_po_numberformula': Fatal PL/SQL error occurred.
    Report Builder: Release 6.0.8.27.0 - Production on Thu Sep 10 11:38:18 2009
    (c) Copyright 1999 Oracle Corporation. All rights reserved.
    Enter Username:
    Start of log messages from FND_FILE
    End of log messages from FND_FILE
    Program exited with status 1
    Concurrent Manager encountered an error while running Oracle*Report for your concurrent request 25343374.
    Review your concurrent request log and/or report output file for more detailed information.
    Can Anyone help me on this..

    I would suggest the best place to start is with some diagnostics - first of all in the exception handler. Try
    SRW.MESSAGE(999,'PO number formula failed - '||sqlerrm);
    This will give you more information as to the exact error which occurred.
    Also, I hope you have tested the query separately before putting it in the report! - may be an obvious one, but it is possible that you may have a data size problem on the po_num variable. Do you know how many rows the cursor will return?
    This should give you somewhere to start.
    Edited by: mike_p on Sep 11, 2009 2:09 PM
    Edited by: mike_p on Sep 11, 2009 2:10 PM

Maybe you are looking for