Nextval vs currval

Hello,
Can someone please explain to me the following behavior:
select
OBJECT_ID,
MOD(OBJECT_ID,2),
CASE WHEN MOD(OBJECT_ID,2)=1 then seq_general.nextval else seq_general.currval END
from user_OBJECTS;
returns something like:
OBJ_ID, MOD, SEQ
1,1,1
2,0,2
3,1,3
4,0,4
when instead I was aiming for:
1,1,1
2,0,1
3,1,2
4,0,2
Thank you

Hi,
The explanation is easy, see [How to Use Sequence Values|http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/sql_elements6a.htm#80564]:
Within a single SQL statement containing a reference to NEXTVAL, Oracle increments the sequence only once:
* For each row returned by the outer query block of a SELECT statement. Such a query block can appear in the following places:
o A top-level SELECT statement
o An INSERT ... SELECT statement (either single-table or multi-table). For a multi-table insert, the reference to NEXTVAL must appear in the VALUES clause, and the sequence is updated once for each row returned by the subquery, even though NEXTVAL may be referenced in multiple branches of the multi-table insert.
o A CREATE TABLE ... AS SELECT statement
o A CREATE MATERIALIZED VIEW ... AS SELECT statement
* For each row updated in an UPDATE statement
* For each INSERT statement containing a VALUES clause
* For row "merged" (either inserted or updated) in a MERGE statement. The reference to NEXTVAL can appear in the merge_insert_clause or the merge_update_clause.
If any of these locations contains more than one reference to NEXTVAL, then Oracle increments the sequence once and returns the same value for all occurrences of NEXTVAL.
If any of these locations contains references to both CURRVAL and NEXTVAL, then Oracle increments the sequence and returns the same value for both CURRVAL and NEXTVAL.
Also see a very good explanation in [Why is output of select seqname.currval,seqname.nextval,seqname.currval,seqname.nextval from dual like this?|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:21115948632804]
Regards,
Edited by: Walter Fernández on Jul 7, 2009 7:45 PM

Similar Messages

  • Sqlldr using Nextval and Currval to load 3 databases

    I am trying to load 3 tables from a flat file and when i use the Nextval on a sequence field it loads the table fine, the issue is with the 3rd check below when i try to sequence the records on that table using the same sequence field from the first check. I get the records loaded to the table on the 3rd check but the sequence number is repeating and not staying insynce with the records loaded from the first check. and yes, i have reset all sequence counters.
    INTO TABLE "STAFFING"."WB_TEMP_PUNCH_IN"
    TRUNCATE
    WHEN (80:80) = '1'
    se "temp_punch_in_seq.nextval",
    Badge_Id POSITION(7:16),
    Payroll_Date POSITION(68:71),
    Start_Punch POSITION(72:75),
    PUNCH_IN_1 POSITION(72:75),
    PUNCH_OUT_1 POSITION(76:79)
    INTO TABLE "STAFFING"."WB_TEMP_PUNCH_HRS"
    TRUNCATE
    WHEN (80:80) = '2'
    se1 "temp_punch_hrs_seq.nextval",
    Badge_Id POSITION(7:16),
    Actual_hrs POSITION(26:30),
    PUNCH_IN_2 POSITION(17:20),
    PUNCH_OUT_2 POSITION(21:24),
    PUNCH_IN_3 POSITION(42:45),
    PUNCH_OUT_3 POSITION(46:49),
    PUNCH_IN_4 POSITION(50:53),
    PUNCH_OUT_4 POSITION(54:57),
    PUNCH_IN_5 POSITION(58:61),
    PUNCH_OUT_5 POSITION(62:65),
    PUNCH_IN_6 POSITION(66:69),
    PUNCH_OUT_6 POSITION(70:73)
    INTO TABLE "STAFFING"."WB_TEMP_PUNCH"
    TRUNCATE
    WHEN (80:80) = '3'
    se2 "temp_punch_in_seq.currval",
    Badge_Id POSITION(7:16),
    PUNCH_IN_7 POSITION(17:20),
    PUNCH_OUT_7 POSITION(21:24),
    PUNCH_IN_8 POSITION(29:32),
    PUNCH_OUT_8 POSITION(29:32),
    PUNCH_IN_9 POSITION(33:36),
    PUNCH_OUT_9 POSITION(37:40),
    PUNCH_IN_10 POSITION(41:44),
    PUNCH_OUT_10 POSITION(45:48)
    )

    Try with "rows=1" when you call sqlldr.
    $ more data.ctl
    load data
    into table t1
    col1 "t1_seq.nextval",
    col2 position(1:1) integer external
    into table t2
    col1 "t1_seq.currval",
    col2 position(3:3) integer external
    $ more data.txt
    1,2
    3,4
    5,6
    7,8
    $ sqlldr scott/tiger control=data.ctl data=data.txt rows=1
    Commit point reached - logical record count 1
    Commit point reached - logical record count 2
    Commit point reached - logical record count 3
    Commit point reached - logical record count 4
    SCOTT@orcl> select * from t1;
          COL1       COL2
            39          1
            40          3
            41          5
            42          7
    SCOTT@orcl> select * from t2;
          COL1       COL2
            39          2
            40          4
            41          6
            42          8HTH
    Enrique
    P.S. If your problem was solved, consider marking the question as answered

  • Problem with Union and Currval/NextVal

    Hello,
    I think I may have found a bug with 8.1.5 but I am not sure. Here is the SQL I am trying to execute:
    insert into LFI_TEST_OWNER.CURRVAL_TEST_tb
    SELECT lfi_seq_num_sg.currval
    FROM DUAL
    UNION ALL
    SELECT lfi_seq_num_sg.currval
    FROM DUAL
    When I execute this SQL statement the value inserted into the table is NULL. However when I remove the union and one of the queries then it works as expected.
    Any information on if this is being worked on by Oracle or if it has been fixed would be greatly appreciated.
    Thanks
    Jeff M

    Hi Jeff,
    Nice one. I feel it may not be a bug but as NEXTVAL and CURRVAL are pseudo columns they might not be able to get store in the memory to sort the 2 queries.
    Infact, if you use anyother function in the dual select statment it will return only one row despite of the 2 select statments in the SQL statement. I tried like this,
    SQL> select sysdate from dual
    2 union
    3 select sysdate from dual;
    SYSDATE
    19-JUL-01
    I got only one record. Then I tried like this,
    SQL> select s1.nextval from dual
    2 union
    3 select s1.currval from dual;
    NEXTVAL
    I have given NEXTVAL in the first stmt, still it is returning NULL value only. So I feel it might be PSEUDOCOLUMN effect.
    Any guys who knows better answer are appreciable.
    Thanks
    Srinivas

  • How handle currval if nextval fails

    hi,
    i have to insert the following rows in the table if
    Insert into BOOK (BOOK_ID, CNT, ALT_CNT, ROW_INSERT_TMSTMP, ROW_LAST_UPDT_TMSTMP, BOOK_ID,VERSION)
    SELECT SEQ_BOOK_ID.nextval, 50 , 500 ,sysdate,sysdate, '123456xyz' ,1 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM BOOK B WHERE b.BOOK_ID = '123456xyz' );
    Insert into BOOK_OWNER (BOOK_OWNER_ID, BOOK_ID, USER_ID,VERSION)
    SELECT SEQ_BOOK_OWNER_ID.nextval, SEQ_BOOK_ID.currval, '30327def',1 FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM BOOK_OWNER AO WHERE AO.USER_ID= '30327def');
    commit;
    in above #1st statement checking if the value exists in book and inserting if the first insert fails the secound insert statement uses the "SEQ_BOOK_ID.currval" of the parent. if #1 insert fails how to handle the currval of the secound statement?
    using oralce 10g

    Hi,
    [email protected] wrote:
    also would like to know in anyof the condition the nextval will fail? i mean for some of the records insertion in getting the primery key violation.
    like i am doing one time migration with huge data in to the database around 200 to 300 similar insert statements and some times i am getting the primery key voilation i suspect nextval is failing not able to figure it out.That sounds like some rows were entered with a primary key that was not generated by the sequence.
    You should change the sequence so that it is generating numbers higher than anything already in the table.
    First, find out what the highest id in the table is. For example:
    SELECT  MAX (book_id)
    FROM    book;Say this tells you that book_id=12345 is already in the table. Now find out how high the sequence is. For example:
    SELECT  seq_book_id.NEXTVAL
    FROM    dual;Say this returns 12000, which means you have to add 345 to the sequence.
    You don't want to drop and re-create the sequence; that might make procedures invalid, or lose grants.
    You could reference .NEXTVAL 345 times, or you could say:
    ALTER SEQUENCE  seq_book_id  INCREMENT BY 345;
    SELECT  seq_book_id.NEXTVAL
    FROM    dual;
    ALTER SEQUENCE  seq_book_id  INCREMENT BY 1;This assumes the sequence had originally been incrementing by 1.
    The problem is liable to keep happening as long as the table is incremented without using the sequence.
    You can add a trigger to guarantee that the sequence is used.

  • Behaviour of CurrVal - can anyone explain this?

    Hi All,
    I am expiriencing some "strange" behaviour of CurrVal.
    I will try to represent it with simple expample.
    Let's have one table and one sequence:
    create table TestCurrVal (A number, b number);
    create sequence SeqTestCurrVal start with 1;and some sample data in the table
    insert into TestCurrVal(A, B) VALUES (1,1);
    insert into TestCurrVal(A, B) VALUES (1,2);
    insert into TestCurrVal(A, B) VALUES (2,1);What I want to do is to select all rows from TestCurrVal table ordered by column A. If the value in this coulmn is different by previous value I want to get next sequence value and if it is the same - to use last sequence value. So expected result is the following one:
             A          B     A_PREV PROBLEMATIC_VALUE
             1          1                            1
             1          2          1                 1
             2          1          1                 2I've tried with this statement:
    select a, b, a_prev,
      case
        when a_prev is null or a_prev <> a then SeqTestCurrVal.NextVal
        else SeqTestCurrVal.CurrVal
      end as problematic_value
    from (
      select a,
        lag(a) over (order by a) AS a_Prev,
        b
      from TestCurrVal
      order by a
    );but the result is
             A          B     A_PREV PROBLEMATIC_VALUE
             1          1                            1
             1          2          1                 2
             2          1          1                 3So it seems that on every row it update the sequence even if case clause is not performed and regardless NexVal is not reached.
    Do you have any idea why this happens? ...or/and if you have any workaroud? (but without loosing sequence numbers) (...the only workaround that I have in mind is joining the statement with distinct values and generated sequences for each of those values...but maybe something simple can be introduced)
    And finally some "cleanup" statements:
    drop table TestCurrVal;
    drop sequence SeqTestCurrVal; Best Regards
    Message was edited by:
    Michail

    This is how SEQUENCE works. When it is in the SELECT statement, it is always incremented. http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/pseudocolumns002.htm#i1006157
    "Within a single SQL statement containing a reference to NEXTVAL, Oracle increments the sequence once: <...> For each row returned by the outer query block of a SELECT statement."
    A simple example:
    SQL> CREATE SEQUENCE Test;
    Sequence created.
    SQL>
    SQL> SELECT
      2     Level,
      3     CASE
      4      WHEN 1 < 3 THEN Test.NextVal
      5      ELSE Test.CurrVal
      6     END
      7     A
      8  FROM
      9     Dual
    10  CONNECT BY
    11     Level <=4;
         LEVEL          A
             1          1
             2          2
             3          3
             4          4
    SQL>
    SQL> DROP SEQUENCE Test;
    Sequence dropped.Basically, Oracle detected the NEXTVAL and will now increment the record for each record. Note, that NEXTVAL and CURRVAL are equivalent in a single statement, because even NEXTVAL stays the same for each record:
    SQL> CREATE SEQUENCE Test;
    Sequence created.
    SQL>
    SQL> SELECT
      2     Level,
      3     Test.NextVal,
      4     Test.NextVal
      5  FROM
      6     Dual
      7  CONNECT BY
      8     Level <=4;
         LEVEL    NEXTVAL    NEXTVAL
             1          1          1
             2          2          2
             3          3          3
             4          4          4
    SQL>
    SQL> DROP SEQUENCE Test;
    Sequence dropped.Therefore, it is probably better to decrement the NEXTVAL by 1 (or whatever the INCREMENT BY value is, which can be queried) and exclude the first record.
    SQL> CREATE SEQUENCE Test;
    Sequence created.
    SQL>
    SQL> WITH
      2     TestCurrVal
      3  AS
      4     (
      5      SELECT 1 A, 1 B FROM Dual UNION ALL
      6      SELECT 1 A, 2 B FROM Dual UNION ALL
      7      SELECT 2 A, 1 B FROM Dual
      8     )
      9  SELECT
    10     A,
    11     B,
    12     A_Prev,
    13     Test.NextVal
    14     - CASE
    15        WHEN A_Prev IS NULL AND Test.NextVal > 1 THEN 1
    16        ELSE 0
    17       END Problematic_Value
    18  FROM
    19     (
    20      SELECT
    21             A,
    22             Lag(A) OVER (ORDER BY A) a_Prev,
    23             B
    24      FROM
    25             TestCurrVal
    26      ORDER BY
    27             A
    28     );
             A          B     A_PREV PROBLEMATIC_VALUE
             1          1                            1
             1          2          1                 2
             2          1          1                 3
    SQL>
    SQL>
    SQL> DROP SEQUENCE Test;
    Sequence dropped.

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

  • Call to concurrent program in a pl/sql block does not COMMIT data to table

    I have the following PL/SQL block.
                             apps.create_po(x_org_id,x_document_num,x_agent_name,x_vendor_id,x_vendor_site_id,x_ship_to_location,x_bill_to_location,x_creation_date,new_isbn,new_print_key,new_unit_setup_cost,new_unit_run_cost,x_item,x_category_id,x_item_description,x_unit_of_measure,x_quantity,x_unit_price,x_ship_to_org_id,x_promise_date,x_qty_rcv_tolerance, x_deliver_to_location,x_destination_org_id, x_destination_subinventory,x_segment2,x_segment4);
                                  COMMIT;
    FND_GLOBAL.APPS_INITIALIZE(v_user_id,v_resp_id,201);
    v_po_req_id := apps.fnd_request.submit_request('PO','POXPOPDOI',NULL,NULL,NULL,
                                  NULL,'STANDARD',NULL,'Y',NULL,'APPROVED',NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
                                  DBMS_OUTPUT.PUT_LINE('Request ID is:' || v_po_req_id);
                                  IF v_po_req_id <> 0 THEN
                                       dbms_lock.sleep(60);
                                       dbms_output.Put_line('Sleep executed');
                                       COMMIT;
                                       select PHASE_CODE,STATUS_CODE INTO v_phase_code,v_status_code
                                       FROM FND_CONCURRENT_REQUESTS
                                       WHERE REQUEST_ID = v_po_req_id;
                                       dbms_output.put_line('After commit Phase and status codes are = '||v_phase_code || v_status_code);
                                  ELSE
                                       ROLLBACK;
                                  END IF;
                                  dbms_output.put_line('New Po is' || x_document_num);
                                  dbms_output.put_line('Quantity Is'|| x_quantity);
                                  apps.receive_po(x_document_num,x_quantity);
                                  v_rcv_req_id := apps.fnd_request.submit_request('PO','RVCTP',NULL,NULL,NULL,
                                  'BATCH',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
                                  NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
                                  DBMS_OUTPUT.PUT_LINE('Request ID is:' || v_rcv_req_id);
                                  IF v_rcv_req_id <> 0 THEN
                                       COMMIT;
                                       DBMS_OUTPUT.PUT_LINE('COMMITED RECEIVING');
                                  ELSE
                                       ROLLBACK;
                                  END IF;
    Presently when this block runs, i can see the new PO number created. Commit is also successfully executed. The last output for the program is
    New Po is 20651
    Quantity Is 450
    But due to some reason, the receiving program(receive_po) cannot retrieve the same PO from the base table.
    But once this pl/sql block is complete, and i call the receving procedure from a different session, the Po is retrieved and receiving against the PO is executed successfully.
    Can someone please suggest a work around ? Is the code missing something ? Since POXPOPDOI is a concurrent program which is executed as an asyncronous process, the commit statement after the call to concurent program does not work but the commit is executed only after it exits the pl/sql block.

    Thanks for responding.
    receive_po() program just inserts the data into RCV_HEADERS_INTERFACE and RCV_TRANSACTIONS_INTERFACE tables based on the PO that is created in the previous step. So basically the new PO created has to be received and the receive_po() just inserts data into the interface tables so that RVCTP can be called after that for receiving.
    Here is the code for the procedure.
    SET SERVEROUTPUT ON;
    --FND_GLOBAL.APPS_INITIALIZE(3,20707,201);
    --Procedure for receiving interface to load data to RCV_HEADERS_INTERFACE and RCV_TRANSACTIONS_INTERFACE
    CREATE OR REPLACE PROCEDURE receive_po (x_ponum IN VARCHAR2,x_quantity IN NUMBER) AS
    v_vendor_site_id NUMBER;
    v_vendor_id NUMBER;
    v_agent_id NUMBER;
    v_ship_to_organization_id NUMBER;
    v_item_id NUMBER;
    v_uom_code varchar2(25);
    v_subinventory varchar2(25);
    v_ship_to_location_id NUMBER;
    BEGIN
    --header information in variables
    dbms_output.put_line('Entering Receiving Insert Procedure');
    dbms_output.put_line('Po number ='||x_ponum||'$');
    dbms_output.put_line('Quantity is ='||x_quantity||'$');
    select pvsa.vendor_site_id into v_vendor_site_id
    FROM po_headers_all pha,po_vendors pv, po_vendor_sites_all pvsa
    where pha.vendor_id = pv.vendor_id
    and pv.vendor_id = pvsa.vendor_id
    and pha.segment1 = x_ponum;
    dbms_output.put_line('Vendor Site ID is' ||v_vendor_site_id);
    select pv.vendor_id into v_vendor_id
    FROM po_headers_all pha,po_vendors pv, po_vendor_sites_all pvsa
    where pha.vendor_id = pv.vendor_id
    and pv.vendor_id = pvsa.vendor_id
    and pha.segment1 = x_ponum;
    dbms_output.put_line('Vendor ID is' ||v_vendor_id);
    select plla.SHIP_TO_ORGANIZATION_ID into v_ship_to_organization_id
    from PO_HEADERS_ALL pha, PO_LINE_LOCATIONS_ALL plla
    where pha.PO_HEADER_ID = plla.PO_HEADER_ID
    and pha.segment1 = x_ponum;
    dbms_output.put_line('Ship to org is' ||v_ship_to_organization_id);
    select agent_id into v_agent_id
    FROM po_headers_all
    WHERE segment1 = x_ponum;
    dbms_output.put_line('Agent ID is' ||v_agent_id);
    --printing header table information
    dbms_output.put_line('vendor id is:'||v_vendor_id);
    dbms_output.put_line('vendor site id is:'||v_vendor_site_id);
    dbms_output.put_line('agent id is:'||v_agent_id);
    dbms_output.put_line('ship to organization id is:'||v_ship_to_organization_id);
    --line information in variables
    --derive item id
    select pla.item_id into v_item_id
    from po_headers_all pha, po_lines_all pla
    where pha.po_header_id = pla.po_header_id
    and pha.org_id = pla.org_id
    and pha.segment1 = x_ponum;
    --derive uom
    select pla.unit_meas_lookup_code into v_uom_code
    from po_headers_all pha, po_lines_all pla
    where pla.po_header_id = pha.po_header_id
    and pla.org_id = pha.org_id
    and pha.segment1 = x_ponum;
    --derive subinventory
    select pda.destination_subinventory into v_subinventory
    from po_headers_all pha, po_lines_all pla,po_distributions_all pda
    where pha.po_header_id = pla.po_header_id
    and pla.po_header_id = pda.po_header_id
    and pla.po_line_id = pda.po_line_id
    and pha.org_id = pla.org_id
    and pla.org_id = pda.org_id
    and pha.segment1 = x_ponum;
    --derive ship to location id
    select ship_to_location_id into v_ship_to_location_id
    from po_headers_all
    where segment1 = x_ponum;
    --printing transaction table details
    dbms_output.put_line('item id is:'||v_item_id);
    dbms_output.put_line('UOM is:'||v_uom_code);
    dbms_output.put_line('subinventory is:'||v_subinventory);
    dbms_output.put_line('ship to location id is:'||v_ship_to_location_id);
    --insert data into the receiving interface header table
    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,
    CREATION_DATE               ,
    CREATED_BY               ,
    VENDOR_ID               ,
    VENDOR_SITE_ID               ,
    SHIP_TO_ORGANIZATION_ID ,
    EXPECTED_RECEIPT_DATE          ,
    EMPLOYEE_ID               ,
    VALIDATION_FLAG          
    SELECT
    RCV_HEADERS_INTERFACE_S.NEXTVAL,
    RCV_INTERFACE_GROUPS_S.NEXTVAL,
    'PENDING',
    'VENDOR',
    'NEW', -- 'CANCEL',
    sysdate,
    3,
    3,
    sysdate,
    3,
    v_vendor_id,
    v_vendor_site_id,
    v_ship_to_organization_id,
    sysdate+5,
    v_agent_id,
    'Y'
    FROM DUAL;
    commit;
    --insert data into the interface transaction table
    for i in 1..1 loop
    INSERT INTO RCV_TRANSACTIONS_INTERFACE
    (INTERFACE_TRANSACTION_ID     ,
    HEADER_INTERFACE_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     ,
    QUANTITY               ,
    UNIT_OF_MEASURE          ,
    ITEM_ID ,
    AUTO_TRANSACT_CODE          ,
    RECEIPT_SOURCE_CODE          ,
    SOURCE_DOCUMENT_CODE          ,
    SUBINVENTORY               ,
    DOCUMENT_NUM               ,
    SHIP_TO_LOCATION_ID           ,
    VALIDATION_FLAG
    SELECT
    RCV_TRANSACTIONS_INTERFACE_S.NEXTVAL,
    RCV_HEADERS_INTERFACE_S.CURRVAL,
    RCV_INTERFACE_GROUPS_S.CURRVAL,
    SYSDATE,
    3,
    SYSDATE,
    3,
    3,
    'RECEIVE', --'RECEIVE', -- 'SHIP', --'06-JAN-1998',--question here
    sysdate,
    'PENDING',
    'BATCH',
    'PENDING',
    x_quantity,
    v_uom_code,
    v_item_id,
    'DELIVER', -- 'RECEIVE', --'DELIVER',
    'VENDOR',
    'PO',
    v_subinventory,
    x_ponum,
    v_ship_to_location_id,
    'Y'
    FROM DUAL;
    end loop;
    commit;
    END receive_po;
    I am really stuck and looking out for work arond. Please help.
    Thanks,
    Natasha

  • ESYU: Importing Standard Purchase Orders에서 문제 발생시 진단 방법

    Purpose
    Oracle Purchasing - Version: 11.5.10.2 to 12.0.6
    Information in this document applies to any platform.
    ConcurrentProgram:POXPOPDOI - Import Standard Purchase Orders
    이 문서는 reader게 Importing Standard Purchase Orders 실행 중 갑자기 발생하는 issue에 대해 어떻게
    대응하는지에 대한 자세한 정보를 제공한다.
    Instroduction
    Purchase Document Open Interface는 다량의 Standard Purchase Order는 Oracle Purchasing으로 빨리
    import 할 수 있게 한다. Import process는 import 되어야 하는 document information을 PO interface tables에
    넣어주는 작업을 필요로하며, data를 validate 하고 application에 PO를 생성하거나 error message를 return 하는
    Import Standard Purchase Orders concurrent program을 실행한다.
    이 문서의 목적은 Importing Standard Purchase Orders에 관련된 process를 이해하거나 갑자기 발생한 문제의
    원인을 찾는데 도움을 주기 위함이다. PO import 문제는 일반적으로 interface tables에 입력된 불일치하는 data가
    원인이며, 일단 문제가 확인되면 Metalink는 비슷한 문제를 찾아주거나 Oracle Support에 Service Request를 log
    할 수 있다.
    Test case Information
    1. 아래 insert 문장을 이용하여 PO interface tables에 data를 입력:
    INSERT INTO po.po_headers_interface
    (interface_header_id,
    action,
    org_id,
    document_type_code,
    currency_code,
    agent_id,
    vendor_name,
    vendor_site_code,
    ship_to_location,
    bill_to_location,
    reference_num)
    VALUES
    (apps.po_headers_interface_s.NEXTVAL,
    'ORIGINAL',
    207, -- Seattle
    'STANDARD',
    'USD', -- Your currency code
    24, -- Your buyer id stock
    'Advanced Network Devices',
    'FRESNO',
    'V1- New York City', -- Your ship to
    'V1- New York City', -- Your bill to
    'Currency test') -- Any reference num
    INSERT INTO po.po_lines_interface
    (interface_line_id,
    interface_header_id,
    line_num,
    shipment_num,
    line_type,
    item,
    uom_code,
    quantity,
    --unit_price,
    promised_date,
    ship_to_organization_code,
    ship_to_location)
    VALUES
    (po_lines_interface_s.nextval,
    po_headers_interface_s.currval,
    1,
    1,
    'Outside processing',
    'Flooring OSP',
    'Ea',
    1,
    --17.50,
    '10-APR-2009',
    'V1',
    'V1- New York City' )
    INSERT INTO po.po_distributions_interface
    (interface_header_id,
    interface_line_id,
    interface_distribution_id,
    distribution_num,
    quantity_ordered,
    charge_account_id)
    VALUES
    (po_headers_interface_s.currval,
    po.po_lines_interface_s.CURRVAL,
    po.po_distributions_interface_s.NEXTVAL,
    1,
    1,
    12975) -- Your Charge Account Id
    2. Interface tables에 data가 insert 되었다면 import progra을 실행전 정보를 확인하기 위해 아래 query 문을 이용한다.
    a - Select * from PO_HEADERS_INTERFACE where INTERFACE_HEADER_ID=&headerid
    b - Select * from PO_LINES_INTERFACE where INTERFACE_HEADER_ID=&headerid
    c - Select * from PO_DISTRIBUTIONS_INTERFACE where INTERFACE_HEADER_ID=&headerid
    3. Data를 review 했으면 Import Standard Purchase Orders program을 실행한다.
    Parameter >>
    Default Buyer: Null
    Create or Update Items: No
    Approval Status: INCOMPLETE
    Batch Id: Null
    4. 만일 program에 문제가 있어 error가 발생한다면 error의 원인을 제공하기 위해 Purchasing Interface Error Report를
    실행할 수 있다.
    Parameter >>
    Source Program: PO_DOCS_OPEN_INTERFACE
    Purge Data: No
    만일 PO가 import 되지 않았다면 Puchasing Interface Errors Report와 동일한 정보를 보기 위해 Interface Errors table을
    아래 SQL을 이용하여 조회할 수 있다.
    SELECT * FROM PO_INTERFACE_ERRORS WHERE INTERFACE_TRANSACTION_ID ='&recordsinterfacetransid';
    Diagnostics
    Import Standard Purchase ORder process의 troubleshoot 도움을 위해 아래 Diagnostics과 Reports를 이용한다.
    1. Diagnostics Tool : Oracle Purchasing Purchasing Documents Open Interface Data Collection Test
    (please refer to Note 224887.1 for assistance)
    이 Diagnostics는 import program에 의해 import 되는 data를 validate 할 것이며 missing 되거나 맞지않는 정보를 highlight 한다.
    이 Tool은 interface tables에 있는 맞지 않거나 불완전한 data의 자세한 정보를 제공할 수 있다.
    Error는 PO를 import 할 때 발생한 문제 분석을 시도하는데 매우 유익하므로 SR을 log시 이 Diagnostic output을 upload 하는
    것을 권장한다.
    2. Purchasing Interface Errors Report
    이 report는 Oracle Purchasing에서 사용가능하며 Import Standard Purchase Orders program을 실행시 발생하는
    error를 강조한다.
    Tracing
    11.5.10 이상의 version에서 Import Standard Purchase Orders program의 trace를 생성:
    1. Navigate to System Administrator responsibility
    2. Navigate to Profiles->System
    3. Query the Profile Option Concurrent: Allow Debugging and set it to Yes at User level
    4. Navigate to Purchasing responsibility
    5. From the Requests form, choose the Import Standard Purchase Orders program and set the required Parameters
    6. Click the Debug button
    7. Check the SQL Trace checkbox and specify Trace with Binds and Waits
    8. Submit the Concurrent program
    9. Retrieve the trace file created.
    Logging
    Import Standard Purchase Orders program의 FND Deug Log 생성:
    1. Log_seq를 아래 SQL을 이용하여 확인.
    select max(log_sequence) from fnd_log_messages;
    2. Set the following profiles at the user level:
    FND: Debug Log Enabled = YES
    FND: Debug Log Filename = NULL
    FND: Debug Log Level = STATEMENT
    FND: Debug Log Module = %
    3. Run Import Standard Purchase Orders program
    4. Using a SQL client run the following query :
    Select * from fnd_log_messages
    where log_sequence > &log_seq_noted_above
    order by log_sequence;
    이 query의 output은 Import Standard Purchase Orders program이 실행 중 발생한 error를 표시한다.
    Reference
    Note 781351.1

  • When I run the Receiving interface i get an error that the period is not open.  But all periods are open from Jun 14 through April 15.

    I am running the following inserts and all periods are open but I still get this error in the po_interface_errors table.
    "Error: Please enter a GL Date within an open inventory accounting period.
    Cause:        You provided a GL date that is not within an open inventory accounting period. 
    Action:        Enter a date that is within an open period."
    Here are the inserts.
    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, creation_date, created_by,
    vendor_id,expected_receipt_date, validation_flag)
    SELECT rcv_headers_interface_s.NEXTVAL, rcv_interface_groups_s.NEXTVAL,
    'PENDING', 'VENDOR', v_transaction_type , SYSDATE, v_user_id, 0,SYSDATE, v_user_id,
    v_vendor_id, SYSDATE, 'Y'
    FROM DUAL;
    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_header_id, 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,
    destination_type_code,
    deliver_to_location_id,subinventory,
    header_interface_id, validation_flag)
    SELECT rcv_transactions_interface_s.NEXTVAL,
    rcv_interface_groups_s.CURRVAL, SYSDATE, v_user_id,
    SYSDATE, v_user_id, 0, 'RECEIVE', SYSDATE, 'PENDING',
    'BATCH', 'PENDING', v_po_header_id,v_po_line_id,
    v_item_id, v_quantity,
    v_unit_meas_lookup_code,
    v_line_location_id, 'DELIVER', 'VENDOR',
    v_organization_code, 'PO', v_po_number,
    v_destination_type_code,
    v_deliver_to_location_id, v_destination_subinventory,
    rcv_headers_interface_s.CURRVAL, 'Y'
    FROM DUAL;

    I went to Inventory > Setup > Organizations  
    but I do not see a place to open a period under an organization. If there is another place to go let me know.
    I looked under calendars but that does not have anything to do with periods as far as I can tell.

  • PO Receipts Interface Error!!

    Hi,
    We are on 11.5.10. I am trying to create PO receipts using the interface program "Receiving Transaction Processor". I inserted data into the rcv_headers_interface and rcv_transactions_interface tables. As this dta is for contract labor, i am assuming that there is no need to insert data into shipment_related interface table. Following shows the insert statement I made sure that I am running the process from the correct org (the org that i used in the filed destination_oprganization field). But still the process completes normally but po_interface_errors has a record with error message as :
    "RVTSH-189: Subroutine rvtshiline() returned error
    Cause: Subroutine rvtshiline() returned an internal error.
    Action: Note this error number and the actions you are trying to perform.
    Contact your system administrator for"
    The receipt gets created succesfully from the form. Anyone knows the issue? Please help me...thanks
    Here are the insert statements...
    --Insert data into Interface tables
    INSERT INTO rcv_headers_interface
    (header_interface_id,
    GROUP_ID,
    processing_status_code,
    receipt_source_code,
    transaction_type,
    auto_transact_code,
    last_update_date,
    last_updated_by,
    creation_date,
    created_by,
    expected_receipt_date,
    comments,
    validation_flag,
    packing_slip,
    vendor_id,
    vendor_site_id,
    ship_to_organization_id
    VALUES (rcv_headers_interface_s.NEXTVAL,
    rcv_interface_groups_s.NEXTVAL,
    'PENDING',
    'VENDOR',
    'NEW',
    'RECEIVE',
    SYSDATE,
    fnd_global.user_id,
    SYSDATE,
    fnd_global.user_id,
    SYSDATE,
    'test',
    'Y',
    'ABC',
    po_headers.vendor_id,
    po_headers.vendor_site_id
    po_distributions.destination_organization_id
    --Insert record in transactions_interface
    INSERT INTO rcv_transactions_interface
    (interface_transaction_id,
    header_interface_id,
    processing_status_code,
    receipt_source_code,
    transaction_date,
    GROUP_ID,
    last_update_date,
    last_updated_by,
    creation_date,
    created_by,
    transaction_type,
    processing_mode_code,
    transaction_status_code,
    quantity,
    unit_of_measure,
    source_document_code,
    po_header_id,
    po_line_id,
    po_line_location_id,
    po_distribution_id,
    to_organization_id,
    comments,
    interface_source_code,
    employee_id,
    auto_transact_code,
    destination_type_code,
    attribute_category,
    category_id,
    item_description
    VALUES (rcv_transactions_interface_s.NEXTVAL,
    rcv_headers_interface_s.CURRVAL,
    'PENDING',
    'VENDOR',
    SYSDATE,
    rcv_interface_groups_s.CURRVAL,
    SYSDATE,
    fnd_global.user_id,
    SYSDATE,
    fnd_global.user_id,
    'RECEIVE', --'NEW',
    'BATCH',
    'PENDING',
    2,
    po_lines.unit_meas_lookup_code,
    'PO',
    po_headers..po_header_id,
    po_lines.po_line_id,
    po_line_locations.po_line_location_id,
    po_distributions.po_distribution_id,
    po_distributions.destination_organization_id,
    'TEST',
    'RCV',
    1234, --employee_id
    'RECEIVE',
    'RECEIVING',
    po_distributions.destination_organization_id,
    45074,
    'Standard'
    );

    There are several hits on MOS for this error. Pl see if any are applicable in your case -
    121907.1 - RVCTP: RVTSH-140 RVTSH-189 SUBROUTINE RVTSHILINE RETURNED ERROR
    286966.1 - RVTSH-140 RVTSH-189 Subroutine rvtshiline() errors returned by ROI
    1080050.6 - GET ERRORS RVTSH-140 RVTSH-189 when run Receiving Transaction Processor
    371314.1 - Receiving:Data Discrepancies, Errors and Validation Issues after upgrade to or install of 11.5.10 (or 11i.SCM_PF.J)
    230259.1 - Receiving Open Interface - Unable to complete Receiving Transactions
    303246.1 - 11.5.10: Inbound Receiving Transaction errors with RVTBM-008, RVTBM-120 and RVTSH-189
    369258.1 - Receipts Failing with RVTS-189 for Receiving Open Interface Transaction
    HTH
    Srini

  • Urgent Please - Receiving Transaction Processor Issue

    Hi,
    We are on 11.5.10. I am trying to create PO receipts using the interface program "Receiving Transaction Processor". I inserted data into the rcv_headers_interface and rcv_transactions_interface tables. As this dta is for contract labor, i am assuming that there is no need to insert data into shipment_related interface table. Following shows the insert statement I made sure that I am running the process from the correct org (the org that i used in the filed destination_oprganization field). But still the process completes normally but po_interface_errors has a record with error message as :
    "RVTSH-189: Subroutine rvtshiline() returned error
    Cause: Subroutine rvtshiline() returned an internal error.
    Action: Note this error number and the actions you are trying to perform.
    Contact your system administrator for"
    The receipt gets created succesfully from the form. Anyone knows the issue? Please help me...thanks
    Here are the insert statements...
    --Insert data into Interface tables
    INSERT INTO rcv_headers_interface
    (header_interface_id,
    GROUP_ID,
    processing_status_code,
    receipt_source_code,
    transaction_type,
    auto_transact_code,
    last_update_date,
    last_updated_by,
    creation_date,
    created_by,
    expected_receipt_date,
    comments,
    validation_flag,
    packing_slip,
    vendor_id,
    vendor_site_id,
    ship_to_organization_id
    VALUES (rcv_headers_interface_s.NEXTVAL,
    rcv_interface_groups_s.NEXTVAL,
    'PENDING',
    'VENDOR',
    'NEW',
    'RECEIVE',
    SYSDATE,
    fnd_global.user_id,
    SYSDATE,
    fnd_global.user_id,
    SYSDATE,
    'test',
    'Y',
    'ABC',
    po_headers.vendor_id,
    po_headers.vendor_site_id
    po_distributions.destination_organization_id
    --Insert record in transactions_interface
    INSERT INTO rcv_transactions_interface
    (interface_transaction_id,
    header_interface_id,
    processing_status_code,
    receipt_source_code,
    transaction_date,
    GROUP_ID,
    last_update_date,
    last_updated_by,
    creation_date,
    created_by,
    transaction_type,
    processing_mode_code,
    transaction_status_code,
    quantity,
    unit_of_measure,
    source_document_code,
    po_header_id,
    po_line_id,
    po_line_location_id,
    po_distribution_id,
    to_organization_id,
    comments,
    interface_source_code,
    employee_id,
    auto_transact_code,
    destination_type_code,
    attribute_category,
    category_id,
    item_description
    VALUES (rcv_transactions_interface_s.NEXTVAL,
    rcv_headers_interface_s.CURRVAL,
    'PENDING',
    'VENDOR',
    SYSDATE,
    rcv_interface_groups_s.CURRVAL,
    SYSDATE,
    fnd_global.user_id,
    SYSDATE,
    fnd_global.user_id,
    'RECEIVE', --'NEW',
    'BATCH',
    'PENDING',
    2,
    po_lines.unit_meas_lookup_code,
    'PO',
    po_headers..po_header_id,
    po_lines.po_line_id,
    po_line_locations.po_line_location_id,
    po_distributions.po_distribution_id,
    po_distributions.destination_organization_id,
    'TEST',
    'RCV',
    1234, --employee_id
    'RECEIVE',
    'RECEIVING',
    po_distributions.destination_organization_id,
    45074,
    'Standard'
    );

    Pl see you duplicate post here - PO Receipts Interface Error!!
    For urgent issues, pl open an SR with Support
    Srini

  • Getting error after submitting import standard purchase order from localization responsibility

    Hi All,
    I have manully inserted data in header,line,distribution interface table like below
    INSERT INTO po_headers_interface
    (interface_header_id,process_code,action,org_id,document_type_code,document_num,currency_code,vendor_name,vendor_id,vendor_site_code,vendor_site_id,comments,
    vendor_doc_num,amount_agreed,effective_date,expiration_date,vendor_contact,approval_status,terms_id,agent_id,creation_date,created_by,last_update_date,last_updated_by)
    VALUES  
    (po_headers_interface_s.NEXTVAL,'PENDING','ORIGINAL','7046','STANDARD','454545','INR','Madhura Enterprises','40179',NULL,'13922','XYZ',null,null,sysdate,sysdate+10,null,
    'Approved',13922,25,SYSDATE,fnd_global.user_id,SYSDATE,fnd_global.user_id);
    INSERT INTO po_lines_interface
    (interface_line_id,interface_header_id,process_code,line_num,item_id,item_description,uom_code,unit_of_measure,quantity,unit_price,ship_to_organization_id,ship_to_location_id,
    need_by_date,promised_date,last_update_date,last_updated_by,creation_date,created_by,line_type_id,vendor_product_num,note_to_vendor,shipment_num,closed_code,closed_reason,CATEGORY_id,tax_code_id)
    VALUES
    (po_lines_interface_s.NEXTVAL,po_headers_interface_s.CURRVAL,'PENDING',1,'208956','ESSEL CAPITAL ITEM','Ea','Each',2,100,'7087',
    '22885',SYSDATE+1,SYSDATE+1,SYSDATE,fnd_global.user_id,SYSDATE,fnd_global.user_id,'1',NULL,'aaaaaa','1',NULL,NULL,'1','1000');
    INSERT INTO po_distributions_interface
    (interface_header_id,interface_line_id,interface_distribution_id,distribution_num,quantity_ordered,quantity_delivered,quantity_billed,quantity_cancelled,destination_type_code,deliver_to_location_id,
    deliver_to_person_id,charge_account,charge_account_id,creation_date,created_by,project_id,expenditure_item_date)
    VALUES
    (po_headers_interface_s.CURRVAL,po_lines_interface_s.CURRVAL,po_distributions_interface_s.NEXTVAL,'1','2',NULL,NULL,NULL,
    'INVENTORY','22885','24',NULL,'134793',SYSDATE,fnd_global.user_id,NULL,NULL);
    When i am submitting the standard program then i am getting following error---
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small in Package po.plsql.PO_PDOI_ERR_UTL. Procedure add_fatal_error.0
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small in Package po.plsql.PO_PDOI_ITEM_PROCESS_PVT. Procedure update_master_item.60
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small in Package po.plsql.PO_PDOI_ITEM_PROCESS_PVT. Procedure create_items.60
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small in Package po.plsql.PO_PDOI_MAINPROC_PVT. Procedure process_lines_add.70
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small in Package po.plsql.PO_PDOI_MAINPROC_PVT. Procedure process_lines.10
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small in Package po.plsql.PO_PDOI_MAINPROC_PVT. Procedure process.10
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small in Package po.plsql.PO_PDOI_PVT. Procedure start_process.110
    User-Defined Exception in Package po.plsql.PO_PDOI_Concurrent. Procedure POXPDOI.30
    Please help me in this issue.. when i am running this on vision without tax code it is working fine.
    But in localization its not working. Basically i need to do scripting for india localization for Open PO.
    The application Details -
    RDBMS : 11.1.0.7.0
    Oracle Applications : 12.1.3

    please everyone do needful help on this..

  • Urgent Please - Receiving Transaction Processor

    Hi,
    We are on 11.5.10. I am trying to create PO receipts using the interface program "Receiving Transaction Processor". I inserted data into the rcv_headers_interface and rcv_transactions_interface tables. As this dta is for contract labor, i am assuming that there is no need to insert data into shipment_related interface table. Following shows the insert statement I made sure that I am running the process from the correct org (the org that i used in the filed destination_oprganization field). But still the process completes normally but po_interface_errors has a record with error message as :
    "RVTSH-189: Subroutine rvtshiline() returned error
    Cause: Subroutine rvtshiline() returned an internal error.
    Action: Note this error number and the actions you are trying to perform.
    Contact your system administrator for"
    The receipt gets created succesfully from the form. Anyone knows the issue? Please help me...thanks
    Here are the insert statements...
    --Insert data into Interface tables
    INSERT INTO rcv_headers_interface
    (header_interface_id,
    GROUP_ID,
    processing_status_code,
    receipt_source_code,
    transaction_type,
    auto_transact_code,
    last_update_date,
    last_updated_by,
    creation_date,
    created_by,
    expected_receipt_date,
    comments,
    validation_flag,
    packing_slip,
    vendor_id,
    vendor_site_id,
    ship_to_organization_id
    VALUES (rcv_headers_interface_s.NEXTVAL,
    rcv_interface_groups_s.NEXTVAL,
    'PENDING',
    'VENDOR',
    'NEW',
    'RECEIVE',
    SYSDATE,
    fnd_global.user_id,
    SYSDATE,
    fnd_global.user_id,
    SYSDATE,
    'test',
    'Y',
    'ABC',
    po_headers.vendor_id,
    po_headers.vendor_site_id
    po_distributions.destination_organization_id
    --Insert record in transactions_interface
    INSERT INTO rcv_transactions_interface
    (interface_transaction_id,
    header_interface_id,
    processing_status_code,
    receipt_source_code,
    transaction_date,
    GROUP_ID,
    last_update_date,
    last_updated_by,
    creation_date,
    created_by,
    transaction_type,
    processing_mode_code,
    transaction_status_code,
    quantity,
    unit_of_measure,
    source_document_code,
    po_header_id,
    po_line_id,
    po_line_location_id,
    po_distribution_id,
    to_organization_id,
    comments,
    interface_source_code,
    employee_id,
    auto_transact_code,
    destination_type_code,
    attribute_category,
    category_id,
    item_description
    VALUES (rcv_transactions_interface_s.NEXTVAL,
    rcv_headers_interface_s.CURRVAL,
    'PENDING',
    'VENDOR',
    SYSDATE,
    rcv_interface_groups_s.CURRVAL,
    SYSDATE,
    fnd_global.user_id,
    SYSDATE,
    fnd_global.user_id,
    'RECEIVE', --'NEW',
    'BATCH',
    'PENDING',
    2,
    po_lines.unit_meas_lookup_code,
    'PO',
    po_headers..po_header_id,
    po_lines.po_line_id,
    po_line_locations.po_line_location_id,
    po_distributions.po_distribution_id,
    po_distributions.destination_organization_id,
    'TEST',
    'RCV',
    1234, --employee_id
    'RECEIVE',
    'RECEIVING',
    po_distributions.destination_organization_id,
    45074,
    'Standard'
    );

    Pl see your triplicate post here - PO Receipts Interface Error!!
    For urgent issues, pl open an SR with Support.
    Srini

  • Inserting data in to table....

    Hello,
    We have an assignment in tomorrow and are having a few problems! This code is to enter details in to an 'order details' table:
    insert into Order_Details values(order_details_seq.nextval, orders_seq.currval, '&&DVD_ID',
    (select dvd_details.selling_price from dvd_details where dvd_details.dvd_id = &&DVD_ID));
    This all works fine and we can enter the details... the only problem is when we try and enter details for the next order. The DVD ID number is automatically entered and the user is not prompted for the DVD ID...
    Any help would be great!
    Pam

    Pam,
    The problem is that sql plus already knows the value for &&DVD_ID once you have entered it. It was only asking you for it's value the first time because it didn't have a value. Now that you have entered it, it is perfectly happy using that value over and over again.
    What you may want to do is put your statement inside a loop with a statement like this:
    ACCEPT DVD_ID CHAR PROMPT 'Enter the DVD ID: '
    prior to the sql statement so that it prompts you every time.
    Chris Doherty

  • FK error in PL/SQL code.

    I have a application with the following code.
    Declare
    v_num_req varchar2(100); --Recebe o codigo da requisição
    v_cont number; --Conta a quantidade de aparições
    BEGIN
    --Busca o codigo da requisição
    select cod_requisicao
    into v_num_req
    from requisicao
    where cod = :p72_cod_requisicao;
    --Conta o numero de vezes em que aparece a requisição
    select count(numero_documento)
    INTO v_cont
    from amx_documento
    where numero_documento = v_num_req;
    --Se não aparecer nenhuma requisição
    IF (v_cont = 0) then
    BEGIN
    --Insere a movimentação
    INSERT INTO AMX_MOVIMENTACAO_MATERIAL(COD, NUM_GUIA, NUM_EMPENHO,DT_EMISSAO_EMPENHO ,DESTINO, DT_MOVIMENTACAO, COD_TIPO_MOVIMENTACAO, COD_ALMOXARIFADO, COD_STATUS)
    VALUES (AMX_MOVIMENTACAO_MATERIAL_SEQ.NEXTVAL ,to_char(sysdate, 'YYYY/DDMM-SSSSS'),'123SIS',sysdate,175120,sysdate,301,AMX_ALMOXARIFADO_PADRAO(:app_user),2);
    --Insere o documento
    Insert into amx_documento(cod,cod_movimentacao,cod_tipo_documento,valor_documento,numero_documento)
    values(amx_documento_seq.nextval,amx_movimentacao_material_seq.currval,261,0000,v_num_req);
    --inicia o cursor com os materiais.
    for c_item_req in(
    SELECT
    a.cod cod_mat,
    a.qtd_fornecida
    FROM
    item_requisicao a
    INNER JOIN requisicao e on a.cod_requisicao = e.cod
    INNER JOIN AMX_MATERIAL b ON a.cod_material=b.cod
    LEFT JOIN AMX_ESTOQUE c ON a.cod_material=c.cod_material
    AND c.cod_almoxarifado = :p72_almoxarifado
    WHERE
    a.cod_requisicao = :p72_cod_requisicao
    LOOP
    --Insere os items do documento.
    insert into amx_documento_item(cod,quantidade,valor_total,cod_material,cod_documento)
    values(AMX_MOVIMENTACAO_ITEM_SEQ.nextval,c_item_req.qtd_fornecida,00,c_item_req.cod_mat,amx_documento_seq.currval);
    END LOOP;
    END;
    end if;
    end;
    When run, return a error because of the FK cod_material in still new in the PL/SQL world, so please help me.

    post also the complete returned error message.

Maybe you are looking for

  • V$session and v$process

    Hi, OS : Red hat 4.2/5 and Aix 5 Db : 10 1,What is the difference between terminal and machine in V$SESSION. SQL> select terminal,machine from v$session where username='SCOTT'; TERMINAL MACHINE pts/34 tctm-x001.it1.com pts/0 tctm-x001.it1.com SQL> 2,

  • Any idea when we get DNG plug-in for Vista?????

    I am curious to know when we get the WIC plug-in for Vista? I have the Canon one, but unfortunately I converted most of my RAW files to DNG. I have LR and CS3, but sometimes I just want to use Windows Photo Viewer to show files. If Adobe truly want D

  • Default Setting for Genenral Ledger Report

    Hello, While i am running General Ledger Report for G/L system show defaul subtotal for daily, Monthly and Yearly. Is there any setting available so that report shows default yearly total only. Regards, Arpit Shah

  • Changed Password but lost all my photos and itunes !  Help !

    Hi. I have been storing my music and photos on my powerbook G4 for a year when I finally got around to changing my password (by inserting the Start-up disk and going to Systems and Resetting Password). In a burst of enthusiasm, I also then changed th

  • Shows Two Of The Same Album

    So, on my 3.1.3 version iPod Touch, it shows that there are two copies of almost every album by one of the bands I listen to. These albums are exactly the same, and I only have ONE copy of each of these albums in my iTunes library. How do I fix this?