DataProvider unable to update records in table

Hi guys,
as above, I have got this piece of code below.
What happen is I am unable to update the records in one of the dataprovider - "objectidsDataProvider" (used to keep track of no. of items in itemsDataProvider).
If I take away the objectidsDataProvider coding; I am able to update the itemsDataProvider.
Please kindly advice and let me know if any additional info needed. Thanks in advance.
CODE:
int newItemId = 0;
if (itemsDataProvider.canAppendRow()) {
  try {
    RowKey rowKey = itemsDataProvider.appendRow();
    itemsDataProvider.setCursorRow(rowKey);
    // put the new data in the data provider
    itemsDataProvider.setValue("ITEMS.ID", new Integer(0));
    itemsDataProvider.setValue("ITEMS.USERNAME", uname);
    itemsDataProvider.setValue("ITEMS.TITLE", title);
    newItemId = ((Integer)objectidsDataProvider.getValue("MAXITEMID")).intValue();
    objectidsDataProvider.setValue("OBJECTIDS.ID", new Integer(newItemId));
     objectidsDataProvider.commitChanges();
    // Navigate through rows with data provider
    if (itemsDataProvider.getRowCount() > 0) {
      itemsDataProvider.cursorFirst();
      do {
        if (itemsDataProvider.getValue("ITEMS.ID").equals(new Integer(0))) {
          itemsDataProvider.setValue("ITEMS.ID", new Integer(newItemId));   
      } while (itemsDataProvider.cursorNext());
    itemsDataProvider.commitChanges();
  } catch (Exception e) {
    log("Cannot add new DVD", e);
    error("Cannot add new DVD: " + e.getMessage());
  return "success";
} else {
  return "fail";
SELECT * FROM DVD.OBJECTIDS
TABLE_NAME        ID
items            28
SELECT * FROM DVD.ITEMS
ID    USERNAME    TITLE
1        John        300
...

RowKey rowKey = itemsDataProvider.appendRow();
itemsDataProvider.setCursorRow(rowKey);
// put the new data in the data provider
itemsDataProvider.setValue("ITEMS.ID", new Integer(0));
itemsDataProvider.setValue("ITEMS.USERNAME", uname);
itemsDataProvider.setValue("ITEMS.TITLE", title);try to use this :
RowKey rowKey = itemsDataProvider.appendRow();
    itemsDataProvider.setCursorRow(rowKey);
    // put the new data in the data provider
    itemsDataProvider.setValue("ITEMS.ID", rowKey ,new Integer(0));
    itemsDataProvider.setValue("ITEMS.USERNAME", rowKey ,uname);
    itemsDataProvider.setValue("ITEMS.TITLE",rowKey , title);and dont forget to end ur code with ,,, commiteChanges();
Hope this will help
Good luck
Mohammed

Similar Messages

  • Unable to update records in table

    Hi all,
    While updating particular set of records in a table system gets hanged however it is allowing to update rest of record.i checked lock using
    v$locked_object ,v$session but i cud't find any..is there any way to find lock at all levels.
    thanks

    Grab your sid of the session that you are running via sys_context('USERENV','SID') or something else and then check out the wait events, and locks:
    select * from gv$lock where sid = <sid>;
    select * from gv$session_wait where sid = <sid>;P.S. Watch for triggers... YUCK!
    Message was edited by:
    JoeC

  • Unable to update record in web Form

    Hi, i am unable to update record in a form. I am building a custom form using forms 6i and putting it on the web in oracle applications 11.5.9
    I used template.fmb as a starting point for my form. I have one datablock based on a table. Insert, update and delete properties are set to yes on the property pallete of data block. The table against which i am running the form has a primary key which is a combination of two fields. I am able to update a record with pure SQL running against the table.
    My form now brings back a record from the db like it should but whenever I try to update that record either by pressing Action Save or by clicking button that has update statement in it, instead of doing an update, it does an insert and tells me that this record already exists and that i entered value(s) that must be unique for each record. It thinks I want to insert but I want to update. What am i doing wrong???
    Update allowed value is set to Yes in all the items in the data block and at the data block level as well. Querly_only is set to no.
    What's even more frustratinng is that I've ran the form manually before starting with template.fmb and have been able to update the table but when I put it on the web and used template.fmb it stopped working!
    I am very new to forms, can anybody suggest anything? Please help!!!

    When you populate the 2nd block with a select into query, it's the same as just typing the data into the block. The record is treated as one needing to be inserted, not as one that is queried.
    To populate it using a true query, but with data from the LOV, you can do this:
    Programmatically set the default_where clause of the block based on the LOV. For example, if a name is chosen from the LOV in an item called LOV1, you could do:
    set_block_property('block2','default_where','name='''||:block1.lov1||'''');
    or if the LOV is a number, like a department number:
    set_block_property('block2','default_where','deptno='||:block1.lov1);
    The tricky part when you build your where clause is that you must surround strings with single quotes, and the way to do this is to use two single quotes to represent an actual single quote in the where clause. Otherwise a single quote is interpreted as part of the PL/SQL syntax.
    Then, just navigate to block 2 and execute a query:
    go_block('block2');
    do_key('execute_query');
    I hope this works for you. I didn't have time to test this, so I hope I didn't make any syntax errors when typing.

  • Unable to update when executed, table gets lock Execution does not stop Execution even for an hour

    Following is my Query unable to update when Executed table gets lock Execution does not stop even for an hour.
    update Employees 
          set Status = 'Close'
          where statusid IN (select statusid 
                                             from MyView 
                                              where DownloadedDate ='2014-07-27 00:00:00.000'
    here Employee contains 3,00,000 of records and Subquery return 1,50,000 Empid 
    i tried in various ways but not able to solve, statusid  column have no index on,  i tried using cursor but it does not work.
    plz let me know how to solve this Issue, THANKS IN ADVANCE.

    Hello,
    You should better post your question to a more related Forum, like Transact-SQL or SQL Server Database Engine; this Forum is for samples & community Projects.
    Have you checked the execution plan if indexes are used?
    You could update the data in chunks, e.g. 10.000 rows per execution. For this you have to add a TOP clause and a filter to update only those, who are not updated yet.
    update TOP (10000) Employees
    set Status = 'Close'
    where statusid IN
    (select statusid
    from MyView
    where DownloadedDate ='2014-07-27 00:00:00.000')
    AND Status <> 'Close'
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Unable to update, when executed table gets lock and Execution does not stop even for an hour.

    Following is my Query, which unables to update. When Executed, table gets lock and Execution does not stop even for an hour.
    update Employees 
          set Status = 'Close'
          where statusid IN (select statusid 
                                             from MyView 
                                              where DownloadedDate ='2014-07-27 00:00:00.000'
    here Employee contains 3,00,000 of records and Subquery return 1,50,000 Empid 
    i tried in various ways but not able to solve, statusid  column have no index on,  i tried using cursor but it does not work.
    plz let me know how to solve this Issue, Its very Important to get solve as all my further work depends on Updation
    , THANKS IN ADVANCE.

    See also your other thread with the same question:
    http://social.msdn.microsoft.com/Forums/en-US/80243625-fc3b-4ee1-bce1-4adcdbc16c14/unable-to-update-when-executed-table-gets-lock-execution-does-not-stop-execution-even-for-an-hour?forum=sqlserversamples
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • PDE-PLI031 Unable to fetch record from table tool_modulre

    Dear ALL
    I am creating PL/SQL Libraries in report builder.
    but When I try to save the Library to database, a error
    PDE-PLI031 Unable to fetch record from table tool_modulre.
    Would you please tell me how to solve this problem
    and why it coming
    thankyou very much
    pritam singh

    Hi ,
    Saving a library (.pll) to database would store the object inside specific tables that are to be created.
    If you are using 6i, then you should find toolbild & toolgrnt.sql files which you have to run in the order specified. The above scripts creates the necessary tables and henceforth you won't get those errors while saving.
    Hope this helps.
    Thanks,
    Vinod.

  • FRM-40509: ORACLE error: unable to UPDATE record.

    FRM-40509: ORACLE error: unable to UPDATE record.
    what can i do?

    There will always be another error which tells you what the actual problem on the database is. Use the Display message key, or message out DBMS_ERROR_TEXT

  • How to update record in Table control

    Dear Friends,
      I have table control that has space for 10 records but i need to update 15 record from the flat file which is getting into the table how can i do this.
    Regards,
    MAHENDRA.

    Hi,
    you record for an item and then click on page down and save it.use the loop on this bdc to populate the the bdc table no need to do manually.
    LOOP AT  l_i_dettab_item INTO l_wa_dettab_item..
          l_cursor = l_cursor + 1.
          IF l_cursor GT 1.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                   '=P+'.
          ENDIF.
          PERFORM cursor_pos_notation    USING 'V_EAN_DET001- GTIN_VARIANT_TYP'
                                                  l_cursor
                                        CHANGING  l_cursor_notation.
          PERFORM cursor_pos_notation    USING 'V_EAN_DET001-VTWEG'
                                                  l_cursor
                                        CHANGING  l_cursor_notation.
          PERFORM bdc_field       USING l_cursor_notation
                                        l_wa_dettab_item-vtweg.
          PERFORM cursor_pos_notation    USING 'V_EAN_DET001-DATEFROM'
                                                  l_cursor
                                        CHANGING  l_cursor_notation.
             PERFORM bdc_field       USING l_cursor_notation
                                        l_v_date.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        l_cursor_notation.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=SAVE'.
        ENDLOOP.
    Here my ok code for page down is =P+  so i am looping on the table control data and then populating the bdc table after this i will populate the remaing info required for the call transaction and refresh bdcdata.
    thats it no need to do recording 1000 times.
    now if u do like this it doesn't depend on the number of records on table control.
    it will take all the records.
    Reward if useful.
    Regards,
    sasi
    Regards,
    sasi

  • Create / update record in table T499S - Locations

    Hello,
    I would like to update/create some records in table t499s but cannot find a BAPI for this. Does someone know how to change the table and related addresses or do I have to change the tables the hard way via modify?
    Thanks a lot,
      Vanessa

    Hello Vanessa,
    I have created a program that create / modify / delete Locations in T499S.
    Creation:
    - Create an address with a standard FM
    - Create a line in T499S
    Modification or deletion
    - Modify  or delete a line in T499S
    I also add the modification in a transport order.
    In my opinion, the better way is to do a call transaction.
    Please reward if useful.
    René

  • Updating record using table contorl

    hi ABAPers,
    i have a problem while updating the record to a database table from table control,
    please,check the code writtern,
    Code in Top include:
    Tables: MARA,
            MAKT.
    DATA: BEGIN OF ITAB OCCURS 0,
          MATNR LIKE MARA-MATNR,
          SPRAS LIKE MAKT-SPRAS,
          MAKTX LIKE MAKT-MAKTX,
          END OF ITAB.
    *data:ok_code(20).
    CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 2000.
    *DATA: cols LIKE LINE OF TC1-cols,
         lines TYPE i.
    Screen_1000:Code in PAI:
    module USER_COMMAND_1000 input.
    CASE SY-UCOMM.
    WHEN 'DISPLAY'.
    SELECT SPRAS MAKTX FROM MAKT INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE MATNR = MARA-MATNR.
    IF SY-DBCNT IS INITIAL.
    MESSAGE I127(ZKC_MSGCLS).
    ELSE.
    SET SCREEN 2000.
    ENDIF.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    SET SCREEN 0.
    ENDCASE.
    endmodule.                 " USER_COMMAND_1000  INPUT
    Screen_2000:Code in PBO:
    module ctrl_pai output.
    MOVE-CORRESPONDING ITAB TO MAKT.
    endmodule.                 " ctrl_pai  OUTPUT
    Screen_2000:Code in PAI:
    module USER_COMMAND_2000 input.
    CASE SY-UCOMM.
    WHEN 'UPDATE'.
       LOOP AT TC1-cols INTO cols WHERE index GT 2.
           IF  cols-screen-input = '0'.
             cols-screen-input = '1'.
           ELSEIF  cols-screen-input = '1'.
             cols-screen-input = '0'.
           ENDIF.
           MODIFY TC1-cols FROM cols INDEX sy-tabix.
         ENDLOOP.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    SET SCREEN 0.
    WHEN 'BACK'.
    SET SCREEN 1000.
    ENDCASE.
    endmodule.                 " USER_COMMAND_2000  INPUT
    Screen_2000:Code outside PBO
    LOOP AT itab WITH CONTROL TC1 CURSOR TC1-TOP_LINE.
      MODULE ctrl_pai.
    ENDLOOP.
    Screen_2000:Code outside PAI
    LOOP AT itab.
    ENDLOOP.
    regards,
    vinod

    Hi,
    Go thro' the coding in this link.It will help you.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
    Message was edited by:
            Jayanthi Jayaraman

  • Unable to insert record in table

    Hi,
    I want to insert record in database table, but when I execute insert command(at When List changed trigger) as select from query and issue commit, the form trying to insert record from datablock which is obviously having empty items, how can I commit at database level not at form level.
    *******************Below the SQL Statement issued by Form******************
    INSERT INTO BILL_OF_MATERIALS_TABLE(PROJECTNO,GROUP_,ITEM,STATUS,QUANTITY,UNIT_PRICE,REASON_FOR_CHANGE,REMARKS,AWARD_COPY,LOCKED,VO_COPY) VALUES (:1,:2,:3,:4,:5,:6,:7,EMPTY_CLOB(),:9,:10,:11) RETURNING ROWID,PROJECTNO,GROUP_,ITEM,STATUS,QUANTITY,UNIT_PRICE,REASON_FOR_CHANGE,REMARKS,AWARD_COPY,LOCKED,VO_COPY INTO :12,:13,:14,:15,:16,:17,:18,:19,:20,:21,:22,:23
    ***************Error Raised by Form********
    ORA-01400: cannot insert NULL into ("CAPEX"."BILL_OF_MATERIALS_TABLE"."ITEM")

    Remember that when you write "commit;" within your forms code then Forms interprets it as a commit_form statement. That's why the form-level commit is launched as you mentionned.
    So if you want to make a database commit then I think that you should create a stored procedure which makes the insert , and you call this stored procedure within your forms code.
    Try it.

  • Unable to update records in Plan

    Hi
    I am trying the example oracle bam integration with Oracle AQ/Database
    As while updating myplan in design studio I am not getting any error but data also not inserted in my grid.
    when I hit update after 2 mins its displaying updated(2 min 33 seconds, 0 records).
    could anyone help me out with this issue?
    Regards,
    Ana
    Edited by: user10181991 on Dec 16, 2008 3:22 AM

    Grab your sid of the session that you are running via sys_context('USERENV','SID') or something else and then check out the wait events, and locks:
    select * from gv$lock where sid = <sid>;
    select * from gv$session_wait where sid = <sid>;P.S. Watch for triggers... YUCK!
    Message was edited by:
    JoeC

  • LSMW (PA40) successful but unable to update records in PA30

    Hi,
    I have tried running LSMW ( with external no range) in Fore ground mode. I can see that the data is getting properly picked from Excel sheet and in foreground mode, I am able to see this data getting into screens when i run LSMW last step.
    But actually when i go and check in tables and in PA30 if these employees are hired, there is no data.
    Can you please check the below --->
    My guess is while recording when we save 0,1,2 there should be some code written for "SAVE". In my recording BDC Code i ddint find any specific code. Can you check in your recordings if there is any special code for "SAVE" like BDC_OKCODE = "SAVE".
    Since there is no code written in my recording, i think this is the reason data is not getting saved.
    Can you let me know what needs to be done? If the above doubt is right, how to insert that in my BDC code.
    For your information-> U can find my BDC code pasted here.
    Recording REC7 M7
    PA40 Personnel Actions
    SAPMP50A 2000
    BDC_CURSOR T529T-MNTXT(01)
    BDC_OKCODE =PICK
    RP50G-PERNR PERNR Personnel Number
    RP50G-EINDA EINDA Entry Date
    RP50G-SELEC(01) X SELEC_01 Indicator for list sc
    BDC_SUBSCR /1PAPAXX/HDR_30060A
    MP000000 2000
    BDC_CURSOR PSPAR-PERSK
    BDC_OKCODE =UPD
    P0000-MASSN MASSN Action Type
    PSPAR-WERKS WERKS Personnel Area
    PSPAR-PERSG PERSG Employee Group
    PSPAR-PERSK PERSK Employee Subgroup
    MP000200 2010
    BDC_CURSOR Q0002-GESC1
    BDC_OKCODE =UPD
    Q0002-ANREX ANREX Form of address text
    P0002-NACHN NACHN Last Name
    P0002-VORNA VORNA First Name
    Q0002-PERID PERID Personnel ID Number
    P0002-GBDAT GBDAT Date of Birth
    Q0002-GESC1 GESC1 Gender key
    Q0002-GESC3 GESC3 Gender key
    BDC_SUBSCR SAPMP50A
    Thanks & Regards,
    Mamta
    Edited by: Mamta on Oct 28, 2008 7:58 PM
    Edited by: Mamta on Oct 28, 2008 7:59 PM

    Dear All,
    First of all I would like to answer all your questions.
    1. Yes, I tried LSMW by including PSPAR-PERNR PERNR Personnel Number in BDC code under MP000000 2000 too. Also, I did add the Perner again in the upload file too. In Read data mode I can see that Perner appeared twice as per our recording. In convert data Perner appeared only one. When I run last step of LSMW in foreground mode everything was perfect. But again when I go and check in PA30 there is no data.
    2. Yes, I did use PA40 for recording.
    3.  The sequence is 0000->0002->0001 while recording , in uploading file and in foreground mode too.
    4. When I run in foreground it appears like the regular Manual PA40 transaction.
    I donu2019t what might be causing this error. I would be glad to know your answers for the above issue.

  • Update records in table control BDC

    I am using BDC on table control in which I have to scroll the table. The table shows 4 rows by default. I want to enter values for the 1st and 6th row. I use =p+ OK code to scroll.
    When enter value for 6th row the value in the first row vanishes.
    Please suggest

    I have to perform f_bdc_dynpro for screen 'MP901200' '2000' repeatedly for scrolling
    perform f_bdc_dynpro      using 'MP901200' '2000'.
    perform f_bdc_field       using 'BDC_CURSOR'
                                  'PT9012-SALARYSCHED'.
    perform f_bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform f_bdc_field       using 'P9012-BEGDA'
                                  '19.01.2009'.
    perform f_bdc_field       using 'P9012-ENDDA'
                                  '31.12.9999'.
    perform f_bdc_field       using 'PT9012-PLANN'
                                  '1143'.
    perform f_bdc_field       using 'PT9012-SALARYSCHED'
                                  '01'.
    perform f_bdc_field       using 'PPHDX-ENTRY_IDX'
                                  '1'.
    Here I enter value for individual fields other than the table control.
    perform f_bdc_dynpro      using 'MP901200' '2000'.
    perform f_bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform f_bdc_field       using 'P9012-BEGDA'
                                  '19.01.2009'.
    perform f_bdc_field       using 'P9012-ENDDA'
                                  '31.12.9999'.
    perform f_bdc_field       using 'PT9012-PLANN'
                                  '1143'.
    perform f_bdc_field       using 'PT9012-SALARYSCHED'
                                  '01'.
    perform f_bdc_field       using 'PPHDX-ENTRY_IDX'
                                  '1'.
    perform f_bdc_field       using 'PT9012-DEGREE(01)'
                                  '03'.
    Here I enter value in the first row of table control.
    perform f_bdc_dynpro      using 'MP901200' '2000'.
    perform f_bdc_field       using 'BDC_OKCODE'
                                  '=p+'.
    perform f_bdc_field       using 'P9012-BEGDA'
                                  '19.01.2009'.
    perform f_bdc_field       using 'P9012-ENDDA'
                                  '31.12.9999'.
    perform f_bdc_field       using 'PT9012-PLANN'
                                  '1143'.
    perform f_bdc_field       using 'PT9012-SALARYSCHED'
                                  '01'.
    perform f_bdc_field       using 'PPHDX-ENTRY_IDX'
                                  '1'.
    here i scroll down to come to the sixth row.
    perform f_bdc_field       using 'BDC_OKCODE'
                                  '=/00'.
    perform f_bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform f_bdc_field       using 'P9012-BEGDA'
                                  '19.01.2009'.
    perform f_bdc_field       using 'P9012-ENDDA'
                                  '31.12.9999'.
    perform f_bdc_field       using 'PT9012-PLANN'
                                  '1143'.
    perform f_bdc_field       using 'PT9012-SALARYSCHED'
                                  '01'.
    perform f_bdc_field       using 'PPHDX-ENTRY_IDX'
                                  '6'.
    perform f_bdc_field       using 'PT9012-DEGREE(02)'
                                  '01'.
    Here I enter the value at second row as the 6th row is now the 2nd row after scrolling.
    but due to this the value in the first row vanishes.

  • Error in updating records brought by LOV

    Hi everybody
    I am using Oracle 10 g
    when fetching data from the database by choosing a specific record from LOV then trying to make "save" means "commit" I have this error
    FRM-40509: Oracle error: unable to update record
    I think there is a problem in mapping btw the record in the form and the cursor pointing to that record in the database because when i execute "next_recod" button after choosing one in LOV it go to the record next the one specified before choosing from LOV
    knowing that updating process working correctly when choosing by ("first_record, previous_record, next_record or last_record)
    so what is the solution
    please help
    thank you very much

    yes please
    I didn't know what do you mean by customized or default menu
    I build LOV using the wizard and bind it by a query to a table then make Show_LOV from the form
    so when I choose one of the rows and they brought to the text boxes assigend to them after that when I make "Commit" I got that error
    thank you for help
    and sorry for bieng late in reply, I don't have enternet after 2:00 pm

Maybe you are looking for

  • Blog Summary Page Loses Formatting of Entries

    Why does the main blog page dump any italic or bold formatting on the original entry page?? If I "Read More" and go to the original entry, all my italics show up fine... But the main page, from which I'd think most people will read my blog, is all wi

  • Data storage and read

    Hello all, I got a problem in data storage and read. I used the combination of "Open data storage", "Write data" and "Close data storage" to store some data as an array as shown below. And used the inverted combination to read data as shown below: As

  • I can't boot panther install cd on my PowerBook G4

    I have the Mac OS X 10.3.0 Install CDs, and I am trying to install it on my PowerBook G4 5,6. My PowerBook G4 came with 10.6.7. I can't find the original discs. When I try to install Panther on my PowerBook G4 it shows the gray apple for a second the

  • Dynamic variables' naming from SendAndLoad

    Hello, Been chasing my tail for almost 2days now, I'm having problems on how to load dynamically named variables and place it on dynamically named movieclips. I'm loading variables from php/mysql query thru sendAndLoad (no problem with that). The loa

  • Process of Withholding with Down payment

    hi friends i have gone through the earlier thread related to process of  withholding tax if there is a down payment but i am unable to understand, can anyone explain in detail what all are the postings i have to do. thanks