Problem in modifying a table through modify statement

Hi,
I am trying to update a 'Z' table in which there are 5 fields comprising of primary key. Out of them 2 key fields are defined as a part of seconadry index with 'Unique' option selected.
As per the requirement, I am trying to update the table using modify statement so whenever this statement occurs it will check the primary keys and accordingly try to modify a record or insert a new record.
But as there is Unique Index defined on 2 of the key fields the Modify query is

Hi,
Your syntax for MODIFY is not correct.
As other friends suggested you can have index and you can modify the internal table.
Whenever we are modifying internal table inside LOOP, we can omit index as system will take current row by default. So MODIFY statement should be written as follows:
MODIFY T_ITPO5 from W_ITPO5 transporting AUFNR
You can LOOP FROM INDEX also for the same to improve performance.
data: wv_index like sy-tabix.
sort T_ITPO5 by aufnr.
sort T_ITPO4 by aufnr.
wv_index = 1.
LOOP AT T_ITPO5 INTO W_ITPO5.
     LOOP AT T_ITPO4 INTO W_ITPO4 from wv_index.
     if W_ITPO4-aufnr eq W_ITPO5-aufnr.
          IF ITPO4-NTGEW 0 .
              CALL FUNCTION 'ZGET_ITEM_WEIGHT'
                EXPORTING
                   P_BUID = W_ITPO4-WERKS
                   P_ITEMID = W_ITPO4-MATNR
                   P_QTY = 1
                   P_UOM = W_ITPO4-MEINS
                   P_UOM1 = 'KG'
               IMPORTING
                  P_RETVAL = W_ITPO4-WTKG.
TOTWT1 = W_ITPO4-WTKG * W_ITPO4-MENGE.
IF W_ITPO4-BWART = '261'.
W_ITPO5-I_QTY = W_ITPO5-I_QTY + TOTWT1.
ELSEIF W_ITPO4-BWART = '101' OR W_ITPO4-BWART = '531'.
W_ITPO5-I_QTY = W_ITPO5-I_QTY - TOTWT1.
ENDIF.                    " IF W_ITPO4-BWART = '261'.
endif.
elseif W_ITPO4-aufnr gt W_ITPO5-aufnr.
   move sy-tabix to wv_index.
   exit.
endif.                      " if W_ITPO4-aufnr eq W_ITPO5-aufnr.
ENDLOOP.
MODIFY T_ITPO5 FROM W_ITPO5 transporting aufnr.
ENDLOOP.

