Updating Z table according ALV rows

Hi All!
I'm updating several columns automatically in ALV grid rows into Z database (current user name, date and hour). However, when I change only one row, all existed rows on the list are updated.
How can I update only the changed data in ALV?
ps.: it's used REUSE_ALV_GRID_DISPLAY FM.
Points will be rewarded!
Michel Khouri

Hi,
May this way.
    i_backupoutput[] = i_grpoutput[]. " <<< copy output table to temp table
    call function 'REUSE_ALV_GRID_DISPLAY'
      exporting
        it_fieldcat                 = pt_grpfcat[]
        it_excluding                = p_grpexcltab2[]
        is_layout                   = pt_grplayout2
        i_callback_program          = sy-repid
        i_callback_html_top_of_page = p_header
        i_callback_pf_status_set    = v_status_set1
        i_callback_user_command     = v_user_command1
        i_screen_start_column       = 25
        i_screen_start_line         = 5
        i_screen_end_column         = 80
        i_screen_end_line           = 20
        it_events                   = i_events[]
      tables
        t_outtab                    = i_grpoutput.
form f_user_command1 using p_ucomm type sy-ucomm
                     rs_selfield type  slis_selfield.
  data p_ref1 type ref to cl_gui_alv_grid.
  call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    importing
      e_grid = p_ref1.
  call method p_ref1->check_changed_data.
  case p_ucomm.
    when 'SAVE'.
      loop at i_grpoutput.
        read table i_backupoutput index sy-tabix.
        if sy-subrc eq 0.  
        if i_grpoutput ne i_backupoutput.
          <<<<<<< Update the record to Z table>>>>>>>>> 
        endif.
        endif.
      endlloop.
      leave to screen 0.
  endcase.
  rs_selfield-refresh = c_x.             " Grid refresh
endform.                                 " F_user_command1
aRs
Message was edited by:
        a®

