Update databse from internal table statement not using index

Hi Guys,
We are updating a databse table from a file. The file has a couple of fields which have data different from what the database has (non-primary fields :). We upload the file data into an internal table and then update the database table from internal table. At a time, internal table is supposed to have 10,000 records. I did SQL trace and found that the update statement is not making use of the databse index.
Should not the update statement here be using the table index (for primary key)?
Regards,
Munish

... as often there are recommendations in this forum which makes me wonder, how people overestimate their knowledge!!!
Updates and Deletes do of course use indexes, as can be seen in the SQL Trace (use explain).
Inserts don't use indexes, because in many databases inserts are just done somewhere, But also with the INSERT, the primary key is the constraint for the uniqueness condition, duplicate keys are not allowed.
Coming to the original question, what is you actually coding for the update?
What is the table, which fields are in the internal table and what are the indexes?
Siegfried

Similar Messages

  • How to update Records from Internal table to u2018Zu2019 table?

    Hi Friends,
    How to update Records from Internal table to u2018Zu2019 table.
    I have records in Internal table , that records want to update on u2018Zmarau2019 Table.
    ( my internal table & u2018 Zu2019 table structures are same.)
    Thanking you.
    Regards,
    Subash

    Hi,
    loop at internal table.
    modify <Z- table > from values < internal table Workarea>.
    if sy-subrc = 0.
      COMMIT work.
    else.
      ROLLBACK waork.
    endif.
    endloop.
    or
    UPDATE <Z- table > from table < internal table Workarea>.
    if sy-subrc = 0.
      COMMIT work.
    else.
      ROLLBACK waork.
    endif.
    Prabhudas

  • Creating a external content type for Read and Update data from two tables in sqlserver using sharepoint designer

    Hi
    how to create a external content type for  Read and Update data from two tables in  sqlserver using sharepoint designer 2010
    i created a bcs service using centraladministration site
    i have two tables in sqlserver
    1)Employee
    -empno
    -firstname
    -lastname
    2)EmpDepartment
    -empno
    -deptno
    -location
    i want to just create a list to display employee details from two tables
    empid firstname deptno location
    and same time update  in two tables
    adil

    When I try to create an external content type based on a view (AdventureWorks2012.vSalesPerson) - I can display the data in an external list.  When I attempt to edit it, I get an error:
    External List fails when attached to a SQL view        
    Sorry, something went wrong
    Failed to update a list item for this external list based on the Entity (External Content Type) 'SalesForce' in EntityNamespace 'http://xxxxxxxx'. Details: The query against the database caused an error.
    I can edit the view in SQL Manager, so it seems strange that it fails.
    Any advice would be greatly GREATLY appreciated. 
    Thanks,
    Randy

  • Update ztable from internal table

    I want to update the Ztable from internal table datas.
    what is the syntax to update.
    Its urgent send with coding example is better

    Hi
    PARAMETERS: p_carrid TYPE sflight-carrid,
                percent(1) TYPE p DECIMALS 0.
    DATA sflight_tab TYPE TABLE OF sflight.
    FIELD-SYMBOLS <sflight> TYPE sflight.
    SELECT *
           FROM sflight
           INTO TABLE sflight_tab
           WHERE carrid = p_carrid AND
                 fldate = sy-datum.
    IF sy-subrc = 0.
      LOOP AT sflight_tab ASSIGNING <sflight>.
        <sflight>-price =
          <sflight>-price * ( 1 - percent / 100 ).
      ENDLOOP.
    ENDIF.
    <b>UPDATE sflight FROM TABLE sflight_tab.</b>
    Thanks
    Vijay
    PLZ reward points if helpful

  • Update value from internal table into table control

    hi friends,
    i have two text field and a button in a screen.if give the value and click the button it should get updated in the table control which is in the next screen.plz
    help me with some sample coding.

    hi Karthik ,
    Here you go with the sample coding of moving internal table values to table control on module pool programs :
    in screen painter flow-logic ............
    process before output.
    module status_3000.
    loop at g_tab_con_01_itab
         into g_tab_con_01_wa
         with control tab_con
         cursor tab_con-current_line.
    module tab_con_move.
    endloop.
    process after input.
    module exit at exit-command.
    module user_command_3000.
    module clear_ok_code.
    loop at g_tab_con_01_itab.
    module read_tab_con.
    endloop.
    in your program .............
    include z_tab_ctrl_top                          .    " global Data
    program  z_tab_ctrl.
    tables : sflight,sbook,zsflight.
    types:begin of t_tab_con_01 ,
            carrid like sflight-carrid,
            connid like sflight-connid,
            sel type c,
           end of t_tab_con_01.
    data: g_tab_con_01_itab type  t_tab_con_01 occurs 0 with header line,
          g_tab_con_01_wa type t_tab_con_01,
          g_tab_con_01_copied ,
          g_tab_con_01_lines like sy-loopc,
          ok_code like sy-ucomm,
          lines type i,
          init ,
          fill type i.
    controls: tab_con type tableview using screen 3000.
    module status_3000 output.
      set pf-status 'ST100'.
      set titlebar 'T100'.
    endmodule. 
    module update_table_control input.
      describe table g_tab_con_01_itab lines tab_con-lines.
    endmodule.  
    module exit input.
      ok_code = sy-ucomm.
      if ok_code eq 'BACK' or ok_code eq 'EXIT' or ok_code eq 'CANCEL'.
        leave program .
      endif.
    endmodule.        
    module clear_ok_code input.
    clear ok_code.
    endmodule.      
    module fill_tab_con output.
    read table g_tab_con_01_itab into zsflight index tab_con-current_line.
    endmodule.                 " fill_tab_con  OUTPUT
    module read_tab_con input.
    *lines = sy-loopc.
    read table g_tab_con_01_itab into g_tab_con_01_wa index tab_con-current_line.
    if sy-subrc eq 0.
    move-corresponding sflight to g_tab_con_01_wa.
    modify g_tab_con_01_itab from g_tab_con_01_wa index tab_con-current_line.
    else.
    move-corresponding sflight to g_tab_con_01_wa.
    append g_tab_con_01_wa to g_tab_con_01_itab.
    endif.
    module tab_con_move output.
    move-corresponding g_tab_con_01_wa to sflight.
    endmodule.                 " tab_con_move  OUTPUT
    module tab_con_get_lines output.
    g_tab_con_01_lines = sy-loopc.
    endmodule.                 " tab_con_get_lines  OUTPUT
    module tab_con_modify input.
    move-corresponding sflight to g_tab_con_01_wa.
      modify g_tab_con_01_itab
          from g_tab_con_01_wa
          index tab_con-current_line.
    endmodule.                 " tab_con_modify  INPUT
    module populate_tab_ctrl input.
    if sy-subrc eq 0.
    endif.
    endmodule.
    Look at the following modules in the above program ....
    fill_tab_con
    tab_con_modify
    tab_con_get_lines
    update_table_control
    This will definately solve your problem or give an idea for solution ....
    reward if helpful,
    Regards,
    Ranjita

  • "Tables are not using indexes"-Please help

    We have a new database , version
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.1.0 - Productio
    NLSRTL Version 10.2.0.1.0 - Production
    We have created Indexes for the tables and analysed the table. Problem is , non of the tables are using indexes. Explain paln for the sql queries are showing full table scan.
    Kindly let me know any parameter I have to change or is there any setttings needed on database level?
    Thanks in advance.
    Regards,
    Chotu

    What is your optimizer mode?
    Another question why you want to use indexes? Use of indexes depends,
    Here is a simple example
    test@>ed
    Wrote file afiedt.buf
      1  explain plan for
      2  select c.cname from mytable c, mytable1 m
      3* where c.cname=m.cname
    test@>/
    Explained.
    test@>SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
    PLAN_TABLE_OUTPUT
    Plan hash value: 2460944079
    | Id  | Operation         | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |              |     8 |    64 |     1   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS     |              |     8 |    64 |     1   (0)| 00:00:01 |
    |   2 |   INDEX FULL SCAN | C_MYTAB_IDX  |     8 |    32 |     1   (0)| 00:00:01 |
    |*  3 |   INDEX RANGE SCAN| C_MYTAB1_IDX |     1 |     4 |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - access("C"."CNAME"="M"."CNAME")
    15 rows selected.
    test@>explain plan for
      2  select * from mytable;
    Explained.
    test@>SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
    PLAN_TABLE_OUTPUT
    Plan hash value: 1229213413
    | Id  | Operation         | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |         |     8 |    32 |     3   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| MYTABLE |     8 |    32 |     3   (0)| 00:00:01 |
    8 rows selected.As you see MYTABLE has an index but it not always uses that index it depends on the need.
    sql queries are showing full table scan this is a not a curse. So unless you are having some problem. You should not change queries only because to avoid full table scans, there is no rule that indexes should always be used in every case.
    Adith

  • Records from multiple table in Forms using Structure

    Hi all,
    I thought of bringing records from more than one table to smart forms.I have done the same by using two internal tables but not using with globally declared structure.Is it like this:
    1.Create the global structure
    2.In driver program create a internal table
    3.Pull the data using select statement
    4.Pass the internal table to smartforms-> Here I dont understand how.Usually In smartforms we declare internal tables of table type like 'itable type zgkmaster'
    How to pass the internal table we created using structure to smartforms?
    Thanks

    Hi Gopi,
    the procedure u r telling is correct.
    create the structure(ex:zstruc) in se11 as the structure of the internal table.
    *popluate the data into internal table.
    *in smartform, u declare the internal table as that structure i.e itab type zstruc.
    i.e in smartforms when u declare internal table, u r telling that ur internal table having the structure similar to the structure ZSTRUC.
    In smartforms u can declare the table type using either ...type <db table> or ... type <structure>.
    san

  • Can not insert or update [TABLE] from internal table in method

    I've faced a problem with OO abap. I've tried to insert into [ TABLE ] from internal table, but i've got error msg after i compiled.
    "An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""
    After  i changed to loop in work area and INSERT INTO  [TABLE] VALUES gw_data., everything is fine, can compile and run.
    This is error code.
      METHOD set_data_to_table.
        REFRESH gi_data.
        CLEAR gi_data.
        IF gi_file[] IS NOT INITIAL.
    * Set data for modify table
          LOOP AT gi_file INTO gw_file.
            MOVE-CORRESPONDING gw_file TO gw_data.
            me->conversion_input( EXPORTING im_vendor = gw_data-vendor
                                  CHANGING  ch_vendor = gw_data-vendor ).
            APPEND gw_data TO gi_data.
          ENDLOOP.
          INSERT [TABLE] FROM TABLE gi_data.
    *      LOOP AT gi_data INTO gw_data.
    *        INSERT INTO  [TABLE] VALUES gw_data.
    *        IF sy-subrc = 0.
    *          COMMIT WORK.
    *        ELSE.
    *          ROLLBACK WORK.
    *        ENDIF.
    *      ENDLOOP.
        ELSE.
          MESSAGE 'No data found' TYPE 'I'.
        ENDIF.
      ENDMETHOD.                    "set_data_to_table

    Hi Matthew,
    I think there is no difference in database insert between OO and non-OO.
    The correct syntax according to ECC600 online documentation is
    [Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]
    To insert several lines into a database table, use the following:
    INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].
    This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.
    Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.
    I think the syntax
    INSERT my_dbtable FROM TABLE gi_data.
    should work, your suggestion may lead to syntax error.
    Regards,
    Clemens

  • Updating database table from internal table

    I am updating the database table from internal table for this is have used the following syntax
    Update kna1 from table itab.
    And it is giving error message as the work are itab is not long enough.
    Please help me.

    Hi,
       Refer this code
    *&      Form  SUB_READ_UPDATE_BSEG
          text
    FORM sub_read_update_bseg.
      IF NOT it_final[] IS INITIAL.
        LOOP AT it_final INTO wa_final.
          UPDATE bseg SET zuonr = wa_final-ccnum
                      WHERE bukrs EQ wa_final-bukrs
                      AND   belnr EQ wa_final-vbeln
                      AND   rfzei EQ wa_final-rfzei
                      AND   saknr NE ' '.
        ENDLOOP.
    *--Message data updated successfully
        MESSAGE i888 WITH text-002.
        LEAVE LIST-PROCESSING.
      ELSE.
    *--Message No data found
        MESSAGE i888 WITH text-003.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " SUB_READ_UPDATE_BSEG
    Regards,
    PRashant

  • Two collect statement from internal table

    Dear Experts,
    I want populate values to two internal tables from a internal table.
    can i use two collect statement for different internal table from a single internal table.
    advise please.
    Thanks in advance.
    R.Rajendran

    hi there....
    well u can very well use this thing.....
    use the two colect statements inside the loop which u will use  to read the records of the input table.
    hope it helps.
    do reward if it does.

  • How to update whole external table(in ABAP dictionary) from internal table at once

    Hi,
    How can I update the content of the external table (in ABAP dictionary) from the content of internal table data at once. I created the internal tables with out the header line, with the work area. I tried UPDATE TARGET_EXTERNAL_TABLE FROM TABLE INTERNAL_TABLE. But it returns 4 for sy-subrc and did not work.
    Thank you
    Regards.
    CHINTHAKA

    Hi Feiyun Wu,
    Thank you very much. Your code worked. Is there any way to replace the whole content of the external table from internal table data ?
    Regards,
    Chinthaka

  • Downloading data from internal table to xls file leading zeros are not disp

    Hai abap gurus,
    when i am downloading data from internal table to excle file. some field values in a column are with leading zeros and some others dont have leading zeros.but in the output it is showing without leading zeros. then how to get with exact values.
    Ex:
    <b>ECC Code.</b>
    045234
      88567
    098456 
    but output is giving like this:
    45234
    88567
    98456
    how to get the actual values.....
    plz help me in this matter.

    Dear Kiran,
    Those field in the internal table having Leading Zeroes, make those fields' datatype as character.
    Then use the function module to download the content of the internal table to the excel file.
    Regards,
    Abir
    Don't forget to Reward Points  *

  • Modify database table from internal table

    Hi All,
    I need to update database table from internal table which is having around 30000 records.
    I am using MODIFY tabname FROM TABLE int_tabname...
    Using this statement, I can modify the databse records very well. But user has some additional requirement.
    He wants that the table should be modified from the internal table and after modification we should have the erroneous records to be displayed if any.
    e.g. if 1500 records out of 30000 are erroneous then only 28500 records should be updated and 1500 records should be displayed as erroneous records so that the user can correct them and use them again for executing the program.
    Is there any FM which imports the database table name and internal table, modifies the database and exports an internal tanle with erroneous records?
    Any help will be appriciated,
    Regards,
    Neha

    Hi
    modifying datbase table useing internal table
    <b>advises</b> before updating this datbase table plz lock that table to avoid incosistency
    write the logic for modifying
    Modify the database table as per new dunning procedure
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    and finally unlock the table
    <b>example</b>
    *To lock table for further operations
      constants: lc_tabname TYPE  rstable-tabname  VALUE 'FKKVKP'  . "FKKVKP
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          tabname        = lc_tabname
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc EQ 0.
      To fetch all the contract accounts for customers of the segment
      Households/SME.
        PERFORM fetch_contract_accounts using lc_tabname .
      ENDIF.                    " IF sy-subrc EQ 0.
    *wrote the logic
    Modify the database table as per new dunning procedure from internal table
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    *unlock the tbale
      CALL FUNCTION 'DEQUEUE_E_TABLE'
       EXPORTING
         TABNAME   =  uc_tabname .
    <b>Reward if usefull</b>

  • To get recent timestamp records from internal table

    hi all,
      i have one requirment
      i'm storing error messages in one table  while creating a sales order basing on timestamp
      which is of this format yyyy-mm-dd hh:mm:ss (random Number) 
      if i want to see the error messages left i'm getting all the error messages displayed
      for example i have created a sales order
    i got 10 errors displayed
    i have rectified 5 errors ... if i again display error messages the 10 errors + the 5 errors is getting displayed
    i want to display the 5 error messages only not the previous messages from internal table
    basing on timestamp current one has to displayed remaining has to deleted from internal table.

    I thought we used Sales Order Incompletion process for this....  but, if you're recreating the errors list every time you save with a create or change transaction then, at save, delete all rows in your error table for this document.   Then get your errors and update your db table from your current errors table.   From this viewpoint, the timestamp is not relevant.

  • Import from internal table

    Dear Experts,
    I need a solution for importing from an internal table.
    Two variables I_EXP01 and I_EXP02 containing an xml stream have been exported to the database using the following syntax
    and depending on the size of I_EXP01 and I_EXP02 two or more entries are created in table LTEX.
    EXPORT
             L_SAPRL
             I_EXP01
             I_EXP02
    TO    DATABASE LTEX(LT)
                           ID LS_LTEXKEY.
    But now i have a few entries of table LTEX in an internal table and they need to be imported from the internal table.
    What would be the syntax to import from internal table so that after importing I can de-serialise the data from XML to ABAP.
    Thanks & Regards,
    Ashwini

    Try this and let me know if it works:
    IMPORT
    L_SAPRL
    I_EXP01
    I_EXP02
    To
    L_SAPRL1 (same type as above)
    I_EXP011 (same type as above)
    I_EXP021 (same type as above)
    FROM DATABASE LTEX(LT)
    ID LS_LTEXKEY.
    if it is not working. try using seperate statements for each internal table and see.
    Thanks,
    Venkatesh.
    Edited by: venkatesh333 on Jul 27, 2011 6:23 AM