Similar Messages

  • Problem in Insertion into table through After Report Parameter form trigger

    Hi All,
    I am getting problem in inserting some data into temp table through Report.
    My requirement is like that, I have to do a calculation based on user parameters, and then insert the data into the temp table. I wanted to do this into After Report Parameter form trigger function. I have done all the calculation and wrote all the insert statement in that function. There is no problem in compilation. then I am taking value from this temp table in my formula columns.
    When I run this report, it hangs, don't understand what is the problem.Can anybody help me out in this.
    Thanks,
    Nidhi

    The code is as follows:
    function AfterPForm return boolean is
    CURSOR CUR_RECEIPT(RECEIPT_NUM_FROM NUMBER, RECEIPT_NUM_TO NUMBER) IS
    SELECT DISTINCT receipt, item_no FROM xxeeg.xxeeg_1229_sp_putaway WHERE RECEIPT BETWEEN
    RECEIPT_NUM_FROM AND RECEIPT_NUM_TO ;
    V_CUR_RECEIPT CUR_RECEIPT%ROWTYPE;
    begin
    OPEN CUR_RECEIPT(:RECEIPT_NUM_FROM, :RECEIPT_NUM_TO);
    FETCH CUR_RECEIPT
    INTO V_CUR_RECEIPT;
    LOOP
    EXIT WHEN CUR_RECEIPT%NOTFOUND;
    IF V_CUR_RECEIPT.ITEM_NO = 'TEST1' AND V_CUR_RECEIPT.RECEIPT = '12' THEN
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 12
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 13
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 14
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    ELSE
    IF V_CUR_RECEIPT.ITEM_NO = 'TEST2' AND V_CUR_RECEIPT.RECEIPT = '12' THEN
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 16
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 17
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO =V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 18
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    ELSE
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 19
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 20
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO =V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 21
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    END IF;
    END IF;
    END LOOP;
    COMMIT;
    CLOSE CUR_RECEIPT;
    return(TRUE);
    end;
    .....................................................................................................................

  • Modifying database table through ALV-Grid

    Hi all.
    I need to modify a database table (ZNG_SO_HEAD) by entering data in ALV-Grid, which displays its internal table (exact  copy of ZNG_SO_HEAD), and clicking the button ('CHANGE') on the ALV-toolbar. The ALV is already editable, the button already exists. Here is the code. After changing data in ALV and clicking 'CHANGE' on the toolbar the database table ZNG_SO_HEAD remains unchangeable, but i need to change data in it somehow.
    Thanks all.
    REPORT  zng_alv_tc_edit_simp.
    *-- GLOBAL DATA DECLARATIONS FOR ALV
    DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.
    DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
    DATA gr_ccontainer TYPE REF TO cl_gui_custom_container.
    DATA gt_fieldcat TYPE lvc_t_fcat.
    DATA gs_layout TYPE lvc_s_layo.
    TABLES: zng_so_head, zng_cust, zng_vendors.
    *-- STRUCTURE OF INTERNAL TABLE
    TYPES: BEGIN OF in_tab,
            mandt TYPE zng_so_head-mandt,
            so_num TYPE zng_so_head-so_num,          "type numc
            vend_num TYPE zng_so_head-vend_num,      "type numc
            cust_num TYPE zng_so_head-cust_num,      "type numc
            so_date TYPE zng_so_head-so_date,        "type dats
           END OF in_tab.
    *-- INTERNAL TABLE HOLDING LIST DATA
    DATA res_tab TYPE TABLE OF in_tab WITH HEADER LINE.
    *DATA wa_res_tab LIKE LINE OF res_tab.
    *-- FILLING IN INTERNAL TABLE
    SELECT h~mandt h~so_num h~vend_num h~cust_num h~so_date
    INTO TABLE res_tab FROM zng_so_head AS h.
    *       CLASS lcl_event_handler DEFINITION
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS:
    *   to add new functional buttons to the alv toolbar
        handle_toolbar
          FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING e_object
                      e_interactive,
    *   to implement user commands
        handle_user_command
          FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING e_ucomm.
    ENDCLASS.             "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD handle_toolbar.
        DATA: ls_toolbar TYPE stb_button.
        MOVE 3 TO ls_toolbar-butn_type.
        CLEAR ls_toolbar.
        MOVE 'CHANGE' TO ls_toolbar-function.
        MOVE icon_change TO ls_toolbar-icon.
        MOVE 'change' TO ls_toolbar-quickinfo.
        MOVE 'change' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.                    "handle_toolbar>
      METHOD handle_user_command.
        DATA:l_valid TYPE c.
        CASE e_ucomm.
          WHEN 'CHANGE'.
            CALL METHOD gr_alvgrid->check_changed_data
              IMPORTING
                e_valid = l_valid.
            IF l_valid = 'X'.
              MODIFY zng_so_head FROM res_tab.
            ENDIF.
        ENDCASE.
      ENDMETHOD. "handle_user_command
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    DATA object_ref TYPE REF TO lcl_event_handler.
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
    >>>>>>done correctly>>>>>>>>>
    FORM display_alv.
    >>>>>>done correctly>>>>>>>>>
    START-OF-SELECTION.
      CALL SCREEN 100.
    *  MODULE STATUS_0100 OUTPUT
    MODULE display_alv OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
      PERFORM display_alv.
      CREATE OBJECT object_ref.
      SET HANDLER object_ref->handle_toolbar FOR gr_alvgrid.
      SET HANDLER object_ref->handle_user_command FOR gr_alvgrid.
    ENDMODULE.                    "display_alv OUTPUT
    *  MODULE USER_COMMAND_0100 INPUT
    MODULE user_command_0100 INPUT.
    IF sy-ucomm = 'BACK' OR
         sy-ucomm = 'EXIT' OR
         sy-ucomm = 'CANCEL'.
        LEAVE PROGRAM.
      ELSE.
        CALL METHOD object_ref->handle_toolbar.
        CALL METHOD object_ref->handle_user_command.
      ENDIF.
    ENDMODULE.

    Hello Nikolai,
    I have written a sample code taking care of all the requirements(button in the toolbar and changes saved in database).I have used SPFLI table and the internal table i_spfli.This code works and the change is also made in the database table.
    REPORT  SAMPLE.
    *-- GLOBAL DATA DECLARATIONS FOR ALV
    DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid.
    DATA gc_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
    DATA gr_ccontainer TYPE REF TO cl_gui_custom_container.
    DATA gt_fieldcat TYPE lvc_t_fcat.
    DATA gs_layout TYPE lvc_s_layo.
    Data:i_spfli type table of spfli.
          CLASS lcl_event_handler DEFINITION
    CLASS lcl_event_handler DEFINITION.
      PUBLIC SECTION.
        DATA:l_valid TYPE c.
         DATA: ls_toolbar TYPE stb_button.
        METHODS:
      to add new functional buttons to the alv toolbar
        handle_toolbar
          FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING e_object
                      e_interactive,
      to implement user commands
        handle_user_command
          FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING e_ucomm.
    ENDCLASS.             "lcl_event_handler DEFINITION
          CLASS lcl_event_handler IMPLEMENTATION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD handle_toolbar.
      CLEAR ls_toolbar.
        MOVE 0 TO ls_toolbar-butn_type.
        MOVE 'CHANGE' TO ls_toolbar-function.
        MOVE 'ICON_CHANGE' TO ls_toolbar-icon.
        MOVE 'change' TO ls_toolbar-quickinfo.
        MOVE 'change' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.                    "handle_toolbar>
      METHOD handle_user_command.
        CASE e_ucomm.
          WHEN 'CHANGE'.
            CALL METHOD gr_alvgrid->check_changed_data
              IMPORTING
                e_valid = l_valid.
            IF l_valid = 'X'.
              MODIFY spfli FROM table i_spfli.
            ENDIF.
        ENDCASE.
      ENDMETHOD. "handle_user_command
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    START-OF-SELECTION.
    DATA object_ref TYPE REF TO lcl_event_handler.
    select * from spfli into table i_spfli.
    Call screen 100.
    MODULE STATUS_0100 OUTPUT
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
      PERFORM display_alv.
    ENDMODULE.                    "display_alv OUTPUT
    MODULE USER_COMMAND_0100 INPUT
    MODULE user_command_0100 INPUT.
    IF sy-ucomm = 'BACK' OR
         sy-ucomm = 'EXIT' OR
         sy-ucomm = 'CANCEL'.
        LEAVE PROGRAM.
      ENDIF.
    ENDMODULE.
    *& Form display_alv
    FORM display_alv.
    *IF gr_alvgrid IS INITIAL.
    CREATE OBJECT gr_ccontainer
    EXPORTING container_name = gc_custom_control_name.
    CREATE OBJECT gr_alvgrid
    EXPORTING i_parent = gr_ccontainer.
    PERFORM prepare_field_catalog CHANGING gt_fieldcat.
    CREATE OBJECT object_ref.
      SET HANDLER object_ref->handle_toolbar FOR gr_alvgrid.
      SET HANDLER object_ref->handle_user_command FOR gr_alvgrid.
    CALL METHOD gr_alvgrid->set_table_for_first_display
    EXPORTING
    is_layout = gs_layout
    CHANGING
    it_outtab = i_spfli[]
    it_fieldcatalog = gt_fieldcat.
    ENDFORM. "display_alv
    *& Form prepare_field_catalog
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
    DATA ls_fcat TYPE lvc_s_fcat.
    ls_fcat-fieldname = 'CARRID'.
    ls_fcat-ref_table = 'SPFLI'.
    ls_fcat-edit = 'X'.
    APPEND ls_fcat TO pt_fieldcat.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'CONNID'.
    ls_fcat-ref_table = 'SPFLI'.
    ls_fcat-edit = 'X'.
    APPEND ls_fcat TO pt_fieldcat.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'DEPTIME'.
    ls_fcat-ref_table = 'SPFLI'.
    ls_fcat-edit = 'X'.
    APPEND ls_fcat TO pt_fieldcat.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'ARRTIME'.
    ls_fcat-ref_table = 'SPFLI'.
    ls_fcat-edit = 'X'.
    APPEND ls_fcat TO pt_fieldcat.
    CLEAR ls_fcat.
    endform.
    Hope this helps.
    Regards,
    Beejal

  • How to modify  a table without  setting system to modifiable

    Hi All
    Is there a way to modify a table without setting the system to modifiable either in SCC4 or SE06.
    We locked SCC4 in our system , however one tables are not able to modify.
    table name YAUTM
    Is there a way to bypass this?
    Edited by: Shou Woon Wee on Jan 11, 2008 3:09 AM

    Hi Shou......
    if it gives you a message....."the client is not modifiable"/ ALIAS "table not modifiable"  ...then from a security perspective....you cant, and you might not want to bypass it!
    SCC4 settings are meant to be for that!  Contact your Basis team for this.
    The only way to bypass this is thru ....sending changes through a transport request.
    Curiosity: what environment are you trying this out ? cant be sandbox or DEV!
    Regards
    Abhishek

  • Passing internal table through Submit

    Hi,
    How do i pass an internal table through Submit statement.
    i dnt want to declare a select-options for this purpose.
    Is ther any other way??
    Answers will be rewarded
    Regards,
    Rohan

    Hello Rohan...
    to export a table use the following
    DATA: wa_indx TYPE indx.
      EXPORT tab = itab TO DATABASE indx(xy) FROM wa_indx CLIENT
      SY-MANDT
      ID 'DETAILLIST'.
    to import use this
    imports from database the list sent by the calling program
      IMPORT tab = itab FROM DATABASE indx(xy) TO wa_indx CLIENT sy-mandt
      ID 'DETAILLIST'.
    deletes the data to save wastage of memory
      DELETE FROM DATABASE indx(xy)
        CLIENT sy-mandt
        ID 'DETAILLIST'.

  • Cannot modify more than one base table through a join view

    hi guys, my current problem is that i have a datablock based on a view, now all the fields bar 1 are updateable, but this one field that is obtained through a join is displayed, the user can enter data in this field which then pupulates other fields which are required, but this specific field should not be updated. Is there an option to state this as i keep getting the error:
    cannot modify more than one base table through a join view
    Any help would be greatly appreciated, thanks.

    the user can enter data in this field which then pupulates other fields So, using the value of "this field" you then query the rest of the fields? Can you show us the code you use to populate the rest of the fields?
    but this specific field should not be updatedHave you tried setting the "Query Only" property of the field to "Yes" and the other DML properties (Ins, Upd, Del) to No?
    Also, what is your Forms version?
    Thanks,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • ORA-01776: cannot modify more than one base table through a join view

    I have created EO based on a database view than consists of two tables, and only one is updateable.
    When I try to update a row using EO, I got a following message: "ORA-01776-cannot modify more than one base table through a join view"
    In Forms, this issue is resolved by setting "Query Only" property of non-updateable items to "True".
    Is it possible to do something like that in ADF BC?
    Thanks

    Thanks for answer.
    When I set "updateable" property to "Never", that attribute is protected from any change.
    I'm sorry for incomplete usecase.
    I have set up a list of value on that attribute, because it is a lookup field for another table and I need to get an ID from that table.
    Basically, I need that attribute to be updateble for BC, but not for database.
    Edited by: MarioK on Oct 13, 2011 9:28 AM

  • How to Access oracle DB table through SAP..problem in code

    Hello Guys
             I have to Access oracle table through SAP and need to create a report.
    From Some source I got the following code .  But it's not working , I am not able to update the table as well not able to access the data from table.
    Can some one provide me the necessary help.
    REPORT  ZORACLE.
    INCLUDE ole2incl.
    DATA: con TYPE ole2_object,
    rec TYPE ole2_object.
    DATA SQL(1023).
    DATA: BEGIN OF SPL OCCURS 0,
    VAL(1023),
    END OF SPL.
    DATA: BEGIN OF I1 OCCURS 0,
    F1(10) ,
    F2 TYPE I,
    END OF I1.
    IF con-header IS INITIAL OR con-handle = -1.
    CREATE OBJECT con 'ADODB.Connection'.
    IF NOT sy-subrc = 0.
    EXIT.
    ENDIF.
    CREATE OBJECT REC 'ADODB.Recordset'.
    IF NOT sy-subrc = 0.
    EXIT.
    ENDIF.
    ENDIF.
    MDB connetion infomations ....
    break-point.
    CONCATENATE 'Provider=' '''OraOLEDB.Oracle''' ';'
    INTO SQL.
    CONCATENATE SQL 'Password=' '''prodx''' ';'
    INTO SQL.
    CONCATENATE SQL 'User ID=' '''prod''' ';'
    INTO SQL.
    CONCATENATE SQL 'Data Source=' '''sterlite''' ';'
    INTO SQL.
    CONCATENATE SQL 'Mode=' '''Share Deny None'''
    INTO SQL.
    MDB connection ...
    CALL METHOD OF CON 'Open'
    EXPORTING #1 = SQL.
    Query (insert) statement ...
    SQL = 'insert into ofusers values('.
    CONCATENATE SQL '''Atul''' ',' '''121''' ')' INTO SQL.
    Query run ...
    CALL METHOD OF REC 'Open'
    EXPORTING #1 = SQL
    #2 = CON
    #3 = '1'.
    Query (select) statement ...
    SQL = 'select * from ofusers'.
    Query run ...
    CALL METHOD OF REC 'Open'
    EXPORTING #1 = SQL
    #2 = CON
    #3 = '1'.
    Selecting MDB record into SAP internal table ...
    DO.
        CALL METHOD OF REC 'getstring' = SQL
        EXPORTING #1 = '2' "Do not modify!
        #2 = 1 "Do not modify!
        #3 = '|' "Do not modify!
        #4 = '|'. "Do not modify!
        IF sy-SUBRC EQ 0.
            REFRESH SPL. CLEAR SPL.
            SPLIT SQL AT '|' INTO TABLE SPL.
            LOOP AT SPL.
              CASE SY-TABIX.
                WHEN 1.
                  I1-F1 = SPL-VAL.
                WHEN OTHERS.
                  I1-F2 = SPL-VAL.
              ENDCASE.
            ENDLOOP.
              APPEND I1. CLEAR I1.
            ELSE.
              EXIT.
        ENDIF.
    ENDDO.
    Result writing ...
    LOOP AT I1.
      WRITE: AT /1(10) I1-F1,
      AT (10) I1-F2.
    ENDLOOP.
    connetion close & destroy
    FREE OBJECT con.
    FREE OBJECT rec.
    Thanks in Advance
    Swati Namdeo

    Hi swati,
    1. for this u will also require help of basis team.
    2. these are the steps.
    a) make an entry in DBCON
    b) make connection string
    (on the physical application server,
    so that it can connect to secondary database)
    (this will be done by basis team,
    in which, they will specify the
    IP address of the secondary database server,
    the DATABASE ID, and the port number)
    c) then using open sql / native sql,
    we can use the secondary database connection,
    just like normal.
    d) if we use open sql,
    then there must be Y/Z table on
    sap as well as secondary database,
    and the field names , their type all should be identical.
    regards,
    amit m.

  • Issue in Modifying custom table

    Hi Experts
    Program Y00_MM modifying custom table Y00_IFS074 using internal table.
    we have a sales company code field in table.
    Internal table company code value is 00021345 .
    But in custom table it updated as 21345. It should be 00021345.
    few days back no problem with table updation. Now only i'am getting this issue. There is no changes in Report.
    Kindly help me.

    Hi,
    Please use the below FM for the field BUKRS.
    FM : CONVERSION_EXIT_ALPHA_OUTPUT.
    This FM will add the leading zeros according to the field length.
    Hope this will resolve your problem...

  • How to modify a table?

    hi
    i want to modify a table
    how do i write the command if i want to modify it according to the table's keys ????
    thanks

    Hi,
    To change a single line, use the following statement:
    MODIFY TABLE <itab> FROM <wa> [TRANSPORTING <f1> <f 2> ...].
    The work area <wa>, which must be compatible with the line type of the internal table, plays a double role in this statement. Not only it is used to find the line that you want to change, but it also contains the new contents. The system searches the internal table for the line whose table key corresponds to the key fields in <wa>.
    The system searches for the relevant lines as follows:
    Standard tables
    Linear search, where the runtime is in linear relation to the number of table entries. The first entry found is changed.
    Sorted tables
    Binary search, where the runtime is in logarithmic relation to the number of table entries. The first entry found is changed.
    Hashed tables
    The entry is found using the hash algorithm of the internal table. The runtime is independent of the number of table entries.
    To change one or more lines using a condition, use the following statement:
    MODIFY <itab> FROM <wa> TRANSPORTING <f1> <f 2> ... WHERE <cond>.
    This processes all of the lines that meet the logical condition <cond>. The logical condition can consist of more than one comparison. In each comparison, the first operand must be a component of the line structure. If the table lines are not structured, the first operand can also be the expression TABLE LINE. The comparison then applies to the entire line.
    Regards,
    Swapna.

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

  • Another User Modified the table

    Hi,
    I have a user defined form, which is bound to Master-Data UDO.
    I have matrices in the form which is bound to its child objects.
    Following problem happens once in a while:
    When I press update button, I get the error message 'Another User Modified the table'.
    This is not consistent, but happens once in a while.
    My SBO version is 2007.
    In what situations you will get the error - "Another User Modified the table" ?
    Please help me with this.
    I'll appreciate your help.
    Thanks.
    -Geetha

    Hi Mahendra,
    Thanks for your reply.
    In my case, I take back-up of the database from client site and bringing into our in-house.
    If clients complained about record# 25, then the same record# has the 'Another user' issue in in-house also. (By record# I mean the Master UDO DocEntry#).
    So, I think the locking is stored in the database, rather than in a PC specific place.
    Please tell me any ideas you get in this angle.
    Regards,
    Geetha

  • Add Audit Columns to the Dimension and Fact tables (Created & modified date Time)

    Hi All,
    I am new to SSIS , I have to Add Audit Columns to the Dimension and Fact tables (Created & modified date Time) of the package.
    Please let me know the best and easy way through which I can implement the same.
    If possible suggest some real time example or link where I can find the same
    Regards,
    Vipin jha
    Thankx & regards, Vipin jha MCP

    You can simply use ALTER TABLE ADD.. syntax to add the columns if the tables already exist.
    You can generate a single script for all tables using INFORMATION_SCHEMA.TABLES view
    You can make then of NOT NULL type and set the default value to GETDATE()
    In addition you can also have a Audit Trail trigger for UPDATE to make sure Modified date gets updated correctly on each update if not passed explicitly.
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to update specific fields of a db table using MODIFY

    Hi all.
    I understand that MODIFY allows us to insert a record into the database if the a record with the same key is not there. If a record is there, it would update that record.
    However, when the record is there, could i update SPECIFIC fields of the record, instead of updating ALL fields of the record?

    Yes, you can with exception that you can not modify primary key values.
    Here are the details about MODIFY db table command with examples
    MODIFY - Change a database table
    Variants:
    MODIFY dbtab. or   MODIFY *dbtab. or
      MODIFY (dbtabname) ... .
    MODIFY dbtab FROM TABLE itab. or   MODIFY (dbtabname) FROM TABLE itab.
    MODIFY dbtab VERSION vers. or   MODIFY *dbtab VERSION vers.
    Effect
    Inserts new lines or updates existing lines in a database table (s. relational database). If a line with the specified primary key already exists, an UPDATE is executed. Otherwise, an INSERT is performed. You can specify the name of the database table either in the program itself in the form MODIFY dbtab ... or at runtime as the contents of the field dbtabname in the form MODIFY (dbtabname) ... . In both cases, the database table must be defined in the ABAP Dictionary. If the program contains the name of the database table, it must also have a corresponding TABLES statement. Normally, records are inserted or updated only in the current client. Data can only be inserted or updated using a view, if the view refers to a single table and was created in the ABAP Dictionary with the maintenance status "No restriction".
    MODIFY belongs to the Open SQL command set.
    When the statement has been executed, the system field SY-DBCNT contains the number of edited lines.
    The Return code is set as follows:
    SY-SUBRC = 0:
        All lines were successfully inserted or updated.
    SY-SUBRC = 4:
        One or more lines could not be inserted or updated.
    Notes
       1. You cannot modify a line if there is already a line in the table with identical key field values in a UNIQUE index.
       2. Automatic definition of INSERT and UPDATE is expensive. You should therefore use MODIFY only if you cannot define the INSERT and UPDATE cases yourself in the program.
       3. Since the MODIFY statement does not perform authority checks, you have to program them yourself.
       4. Adding or changing lines with the MODIFY command is only completed after a database commit (see LUW) has been performed. Before the database commit has been performed, any database changes can be reversed with a database rollback (see Programming transactions).
       5. Synchronization of simultanous accesses by several users to the same set of data cannot be exclusively achieved with the lock mechanism of the database system. In several cases, you are recommended to use the SAP lock mechanism.
    Variant 1
    MODIFY dbtab. or
    MODIFY *dbtab. or
    MODIFY (dbtabname) ... .
    Extras:
    ... FROM wa
    ... CLIENT SPECIFIED
    See Cannot Use Short Forms and
    Cannot Use *Work Areas.
    Effect
    Inserts a new line or updates an existing line in a database table. If you specify the name of the database table yourself, the primary key for identifying the line to be inserted or updated and the relevant values are taken from the table work area dbtab or *dbtab (see TABLES). If you declare the name of the database table explicitly, the program must also contain a corresponding TABLES statement. If the name of the database table is not determined until runtime, you need to use the addition ... FROM wa.
    Example
    Insert or change data of the customer Robinson in the current client:
    TABLES SCUSTOM.
    SCUSTOM-ID        = '12400177'.
    SCUSTOM-NAME      = 'Robinson'.
    SCUSTOM-POSTCODE  = '69542'.
    SCUSTOM-CITY      = 'Heidelberg'.
    SCUSTOM-CUSTTYPE  = 'P'.
    SCUSTOM-DISCOUNT  = '003'.
    SCUSTOM-TELEPHONE = '06201/44889'.
    MODIFY SCUSTOM.
    Addition 1
    ... FROM wa
    Effect
    The values for the line to be inserted or updated are not taken from the table work area dbtab, but from the explicitly specified work area wa. When doing this, the data is read from left to right according to the structure of the table work area dbtab (see TABLES). Since the structure of wa is not taken into account, the work area wa must be at least as wide (see DATA) as the table work area dbtab and the alignment of the work area wa must correspond to the alignment of the table work area. Otherwise, a runtime error occurs.
    Note
    If a work area is not explicitly specified, the values for the line to be inserted or updated are also taken from the table work area dbtab if the statement is in a FORM or FUNCTION where the table work area is stored in a formal parameter or local variable of the same name.
    Addition 2
    ... CLIENT SPECIFIED
    Effect
    Switches off automatic client handling. This allows you to edit data across all clients even when dealing with client-specific tables. The client field is treated like a normal table field that can be programmed to accept values in the table work area dbtab or *dbtab where the line to be edited occurs.
    The addition CLIENT SPECIFIED must be specified immediately after the name of the database table.
    Variant 2
    MODIFY dbtab FROM TABLE itab.or
    MODIFY (dbtabname) FROM TABLE itab.
    Addition:
    ... CLIENT SPECIFIED
    Effect
    Mass modify: Inserts new lines or updates existing lines of a database table. The primary keys for identifying the lines to be inserted or updated and the relevant values are taken from the internal table itab. The lines of the internal table itab must satisfy the same conditions as the work area wa in addition 1 to variant 1.
    Note
    If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0.
    Addition
    ... CLIENT SPECIFIED
    Effect
    As for variant 1.
    Variant 3
    MODIFY dbtab VERSION vers. or
    MODIFY *dbtab VERSION vers.
    See Cannot Use the VERSION Addition.
    Note
    This variant is obsolete.
    Effect
    Inserts a new line or updates an existing line in a database table, the name of which is taken from the field vers at runtime. If no line exists with the specified primary key, an INSERT is executed. Otherwise, an UPDATE is performed. The database table must be defined in the ABAP/4 Dictionary and its name must conform to the naming conventions for R/2 ATAB tables. These stipulate that the name must begin with 'T' and may contain up to four further characters. The field vers must contain the table name without the leading 'T'. Only lines in the current client are inserted or updated. The line to be inserted is taken from the statically specified table work area dbtab or *dbtab.
    SY-SUBRC is set to 0 if the line is successfully inserted or updated. SY-SUBRC <> 0 is not possible since any other result causes a runtime error.
    Hope this helps.
    ashish

  • Updating a view after modifying a table...

    Hello,
    Here is the scenario.
    I have a a table in HANA with 50+ columns of data.  I have created both Attribute and Analytical views of that data.  These views have been activated and deployed.  Now I need to modify my table to add two new columns that I will want to included in my existing Attribute and Analytical views.  How can I accomplish this?  It seems that when I modify my table, the views in HANA studio do not have the ability to be updated.  It seems I have to re-create my voews from scratch to now include my two new columns.  Hopefully I am missing something simple.
    Thanks in advance!

    Hi Matt, no way you need to recreate your views after a DDL change on the underlying tables.
    When the table structure changes, you usually need to close any information view editors on the model in question and then reopen the model for editing after the change, but otherwise should be fine. I have done this many times.
    What revision are you working on? Can you give the exact sequence of steps?
    Regards,
    Justin