Similar Messages

  • Updating multpile tables and multiple rows - JDBC adapter

    Hi,
    The scenario is like this. i receive an Idoc which has header information and various line items (multiple occurrance of a segment). the hearder details have to be sent to one table, TableA, and all line items has to go to another table, TableB, and for each line item, a new row has to be inserted in TableB.
    How can i acheive this using JDBC adapter? how should my data type look like? what are the settings i need to do in adapter config?
    Thanks and Regards,
    Rashmi

    Hi Rashmi,
    You can use the following link for the JDBC adapter call :
    http://help.sap.com/saphelp_nw04/helpdata/en/ae/d03341771b4c0de10000000a1550b0/frameset.htm
    You need to provide the JDBC Driver, Connection,User Name and the password.
    The data type structure you can take from the Bhavesh blog:
    JDBC Receiver Adapter -- Synchronous Select – Step by Step
    Since you just need to update the tables, take only the sender side of the blog, i.e. the request part and configure the scenario accordingly.
    Regards,
    Sanjeev.

  • Dynamic table with alv rows & colums

    Hey,
    How to create dynamic internal table with alv grid rows & columns with data .

    TYPE-POOLS : abap.
    FIELD-SYMBOLS: <f_dyn_table> TYPE STANDARD TABLE,
                 <f_dyn_wa>.
    DATA: t_dy_table TYPE REF TO data,
          dy_line  TYPE REF TO data,
          wa_xfc TYPE lvc_s_fcat,
          t_ifc TYPE lvc_t_fcat.
    *get the structure
      DATA: $field        TYPE lvc_fname,
            $counter(2)   TYPE n.
      DATA: $output_field(25) TYPE c,
            $fld_len      TYPE i.
      FIELD-SYMBOLS: <f_out_field> TYPE ANY.
      DATA : $t_idetails  TYPE abap_compdescr_tab,
             $wa_xdetails TYPE abap_compdescr.
      DATA : $ref_table_des TYPE REF TO cl_abap_structdescr.
    get the structure of the table.*
      $ref_table_des ?=
          cl_abap_typedescr=>describe_by_name( c_struc ).
      $t_idetails[] = $ref_table_des->components[].
      LOOP AT $t_idetails INTO $wa_xdetails.
        CLEAR: wa_xfc, $output_field, $fld_len.
        wa_xfc-fieldname = $wa_xdetails-name .
        wa_xfc-datatype  = $wa_xdetails-type_kind.
        wa_xfc-inttype   = $wa_xdetails-type_kind.
        IF $wa_xdetails-type_kind EQ 'C'
           OR $wa_xdetails-type_kind EQ 'N'.
          CONCATENATE 'WA_OUTTAB' '-' $wa_xdetails-name
                                         INTO $output_field.
          ASSIGN ($output_field) TO <f_out_field>.
          IF <f_out_field> IS ASSIGNED.
            DESCRIBE FIELD <f_out_field> LENGTH $fld_len
                                           IN CHARACTER MODE.
            wa_xfc-intlen    = $fld_len.
          ENDIF.
        ELSE.
          wa_xfc-intlen    = $wa_xdetails-length.
        ENDIF.
        wa_xfc-decimals  = $wa_xdetails-decimals.
        APPEND wa_xfc TO t_ifc.
        CLEAR $wa_xdetails.
      ENDLOOP.
    here if you have any other fields to be added to the dynamic structure based on your requirement, you can add then and apped them to t_ifc. There is a special handling for unicode conversion- so for the numc and char fields the length is passed in a different mothed.
    create dynamic internal table and assign to fs*
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_ifc
          i_length_in_byte          = 'X'
        IMPORTING
          ep_table                  = t_dy_table
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc <> 0.
      ELSE.
        ASSIGN t_dy_table->* TO <f_dyn_table>.
    create dynamic work area and assign to fs
        CREATE DATA dy_line LIKE LINE OF <f_dyn_table>.
        ASSIGN dy_line->* TO <f_dyn_wa>.
      ENDIF.
    *move the data into <f_dyn_wa> and then append this to output table <f_dyn_table>.
    example:-
        IF <f_dyn_wa> IS ASSIGNED AND <f_dyn_table> IS ASSIGNED.
          MOVE-CORRESPONDING wa_outtab TO <f_dyn_wa>.
    APPEND <f_dyn_wa> TO <f_dyn_table>.
    endif.
    Edited by: Krishna Adabala on Dec 2, 2008 7:57 AM

  • Updating a table with billion rows

    It was an interview question, what's the best way to update a table with 10 billion rows. Give me your suggestions. Thanks in advance.
    svk

    The best way to answer questions such as this is NOT with a absolute and specific answer.  Instead, discuss your strategy for approaching the problem.  The first step is to understand your exact requirement.  It is surprising how often people
    write update statements with an under-qualified where clause. NEVER update a row that does not need to be updated.  For example, a statement like:
    update mytable set cola = 'ABC' where id in (1, 45, 212);
    Assuming id is unique for the table and the specified values exist in the table, we know 3 rows will be updated.  Do all of those rows need to be updated?  Think about it.  If cola is already set to 'ABC' for any of those rows, we could ignore
    those rows and make the update more efficient.  To do that, you need to add "and cola <> 'ABC' " to the where clause.   That is just one example of understanding exactly what you need to do - and doing only that which needs to be done.
    Once you understand exactly what you need to do, you need to analyze the impact of the update and identify any potential issues.  Updating a lot of rows can take a lot of time and consume large amounts of log and disk space.  What else is using
    the table?  Can you afford to lock the table for the duration of the update?  Are there concurrency issues, regardless of whether you update in batches or in one single statement?  When using a batch approach, is there an issue if someone runs
    a query against the table (i.e., the result is different from that of the same query run after all updates have been completed)?  Are you changing something which is included in an index?  Are you changing part of the clustered index? 
    Ultimately, every question you are asked is (or should be) designed to test your problem-solving skills and your skillset. IMO, it is relatively easy to improve your skillset of any particular tool, language, or environment.  The other - not so much
    and that is why they are more valuable IMO.

  • Updating a table through ALV

    Hi all,
    I have one requirement.
    I need to display output using alv grid display.Next when somebody select the rows in the grid display and press a push button then the selected fields are updated in the ztable created.
    How can i achieve this.
    How to get a push button on the alv.
    how to update the the table with the selected rows.
    Please give some suggestions for this.
    Thanks to all in advance.

    CHk this program...
    U have to mention button names in PF-status creation
    REPORT  ZVA0T_PRCTR_FAL NO STANDARD PAGE HEADING MESSAGE-ID RA.
                              Modification Log                           *
    Program Name  : ZVA0T_PRCTR_FAL                                      *
    Author        : Suman K                                              *
    Date Written  : 04/27/2004                                           *
    Request #     : SAGK901471                                           *
    Requested by  : Torrence Roundtree                                   *
    Description   : This program is for maintainance of table            *
                    ZVA0T_PRCTR_FAL. The program has been copied from    *
                    custom program named ZSSVT_USR_TBL_MAINTENANCE and   *
                    done with essential changes to include table         *
                    ZVA0T_PRCTR_FAL and selection screen options. The    *
                    existing program documentation is as below           *
    Program Specifications:                                              *
    Mod date  Programmer        Reference    Description                 *
    *04/27/2005 Suman K           SAGK901471   Initial Development         *
    Type pools                                                           *
    TYPE-POOLS : slis.                     " Used for ALV display
    Tables
    TABLES: ZVA0T_PRCTR_FAL .              " LO43 Profit Center Listings
    Constants
    CONSTANTS:
    For authorization check for modifying Table Entries
      c_act_auth_01 LIKE tactz-actvt VALUE '01',
      c_act_auth_02 LIKE tactz-actvt VALUE '02',
      c_act_auth_06 LIKE tactz-actvt VALUE '06',
      c_table       LIKE dd02l-tabname VALUE 'ZVA0T_PRCTR_FAL',
                                           " Table name
      c_save        TYPE c VALUE 'A',      " Save
      c_chg(3)      TYPE c VALUE 'CHG',    " Change Group
      c_a           TYPE c VALUE 'A',      " Cancel Indicator
      c_ct(2)       TYPE c VALUE 'CT'.     " Style Name
    Work Variables declaration
    DATA:
      w_transaction_code LIKE tstc-tcode,  " Transaction Code
      w_variant          TYPE disvariant,  " Variant
      ok_code            LIKE sy-ucomm.    " OK Code
    Reference variables for the ALV grid control........................
    DATA:
      w_grid TYPE REF TO cl_gui_alv_grid,  " ALV Grid
      w_custom_container TYPE REF TO cl_gui_custom_container.
                                           " Reference to Container
    Variables used in User_command_0100
    DATA:
      w_confirm_ind    TYPE c,             " Deletion Indicator
      W_SUBRC          LIKE SY-SUBRC.      " Subrc
    Flag declaration
    DATA:
      fl_chng   TYPE c,                    " Flag
      fl_cancel TYPE c.                    " Flag
    Internal tables declaration
    To store the function codes.........................................
    DATA:
      BEGIN OF wa_fcode,
        fcode LIKE sy-ucomm,               " User Command
      END OF wa_fcode.
    Table for User Command
    DATA: t_fcode LIKE STANDARD TABLE OF wa_fcode.
    To store the data of ZVA0T_PRCTR_FAL table
    DATA:
      T_ZVA0T_PRCTR_FAL LIKE STANDARD TABLE
                          OF ZVA0T_PRCTR_FAL.
    Table used in User_command_0100
    DATA:
      t_selected_rows  TYPE lvc_t_row.     " Selected row information
    DATA:
      FS_SELECTED_ROWS LIKE LINE OF T_SELECTED_ROWS.
                                           " Work area for Selected Rows
    Selection screen elements
    SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-008.
    SELECT-OPTIONS:
      s_prctr FOR ZVA0T_PRCTR_FAL-leg_prctr.
                                           " Profit Center
    SELECTION-SCREEN: END OF BLOCK blk1.
    SELECTION-SCREEN: BEGIN OF BLOCK blk2 WITH FRAME TITLE text-009.
    PARAMETERS:
      p_varant  LIKE ltdx-variant.         " ALV variant
    SELECTION-SCREEN: END OF BLOCK blk2.
    Initialization
    INITIALIZATION.
    Authorization check for transaction code
      SELECT tcode
        FROM tstc
        INTO w_transaction_code
          UP TO 1 ROWS
       WHERE pgmna EQ sy-repid.
      ENDSELECT.
      IF sy-subrc EQ 0.
        AUTHORITY-CHECK OBJECT 'S_TCODE'
                     ID 'TCD' FIELD w_transaction_code.
        IF sy-subrc NE 0.
          MESSAGE e100 WITH text-e01 w_transaction_code.
        ENDIF.                             " IF SY-SUBRC NE 0
      ENDIF.                               " IF SY-SUBRC EQ 0
    At selection screen                                                 *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varant.
    to get the existing values for the display variant
      PERFORM f4_on_display_variant CHANGING p_varant.
    AT SELECTION-SCREEN ON p_varant.
    validates the diplay variant
      IF p_varant IS NOT INITIAL.
        PERFORM validate_variant.
      ENDIF.                               " IF P_VARANT IS NOT INITIAL
    Start Of Selection
    START-OF-SELECTION.
      CALL SCREEN 0100.
    *&      Form  f4_on_display_variant
    This subroutine is used to get the existing values for display variant
    The parameter passed to the subroutine is Variant parameter
    FORM f4_on_display_variant CHANGING p_varant TYPE any.
      DATA: lw_variant LIKE disvariant.    " Variant
      lw_variant-report   = sy-repid.
      lw_variant-username = sy-uname.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant = lw_variant
          i_save     = c_save
        IMPORTING
          es_variant = lw_variant
        EXCEPTIONS
          OTHERS     = 1.
      IF sy-subrc EQ 0.
        p_varant = lw_variant-variant.
      ELSE.
        MESSAGE s100 WITH text-012.
      ENDIF.                               " IF SY-SUBRC EQ 0
    ENDFORM.                               " F4_ON_DISPLAY_VARIANT
    *&      Form  validate_variant
    This subroutine validates the variant entered onthe selection screen
    There are no interface parameters to be passed to the subroutine
    FORM validate_variant .
      CLEAR w_variant.
      w_variant-report = sy-repid.
      MOVE p_varant TO w_variant-variant.
      CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
        EXPORTING
          i_save        = c_save
        CHANGING
          cs_variant    = w_variant
        EXCEPTIONS
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          OTHERS        = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.                               " IF SY-SUBRC <> 0
    ENDFORM.                               " VALIDATE_VARIANT
    *&      Module  STATUS_0100  OUTPUT
    This is the PBO module for the ALV GRid dispaly
    MODULE status_0100 OUTPUT.
    Check the User authorizations and display the PF status accordingly
      PERFORM check_authorizations.
    Set the user status as per Authorizations
      SET PF-STATUS 'ZVA0T_PRCTR_FAL' EXCLUDING t_fcode.
      SET TITLEBAR 'ZVA0T_PRCTR_FAL'.
    Instantiate the container control and Grid control.
      IF w_custom_container IS INITIAL.
        CREATE OBJECT w_custom_container
           EXPORTING
              container_name = 'CUSTOM_CONTAINER'.
        CREATE OBJECT w_grid
           EXPORTING
             i_parent = w_custom_container.
      ENDIF.                               " IF W_CUSTOM_CONTAINER IS ...
    Clearing the work variables
      PERFORM intialize.
    Retrieve the table contents
      PERFORM get_data.
    Display the data in the ALV Grid control
      PERFORM display_data.
    ENDMODULE.                             " STATUS_0100  OUTPUT
    *&      Form  check_authorizations
    This subroutine is used to check the user authorizations
    There are no interface parameters to be passed
    FORM check_authorizations .
      REFRESH t_fcode.
    Authorization check for Create entry
      AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
               ID 'ACTVT' FIELD c_act_auth_01
               ID 'TABLE' FIELD c_table.
      IF sy-subrc NE 0.
        PERFORM fillcode USING 'CREA'.
        PERFORM fillcode USING 'COPY'.
      ENDIF.                               " IF SY-SUBRC NE 0
    Authorization check for Change the entry
      AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
               ID 'ACTVT' FIELD c_act_auth_02
               ID 'TABLE' FIELD c_table.
      IF sy-subrc NE 0.
        PERFORM fillcode USING 'CHNG'.
      ENDIF.                               " IF SY-SUBRC NE 0
    Authorization check for Delete the entry
      AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
               ID 'ACTVT' FIELD c_act_auth_06
               ID 'TABLE' FIELD c_table.
      IF sy-subrc NE 0.
        PERFORM fillcode USING 'DELE'.
      ENDIF.                               " IF SY-SUBRC NE 0
    ENDFORM.                               " CHECK_AUTHORIZATIONS
    *&      Form  fillcode
    This subroutine is used to fill the function code in the table t_fcode
    The parameter that passed to this subroutine is function code
    FORM fillcode  USING    value(p_fcode) TYPE any.
      CLEAR wa_fcode.
      MOVE p_fcode TO wa_fcode-fcode.
      APPEND wa_fcode TO t_fcode.
    ENDFORM.                               " FILLCODE
    *&      Form  intialize
    This subroutine is used to initialize the work variables
    There are no interface parameters that need to be passed
    FORM intialize .
      CLEAR   t_ZVA0T_PRCTR_FAL.
      REFRESH t_ZVA0T_PRCTR_FAL.
    ENDFORM.                               " INITIALIZE
    *&      Form  get_data
    This subroutine is used to get data from the table
    There are no interfaces parameters that need to be passed
    FORM get_data .
    retrieve the status and codegroup from the table
      REFRESH t_ZVA0T_PRCTR_FAL.
      SELECT *
        FROM ZVA0T_PRCTR_FAL
        INTO TABLE t_ZVA0T_PRCTR_FAL
       WHERE leg_prctr IN s_prctr.
      IF sy-subrc NE 0.
      ENDIF.                               " IF SY-SUBRC NE 0
    ENDFORM.                               " GET_DATA
    *&      Form  display_data
    This subroutine is used to display the data in the ALV Grid control
    *There are no interface parameters that need to be passed to subroutine
    FORM display_data .
      DATA:
        w_grid_layout TYPE lvc_s_layo,     " Grid Layout
        LT_fieldcat   TYPE lvc_t_fcat.     " Field Catalog
      DATA:
        FS_FIELDCAT LIKE LINE OF LT_FIELDCAT.
    Filling the Layout
      w_grid_layout-grid_title = text-001.
      w_grid_layout-sel_mode   = c_save.
      w_grid_layout-stylefname = c_ct.
      w_grid_layout-cwidth_opt = 'X'.
    Filling the Variant structure
      w_variant-report   = sy-repid.
      w_variant-username = sy-uname.
      w_variant-variant  = p_varant.
    Filling the fieldcatalog.............................................
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = c_table
        CHANGING
          ct_fieldcat      = lt_fieldcat.
    To make the ALV list use the medium text label from DDIC
      LOOP AT lt_fieldcat INTO FS_FIELDCAT.
        MOVE 'M' TO fs_fieldcat-colddictxt.
        MODIFY lt_fieldcat FROM FS_FIELDCAT.
      ENDLOOP.                             " LOOP AT T_FIELDCAT
      CALL METHOD w_grid->set_table_for_first_display
        EXPORTING
          i_structure_name              = c_table
          is_variant                    = w_variant
          i_save                        = c_save
          is_layout                     = w_grid_layout
        CHANGING
          it_outtab                     = t_ZVA0T_PRCTR_FAL
          it_fieldcatalog               = lt_fieldcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc NE 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.                               " IF SY-SUBRC NE 0
    ENDFORM.                               " DISPLAY_DATA
    *&      Module  USER_COMMAND_0100  INPUT
    This is the PAI module for the screen 100.
    MODULE user_command_0100 INPUT.
      REFRESH t_selected_rows.
      CLEAR   FS_SELECTED_ROWS.
      CLEAR fl_chng.
    Getting the selected rows
      CALL METHOD w_grid->get_selected_rows
        IMPORTING
          et_index_rows = t_selected_rows.
    If more than one record is selected, error message
      DESCRIBE TABLE t_selected_rows.
      IF sy-tfill GT 1
      AND SY-UCOMM NE 'REFR'
      AND SY-UCOMM NE 'CREA'
      AND SY-UCOMM NE 'DELE'.
        MESSAGE e048(zcsv_sfdr).
      ENDIF.                               " IF SY-TFILL GT 1
    Read the first record
      READ TABLE t_selected_rows INTO FS_SELECTED_ROWS INDEX 1.
      READ TABLE t_ZVA0T_PRCTR_FAL
            INTO ZVA0T_PRCTR_FAL INDEX fs_selected_rows-index.
      CLEAR W_SUBRC.
      W_SUBRC = SY-SUBRC.
      CASE ok_code.
        WHEN 'CREA'.
          CLEAR ZVA0T_PRCTR_FAL.
          CALL SCREEN 0200.
        WHEN 'COPY'.
          IF W_SUBRC EQ 0.
            IF t_selected_rows IS NOT INITIAL.
              CALL SCREEN 0200.
            ELSE.
              MESSAGE e100 WITH text-013.
            ENDIF.                         " IF T_SELECTED_ROWS IS NOT ...
          ELSE.
            MESSAGE e100 WITH text-014.
          ENDIF.                           " IF W_SUBRC EQ 0
        WHEN 'CHNG'.
          IF W_SUBRC EQ 0.
            MOVE 'X' TO fl_chng.
            IF t_selected_rows IS NOT INITIAL.
              CALL SCREEN 0200.
            ELSE.
              MESSAGE e100 WITH text-e04.
            ENDIF.                         " IF T_SELECTED_ROWS IS NOT ...
          ELSE.
            MESSAGE e100 WITH text-014.
          ENDIF.                           " IF W_SUBRC EQ 0
        WHEN 'DELE'.
          IF t_selected_rows IS NOT INITIAL.
            IF W_SUBRC EQ 0.
              CALL FUNCTION 'POPUP_TO_CONFIRM'
                EXPORTING
                  titlebar              = text-002
                  text_question         = text-003
                  text_button_1         = text-004
                  text_button_2         = text-005
                  default_button        = '1'
                  display_cancel_button = 'X'
                IMPORTING
                  answer                = w_confirm_ind.
              IF w_confirm_ind EQ '1'.
                LOOP AT T_SELECTED_ROWS INTO FS_SELECTED_ROWS.
                  CLEAR ZVA0T_PRCTR_FAL.
                  READ TABLE T_ZVA0T_PRCTR_FAL
                        INTO ZVA0T_PRCTR_FAL INDEX fs_selected_rows-index.
                  IF SY-SUBRC EQ 0.
                    DELETE ZVA0T_PRCTR_FAL.
                    IF sy-subrc NE 0.
                      W_SUBRC = 4.
                    ENDIF.                 " IF SY-SUBRC EQ 0
                  ENDIF.                   " IF SY-SUBRC EQ 0
                ENDLOOP.                   " LOOP AT T_SELECTED_ROWS ...
                IF W_SUBRC EQ 0.
                  MESSAGE s100 WITH text-010.
                ELSE.
                  MESSAGE   e100 WITH text-e03.
                ENDIF.                     " IF W_SUBRC EQ 0
              ELSEIF w_confirm_ind EQ '2'.
              ENDIF.                       " IF W_CONFIRM_IND EQ '1'
            ELSE.
              MESSAGE e100 WITH text-014.
            ENDIF.                         " IF W_SUBRC EQ 0
          ELSE.
            MESSAGE e100 WITH text-e05.
          ENDIF.                           " IF T_SELECTED_ROWS IS NOT ...
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
        WHEN 'CANCEL'.
          SET SCREEN 0.
          LEAVE SCREEN.
      ENDCASE.                             " CASE OK_CODE
      CLEAR ok_code.
    ENDMODULE.                             " USER_COMMAND_0100  INPUT
    *&      Module  exit  INPUT
    This subroutine is used to leave the current screen
    MODULE exit INPUT.
      CALL METHOD w_custom_container->free.
      CALL METHOD cl_gui_cfw=>flush.
      SET SCREEN 0.
      LEAVE SCREEN.
    ENDMODULE.                             " EXIT  INPUT
    *&      Module  STATUS_0200  OUTPUT
    This module is used to set the PF Status of the modify screen
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'STATUS_200'.
    ENDMODULE.                             " STATUS_0200  OUTPUT
    *&      Module  modify_0200  OUTPUT
    This module is used to print the values on the screen
    MODULE modify_0200 OUTPUT.
      IF NOT fl_chng IS INITIAL.
        LOOP AT SCREEN.
          IF screen-group1 EQ c_chg.
            screen-required = '0'.
            screen-output   = '1'.
            screen-input    = '0'.
            MODIFY SCREEN.
          ENDIF. 
        ENDLOOP.                           " LOOP AT SCREEN
      ELSE.
        LOOP AT SCREEN.
          IF screen-group1 EQ c_chg.
            screen-required = '1'.
            screen-output   = '1'.
            screen-input    = '1'.
            MODIFY SCREEN.
          ENDIF. 
        ENDLOOP.                           " LOOP AT SCREEN
      ENDIF.                               " IF NOT FL_CHNG IS INITIAL
    ENDMODULE.                             " MODIFY_0200  OUTPUT
    *&      Module  exit_0200  INPUT
    This module is used to exit from the screen on pressing exit button
    MODULE exit_0200 INPUT.
      IF sy-datar IS INITIAL
      AND fl_cancel IS INITIAL.
        CLEAR fl_chng.
        LEAVE PROGRAM.
      ELSE.
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            titlebar              = text-011
            text_question         = text-006
            text_button_1         = text-004
            text_button_2         = text-005
            default_button        = '1'
            display_cancel_button = 'X'
          IMPORTING
            answer                = w_confirm_ind.
        CASE w_confirm_ind.
          WHEN '1'.
            sy-ucomm = 'SAVE'.
            CLEAR fl_cancel.
          WHEN '2'.
            CLEAR fl_chng.
            CLEAR fl_cancel.
            LEAVE PROGRAM.
          WHEN c_a.
            fl_cancel = 'X'.
        ENDCASE.                           " CASE W_CONFIRM_IND
      ENDIF.                               " IF SY-DATAR IS INITIAL
    ENDMODULE.                             " EXIT_0200  INPUT
    *&      Module  USER_COMMAND_0200  INPUT
    This module is used to update the database table with the user values
    MODULE user_command_0200 INPUT.
      IF sy-ucomm EQ 'SAVE'.
        PERFORM SAVE.
      ELSEIF SY-UCOMM EQ 'BACK'.
        PERFORM BACK_CANCEL.
        IF SY-UCOMM EQ 'SAVE'.
          PERFORM SAVE.                    " IF SY-UCOMM EQ 'SAVE'
        ENDIF.
      ELSEIF SY-UCOMM EQ 'CANC'.
        PERFORM BACK_CANCEL.
        IF SY-UCOMM EQ 'SAVE'.
          PERFORM SAVE.                    " IF SY-UCOMM EQ 'SAVE'
        ENDIF.
      ELSEIF SY-UCOMM EQ 'ENTE'.
        fl_cancel = 'X'.
      ENDIF.                               " IF SY-UCOMM EQ 'SAVE'
    ENDMODULE.                             " USER_COMMAND_0200  INPUT
    *&      Form  BACK_CANCEL
    This subroutine provides functionality for BACK & CANCEL
    form BACK_CANCEL .
      IF sy-datar IS INITIAL
      AND fl_cancel IS INITIAL.
        CLEAR fl_chng.
        SET SCREEN 0.
        LEAVE SCREEN.
      ELSE.
        CALL FUNCTION 'POPUP_TO_CONFIRM'
          EXPORTING
            titlebar              = text-011
            text_question         = text-006
            text_button_1         = text-004
            text_button_2         = text-005
            default_button        = '1'
            display_cancel_button = 'X'
          IMPORTING
            answer                = w_confirm_ind.
        CASE w_confirm_ind.
          WHEN '1'.
            sy-ucomm = 'SAVE'.
            CLEAR fl_cancel.
          WHEN '2'.
            CLEAR fl_chng.
            CLEAR fl_cancel.
            SET SCREEN 0.
            LEAVE SCREEN.
          WHEN 'A'.
            fl_cancel = 'X'.
        ENDCASE.                           " CASE W_CONFIRM_IND
      ENDIF.                               " IF SY-DATAR IS INITIAL
    endform.                               " BACK_CANCEL
    *&      Form  SAVE
    This subroutine provides functionality for SAVE
    form SAVE .
        MOVE:
          SY-DATUM TO ZVA0T_PRCTR_FAL-erdat,
          SY-UZEIT TO ZVA0T_PRCTR_FAL-erzet,
          SY-UNAME TO ZVA0T_PRCTR_FAL-ernam.
        IF fl_chng IS INITIAL.
          INSERT ZVA0T_PRCTR_FAL.
          IF sy-subrc EQ 0.
            MESSAGE s100 WITH text-010.
          ELSE.
            MESSAGE e100 WITH text-e03.
          ENDIF.                           " IF SY-SUBRC EQ 0
        ELSE.
          MODIFY ZVA0T_PRCTR_FAL.
          IF sy-subrc EQ 0.
            MESSAGE s100 WITH text-010.
          ELSE.
            MESSAGE e100 WITH text-e03.
          ENDIF.                           " IF SY-SUBRC EQ 0
          CLEAR t_ZVA0T_PRCTR_FAL.
        ENDIF.                             " IF FL_CHNG IS INITIAL
        SET SCREEN 0.
        LEAVE SCREEN.
    endform.                               " SAVE
    Reward if helpful...

  • Updating database table using ALV Grid class CL_ALV_CHANGED_DATA_PROTOCOL

    Hi,
    I am trying to use class CL_ALV_CHANGED_DATA_PROTOCOL to update a database table from an ALV grid.
    I have used program BCALV_EDIT_04 as an example.
    I am able to successfully processed inserted or deleted lines using the attributes
    MT_DELETED_ROWS
    MT_INSERTED_ROWS
    but I also want to process modified lines.
    I was just wondering whether anyone out there has some example code for this.
    I can see that there are the following attributes available
    MT_MOD_CELLS
    MP_MOD_ROWS.
    I would ideally like to use MP_MOD_ROWS rather than  MT_MOD_CELLS but it is not clear to me what type MP_MOD_ROWS is.
    If anyone has any example code for this sort of thing, please let me know.
    Thanks,
    Ruby

    hi Ruby,
    Yes we can use that *data reference variable *.
    It is a variable( something comparable to a pointer ) that points to a int table( table with changed contents )
    which ll be created at run-time based on the data type ot the internal table that we pass to the parameter it_outtab of method set_table_for_first_display ...
    assign er_data_changed->mp_mod_rows->* to a field-symbol and use it...
    Check the below code for example -> method refresh_changed_data
    screen flow logic.
    PROCESS BEFORE OUTPUT.
      MODULE pbo.
    PROCESS AFTER INPUT.
      MODULE pai.
    main program.
    *       CLASS lcl_event_responder DEFINITION                           *
    CLASS lcl_event_responder DEFINITION.
      PUBLIC SECTION.
        DATA  : ls_changed_cell TYPE  lvc_s_modi,
                lv_language     TYPE  spras..
        METHODS refresh_changed_data  FOR EVENT data_changed
                                      OF cl_gui_alv_grid
                                      IMPORTING er_data_changed
                                                e_ucomm.
    ENDCLASS.                    "event_responder DEFINITION
    TYPES tt_makt TYPE STANDARD TABLE OF makt.
    DATA: go_handler         TYPE REF TO lcl_event_responder,
          go_grid            TYPE REF TO cl_gui_alv_grid,
          gt_fieldcat        TYPE lvc_t_fcat,
          gv_language        TYPE spras VALUE 'E',
          gt_outtab          TYPE tt_makt,
          gs_tableline       TYPE LINE OF tt_makt.
    FIELD-SYMBOLS : <changed_rows> TYPE tt_makt.
    CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'BASIC'.
      PERFORM create_and_init_alv CHANGING gt_outtab[]
                                           gt_fieldcat.
    ENDMODULE.                    "pbo OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      LEAVE PROGRAM.
    ENDMODULE.                    "pai INPUT
    FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
                                      pt_fieldcat TYPE lvc_t_fcat.
      CHECK go_grid IS NOT BOUND.
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = cl_gui_container=>default_screen.
      PERFORM build_display_table.
      PERFORM build_fieldcat CHANGING pt_fieldcat.
      go_grid->set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                      it_outtab            = pt_outtab ).
      go_grid->set_ready_for_input( 1 ).
    * raises the 'data_changed' event when we select another cell/any action after changing the data
      go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter ).
      CREATE OBJECT go_handler.
      SET HANDLER go_handler->refresh_changed_data FOR go_grid.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    FORM build_display_table.
      FREE gt_outtab.
      SELECT * FROM makt UP TO 20 ROWS INTO TABLE gt_outtab WHERE spras EQ gv_language.
    ENDFORM.                               "build_display_table
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'MAKT'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
        ls_fcat-edit       = abap_true.
        MODIFY pt_fieldcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                               "build_fieldcat
    *       CLASS event_responder IMPLEMENTATION                          *
    CLASS lcl_event_responder IMPLEMENTATION.
      METHOD refresh_changed_data.
        ASSIGN er_data_changed->mp_mod_rows->* TO <changed_rows>.
        LOOP AT <changed_rows> INTO gs_tableline.
          BREAK-POINT.
        ENDLOOP.
      ENDMETHOD.                    "click
    ENDCLASS.                    "event_responder IMPLEMENTATION
    Cheers,
    Jose.

  • Update SAP tables after ALV report is displayed

    Hi All,
    I have to display a ALV report using function module REUSE_ALV_GRID_DISPLAY.
    After the report is displayed, user can edit some of the flds in the report, and the fields need to updated in the table. How do I proceed to accomplish this.
    Is it possible to use FM 'REUSE_ALV_DRID_DISPLAY' to do this or we need to use OOPS ALV to do this. 
    I searched for this in this forum, but couldnt get.
    Thanks in advance,
    Ananth

    You can use the REUSE_ALV_GRID_DISPLAY. and can make it a changable. You can specify the column to be changable. Once the user enters data into that coloumn the interna table automatically gets populated with the values.
    I have done a similar program. However you might need to copy some standard GUI status based on your requirements.
    Whats ur mail ID. I can send you the program I have developed.
    Shreekant

  • How to update a table with ALV list reocrds

    Dear All,
    I have a requirement to display records in ALV list and these records
    should get updated in a table and I should also be able to insert new
    records in an ALV list.
    Could any  body  please let me know how to do this. This is an urgent requirement.

    You can use Table Control instead. Check the following examples in SE38
    demo_dynpro_tabcont_loop
    demo_dynpro_tabcont_loop_at
    RSDEMO_TABLE_CONTROL
    Regards
    Gopi

  • Selecting multiple rows a table according to rows passed with a table valued parameter

    Ive got a table, which looks like this:
    CREATE TABLE MyTable (
    MyChars CHAR(3) NOT NULL,
    MyId INT NOT NULL,
    CONSTRAINT PK__MyTable_MyChars_MyId PRIMARY KEY (MyChars, MyId),
    CONSTRAINT FK__MyOtherTable_Id_MyTable_MyId FOREIGN KEY (MyId) REFERENCES MyOtherTable (Id)
    Records look like i.e.:
    Chars | Id
    'AAA' | 1
    'BBB' | 1
    'CCC' | 1
    'AAA' | 2
    'BBB' | 2
    'CCC' | 2
    'DDD' | 2
    'EEE' | 3
    'FFF' | 3
    'AAA' | 4
    'DDD' | 4
    'FFF' | 4
    Now I have a SP, which takes a table valued parameter like:
    CREATE TYPE dbo.MyTVP AS TABLE ( MyChars CHAR(3) )
    This SP should return a set of Ids, which match all the rows of the parameter.
    I.e.:
    if the TVP contains 'AAA', 'BBB' & 'CCC', i get as result 1 & 2
    if the TVP contains 'AAA' & 'FFF', i get as result 4
    if the TVP contains 'BBB' & 'EEE', i get an empty result
    What my SP is currently doing, is to build a query with string concatination, which is then executed with the EXEC statement. If we take my first example, the built query would look like this:
    SELECT DISTINCT t0.MyId
    FROM MyTable t0
    INNER JOIN MyTable t1 ON t0.MyId = t1.MyId
    INNER JOIN MyTable t2 ON t1.MyId = t2.MyId
    WHERE t0.MyChars = 'AAA' AND t1.MyChars = 'BBB' AND t2.MyChars = 'CCC'
    It works, but I'm not very fond of building the query. Maintaining such things is always a pain. And it also might not be the most efficient and elegant way to do this.
    Since I can't think of any other way of doing this, I wanted to ask, if someone of you got an idea, if there is a better way to accomplish this.

    Let me give you a "cut and paste" I use in the SQL Server groups:
    1) The dangerous, slow kludge is to use dynamic SQL and admit that any random future user is a better programmer than you are. It is used by Newbies who do not understand SQL or even what a compiled language is. A string is a string; it is a scalar value like
    any other parameter; it is not code. Again, this is not just an SQL problem; this is a basic misunderstanding  of programming principles. 
    2) Passing a list of parameters to a stored procedure can be done by putting them into a string with a separator. I like to use the traditional comma. Let's assume that you have a whole table full of such parameter lists:
    CREATE TABLE InputStrings
    (keycol CHAR(10) NOT NULL PRIMARY KEY,
     input_string VARCHAR(255) NOT NULL);
    INSERT INTO InputStrings 
    VALUES ('first', '12,34,567,896'), 
     ('second', '312,534,997,896'),
     etc.
    This will be the table that gets the outputs, in the form of the original key column and one parameter per row.
    It makes life easier if the lists in the input strings start and end with a comma. You will need a table of sequential numbers -- a standard SQL programming trick, Now, the query, 
    CREATE VIEW ParmList (keycol, place, parm)
    AS
    SELECT keycol, 
           COUNT(S2.seq), -- reverse order
           CAST (SUBSTRING (I1.input_string
                            FROM S1.seq 
                             FOR MIN(S2.seq) - S1.seq -1) 
             AS INTEGER)
      FROM InputStrings AS I1, Series AS S1, Series AS S2 
     WHERE SUBSTRING (',' + I1.input_string + ',', S1.seq, 1) = ','
       AND SUBSTRING (',' + I1.input_string + ',', S2.seq, 1) = ','
       AND S1.seq < S2.seq
     GROUP BY I1.keycol, I1.input_string, S1.seq;
    The S1 and S2 copies of Series are used to locate bracketing pairs of commas, and the entire set of substrings located between them is extracted and cast as integers in one non-procedural step. The trick is to be sure that the right hand comma of the bracketing
    pair is the closest one to the first comma. The relative position of each element in the list is given by the value of "place", but it does a count down so you can plan horizontal placement in columns. 
    This might be faster now:
    WITH Commas(keycol, comma_seq, comma_place)
    AS
    (SELECT I1.keycol, S1.seq,
    ROW_NUMBER() OVER (PARTITION BY I1.keycol ORDER BY S1.seq)
    FROM InputStrings AS I1, Series AS S1
    WHERE SUBSTRING (',' || I1.input_string || ',' 
    FROM S1.seq 
    FOR 1) = ',' 
    AND S1.seq <= CHARLENGTH (I1.input_string))
    SELECT SUBSTRING(',' || I1.input_string || ','
    FROM C1.comma_place +1
    FOR C2.comma_place - C1.comma_place - 1)
    FROM Commas AS C1, Commas AS C2
    WHERE C2.comma_seq = C1.comma_seq + 1 
    AND C1.keycol = C2.keycol;
    The idea is to get all the positions of the commas in the CTE and then use (n, n+1) pairs of positions to locate substrings. The hope is that the ROW_NUMBER() is faster than the GROUP BY in the first attempt. Since it is materialized before the body of
    the query (in theory), there are opportunities for parallelism indexing and other things to speed up the works. 
    Hey, I can write kludges with the best of them, but I don't. You need to at the very least write a routine to clean out blanks, handle double commas and non-numerics in the strings, take care of floating point and decimal notation, etc. Basically, you must
    write part of a compiler in SQL. Yeeeech!  Or decide that you do not want to have data integrity, which is what most Newbies do in practice altho they do not know it. 
    A procedural loop is even worse. You have no error checking, no ability to pass local variables or expressions, etc. 
    CREATE PROCEDURE HomemadeParser(@input_string VARCHAR(8000))
    AS
    BEGIN
    DECLARE @comma_position INTEGER;
    CREATE TABLE #Slices
    (slice_value INTEGER);
    SET @input_string = @input_string + ','; --add sentinel comma
    SET @comma_position = CHARINDEX(',', @input_string); 
    WHILE @comma_position > 1
      BEGIN
      INSERT INTO #Slices (slice_value)
      VALUES(CAST(LEFT(@input_string, (@comma_position - 1)) AS INTEGER)); 
      SET @input_string = RIGHT(@input_string, LEN(@input_string)-@comma_position)
      SET @comma_position = CHARINDEX(',', @input_string)
      END;
    END;
    Better answer:
    http://www.simple-talk.com/sql/learn-sql-server/values()-and-long-parameter-lists/
    http://www.simple-talk.com/sql/learn-sql-server/values()-and-long-parameter-lists---part-ii/
    Do this with a long parameter list. You can pass up to 2000+ parameters in T-SQL, which is more than you probably will ever need. The compiler will do all that error checking that the query version and the procedural code simply do not have unless you write
    a full parser with the standard error codes. You can now pass local variables to your procedure; you can pass other data types and get automatic conversions, etc. In short, this is just good software engineering. 
    CREATE PROCEDURE LongList
    (@p1 INTEGER = NULL,
     @p2 INTEGER = NULL,
     @p3 INTEGER = NULL,
     @p4 INTEGER = NULL,
     @p5 INTEGER = NULL)
      x IN (SELECT parm
              FROM (VALUES (@p1), (@p2), (@p3), (@p4), (@p5)) AS X(parm)
            WHERE parm IS NOT NULL;
    You get all the advantages of the real compiler and can do all kinds of things with the values. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • [ADF BC | ADF Faces] Updating a table with values updated in transaction

    Summary: A table is based on a view with a bind variable. Based on some action, I update rows in the view so that they no longer satisfy the query. How do I update the table to reflect this?
    I have an ADF Faces page with a multi-select table component on it, mapped to an ADF Business Components view object. The view object has a bind variable (:Status), which is used in the query to only retrieve rows with a specific status.
    The user selects rows in the table that should have their status changed, and then hits a button to perform the action. In the backing bean for the page, the button click is processed and the selected rows are updated to a different status. At this point the transaction is not committed.
    Changing the status of these rows now means that they no longer match the where clause of the view object, yet they still appear in the table.
    My question is, how can I update the table so that rows which don't match the where clause are removed?
    This is a simplified version of the problem I am working on - this needs to work when rows that aren't in the table are being updated so that they now MATCH the where clause and rows may also be added or completely removed.

    Quite an interesting little problem....
    I have created a simple test case to illustrate your scenario - perhaps Steve M could comment...
    My scenario:
    1). create an EO based on the HR.EMPLOYEES table
    2). create an updatable VO based upon the aforementioned EO. Add "COMMISSION_PCT IS NULL" to the where clause.
    3). Add the VO to an app module as usual.
    4). Create an ADF Faces page by dropping the VO from the data control as an ADF table. Show only first name, last name, and commission pct.
    5). Add a command button to the page so I can call various code from the backing bean.
    Now, when I update the commision for the first record to ".1" and press the submit button (the one in the table actions facet), the update "takes" - I assume that it's just in the EO cache at this point. The record still shows on the screen, even though it no longer meets the where clause criteria.
    When I add some code to the command button (#5) to perform a commit - the record STILL shows on the screen after committing to the DB. I can make the record disappear by either (in the same backing-bean method that does the commit)
    a). Re-execute the iterator after the commit
    b). Call "clearVOCaches" on the application module (forces the iterator to re-execute)
    I even tried programmatically adding the where clause back in (via addWhereClause) and re-executing the iterator - no go. I suspect that the only way to do this would be to post the changes to the DB (without committing them) and then re-execute the query. This, however, would be a killer from a scalability perspective.
    John

  • Listening to change in a row of a table a and update a table in a diferent Database

    i want to update a table using values from a different database table. how to i do it in SQl 2012

    i want to update a table using values from a different database table. how to i do it in SQl 2012
    With Service Broker?
    Without Service Broker, you would do:
    UPDATE targettbl
    SET    col1 = b.col1,
           col2 = b.col2,
    FROM   targettbl a
    JOIN   srctbl b ON a.keycol1 = b.keycol1
                   AND a.keycol2 = b.keycol2
    It is important that a row in targettbl maps to at most at one row in srctbl, or else the result will not be predictable.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Updating a table to add a count of duplicates to each row

    I wondered if it is possible to do the following using a single SQL statement?
    To simplify my example, I have a table such as:
    create table tempftm_dups (product_id number, product_name varchar2(10), duplicate_count number);
    insert into tempftm_dups (product_id, product_name)
    values (1, 'CD');
    insert into tempftm_dups (product_id, product_name)
    values (2, 'BOOK');
    insert into tempftm_dups (product_id, product_name)
    values (3, 'DVD');
    insert into tempftm_dups (product_id, product_name)
    values (4, 'BOOK');
    This gives the result as below:
    SQL> select * from tempftm_dups;
    PRODUCT_ID PRODUCT_NA DUPLICATE_COUNT
    1 CD
    2 BOOK
    3 DVD
    4 BOOK
    I would like to update the table so the the duplicate_count column shows the number of times the PRODUCT_NAME is duplicated within the table. (ie. rows 2 and 4 would show a DUPLICATE_COUNT = 2, whereas rows 1 and 3 would show DUPLICATE_COUNT = 1).

    Something like this should do the trick.
    update tempftm_dups      t
       set t.duplicate_count = (
            with w_counter as (
                    select td.product_name
                         , count(*)           cnt
                      from tempftm_dups       td
                     group by td.product_name
            select wc.cnt
              from tempftm_dups       td
                 , w_counter          wc
             where td.product_name  = wc.product_name
             and   td.product_id    = t.product_id
            )Hope this helps,
    Gregory
    Message was edited by:
    Canis Polaris
    removed extraneous join in final select

  • How to update a table that has hundred thousand rows?

    Hi all !
    I detect that I did wrong with column SHAPE (in GRAG table ) ,namely at Gtype : 3003
    (MDSYS.SDO_GEOMETRY(3003,50632625,'null',MDSYS.SDO_ELEM_INFO_ARRAY(1,5,1,1,2,1),MDSYS.SDO_ORDINATE_ARRAY(276.2339,-179.7433,0,276.2498,-179.7361, 0 ))
    And I need to update value Gtype :3003 to 3002 .
    My problem is I don't know how to implement it because GRAG table has 30000 rows . I cannot update every row manually .
    Do you have any advice ?

    AFAIK oracle11g cannot simply update SDO_GEOMETRY.
    so you have to create new SDO_GEOMETRY with all but one old values.
    try to modify this (I wrote it once to circumvent the cannot modify SDO_GEOMETRY problem):
    -- clones a geometry but with different values
    -- we can "alter" the SRID
    -- note: oracle 11g cannot modify geometries
    function alter_geometry(p_geo sdo_geometry, p_srid number default null)
    return sdo_geometry is
    v_result sdo_geometry;
    v_srid number;
    begin
    if p_srid is null then
    v_srid := p_geo.SDO_SRID;
    else
    v_srid := p_srid;
    end if;
    v_result := sdo_geometry(p_geo.SDO_GTYPE,
    v_srid,
    p_geo.SDO_POINT,
    p_geo.SDO_ELEM_INFO,
    p_geo.SDO_ORDINATES);
    return v_result;
    end alter_geometry;
    --then do an update like
    --test before with an create table as select
    update crack c set c.shape = alter_geometry(shape, ...)

  • Updating A Table in a for each row trigger

    I have a trigger,
    create or replace trigger ins_ibpm_temp_trig
    after update of ethic_dt on ethics_approval_info for each row
    My issue is that I need to update the ethics_approval_info for each record based on the ethics date that was updated. I am getting the error
    ORA-04091: table ORACLETEST.ETHICS_APPROVAL_INFO is mutating, trigger/function may not see it.
    So the issue here of course is that I am trying to update a table, that is already in the middle of updating. Is there any way to get around this?

    Try these links
    Link1
    Link2
    Regards,
    Abdetu..

  • Read only set for few rows of a column in a table (not ALV)

    Hi Gurus,
    I have a table with multiple rows and columns. Under a particular column, I have to make few rows as read only, few rows as editable based on a coondition. How can I achieve this. I know how to make the whole column as editable or read only. But I'm not able to achieve few rows in a particular column as editable and few read only. Please give me more detail code.
    Appreciate your help.
    Regards,
    David.

    Hello,
    That you can achieve by creating an attribute isReadOnly of type WDY_BOOLEAN in the context node that you bind to the TABLE. And set isReadOnly attribute based on your condition whether to set readonly or editable for all the context elements.
    And in the layout view, for the column which has to be made readOnly or editable, bind the property readOnly to the context attribute isReadOnly.
    When you run application, you will see the column as readOnly if the attribute was set to true and editable if it was set to false.
    Hope this helps!
    Regards,
    Srilatha

Maybe you are looking for

  • XmlAgg Order By in SQL Statement vs Stored Procedure - 9.2.0.3.0

    Hi All, I'm having a problem with the XMLAgg function's ORDER BY clause after upgrading to 9.2.0.3.0. I'm finding that I can succesfully execute a SQL statement with the XMLAgg ORDER BY clause, but cannot compile a stored procedure using ORDER BY. Be

  • EMG based DC motor control using labview

    I have a project where i need to use my EMG data to control DC motor using labview.I've already got the EMG signal by using ADinstrument and import the signal to labview. The problem is i don't know how to connect the signal with DC motor. This motor

  • It wont sync!

    OK, i keep trying to plug in my ipod and i want to press the "sync ipod" option under file but it will not let me click it. It isn't highlighted. Some please help, this is driving me insane. Does anyone know what this is, or how to fix it? Danielle

  • Images in smart build open right justified

    Has anyone else seen this. I've just opened an existing Keynote08 file in 09. And all my smart build push images have become right justified and off center. I can't find anyway of putting them back into the center. Can anyone help?

  • This entry already exists in the following tables 'Journal Entry' (OJDT)

    Forum, I'm 8.81 PL09. Yesterday we performed a stock count then updated quantities and then reconciled the stock posting. This correctly posted a journal to the relevant stock gain/loss account. Today we found that there had been a couple of mistakes