Maybe you are looking for

  • How to control internet sharing via MAC access control list?

    Hello, I know how to share the internet over the Wi-Fi. I know that there could be a password. But I need to control users by MAC addresses, just like in the routers. So, I want to give an access ONLY to a several MAC addresses which I'll write in so

  • Nvidia card giving me same trouble as Ati card

    Okay, originally I was using a Radeon 9500 Pro video card.  The problem was that anything OGL accelerated completely froze my system; I couldn't run glxgears without it freezing.  I tried and tried and tried to find a solution to the problem, using t

  • Dreamweaver (8) is deleting my saved passwords, help!

    Yes, Dreamweaver 8 has started deleting saved passwords when I restart. I have hit save, I know.. it's done it twice with the same site today. This is so annoying, I go to upload and FTP info is invalid and the username and password are missing (from

  • Can't update mini pro to ICS

    Hi can somebody please help me i would really appreciate it !! I have a Sony Ericsson Xperia Mini Pro my Software update is (2.3.4) Sony say the Latest available software is(4.1.B.0.587) However i can not download this software BECAUSE Pc Companion i

  • Forgotten Security Code - Nokia 701

    i am using nokia 701 and i am forgot restore security code  please help Moderator's Note: The subject was amended as the post was moved the most appropriate board. Solved! Go to Solution.