Maybe you are looking for

  • PID loop rate with counters

    I'm trying to use a PXI-8106 RT and LabviewRT 8.5 as a PID controller to control 3 motors.  I'm measuring the speed of the motors by measuring the frequency of the encoder with a 6608. This article http://zone.ni.com/devzone/cda/tut/p/id/5423 claims

  • How to create node

    Hi, I am doing one file to file scenario. My file structure will be like this. MT_FILE ->FILE     ->LINE01         -> FIELD 1         -> FIELD 2         -> FIELD 3         -> FIELD 4. IF all the fields are containing values then its working fine. if

  • PHP/MySQL updates within OS X S and Security updates?

    Hey All, Does anyone know of a link that will provide any info about PHP, PHP plug-in, or MySQL updates that are included in the Server OS or security updates, or any other software updates? This way I won't have to read through all of Apple's suppor

  • Launch native air app(desktop) using URI scheme

    Have a air application for handling files. Is it possible to launch using URI. The same question has been asked on stack overflow without definite answer http://stackoverflow.com/questions/8956316/open-a-native-air-app-via-url

  • Dedicated or shared  server configuration

    Hi all, Good day...We have a 10204 rac db running on a linux server. Our concurrent connection are more than 1000..Is that good to have a shared server configuration or we can continue with dedicated server configuration... thanks, baskar.l