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

Similar Messages

  • Updating HRP table through abap codes - is it correct

    Hi all,
    In my hrp1001 table,I want that All Qualifications (Q) and Tasks (T) assigned to all the functional roles (ZF) existing in the system should be transferred to the positions(S) tagged to those respective functional roles.
    For that I am supposed to write a code which copies the entries from Qualifications (Q) and Tasks (T) and tag the same to the positions (S).
    Below is the sample code which is adding just one record to HRP1001 through abap statment. What I am curious to know is wheather it is logically correct to update HRP  table through abap statments or no. If not, Please let me know what should we do as a solution - should we update all records through LSMW of PP01 or any thing else we can do???
    REPORT  ZHRPAR0005 .
    TABLES: HRP1000, HRP1001.
    DATA IT_1001 LIKE HRP1001 OCCURS 5 WITH HEADER LINE..
    SELECT SINGLE * FROM HRP1001 INTO IT_1001 WHERE OTYPE = 'CP' AND PLVAR = '01' AND SCLAS NE 'S'.
    IT_1001-OTYPE = 'S'.
    APPEND IT_1001.
    INSERT INTO HRP1001 VALUES IT_1001.
    Thanks
    Ribhu

    Hi Ribhu..
    there are various FMs available for this purpose..
    use those... becasue if u directly insert, update or modify record in HRP1000 or HRP1001...
    then some related table might not be updated..
    So use FMs..
    RH_COPY_INFTY
    RH_CUT_INFTY
    RH_DELETE_INFTY
    RH_INSERT_INFTY
    RH_INVERT_RELA_INFTY
    RH_UPDATE_INFTY
    <b>For IT 1001 </b>
    RH_CUT_INFTY_1001_EXT
    RH_CUT_INFTY_1001_EXT_GENERIC
    RH_DELETE_INFTY_1001_EXT
    RH_DEL_INFTY_1001_EXT_GENERIC
    RH_INSERT_INFTY_1001_EXT
    RH_UPDATE_INFTY_1001_EXT
    RH_BASE_READ_INFTY_1001
    RH_READ_INFTY_1001
    RH_READ_INFTY_1001_EXT
    RH_READ_INFTY_1001_EXT_ONLY
    Reward if useful
    Regards
    Prax

  • Updating HRP tables through abap code- is it correct?

    Hi all,
    In my hrp1001 table,I want that All Qualifications (Q) and Tasks (T) assigned to all the functional roles (ZF) existing in the system should be transferred to the positions(S) tagged to those respective functional roles.
    For that I am supposed to write a code which copies the entries from Qualifications (Q) and Tasks (T) and tag the same to the positions (S).
    Below is the sample code which is adding just one record to HRP1001 through abap statment. What I am curious to know is wheather it is logically correct to update HRP table through abap statments or no. If not, Please let me know what should we do as a solution - should we update all records through LSMW of PP01 or any thing else we can do???
    REPORT ZHRPAR0005 .
    TABLES: HRP1000, HRP1001.
    DATA IT_1001 LIKE HRP1001 OCCURS 5 WITH HEADER LINE..
    SELECT SINGLE * FROM HRP1001 INTO IT_1001 WHERE OTYPE = 'CP' AND PLVAR = '01' AND SCLAS NE 'S'.
    IT_1001-OTYPE = 'S'.
    APPEND IT_1001.
    INSERT INTO HRP1001 VALUES IT_1001.
    Thanks
    Ribhu

    Hi Ribhu..
    there are various FMs available for this purpose..
    use those... becasue if u directly insert, update or modify record in HRP1000 or HRP1001...
    then some related table might not be updated..
    So use FMs..
    RH_COPY_INFTY
    RH_CUT_INFTY
    RH_DELETE_INFTY
    RH_INSERT_INFTY
    RH_INVERT_RELA_INFTY
    RH_UPDATE_INFTY
    For IT 1001
    RH_CUT_INFTY_1001_EXT
    RH_CUT_INFTY_1001_EXT_GENERIC
    RH_DELETE_INFTY_1001_EXT
    RH_DEL_INFTY_1001_EXT_GENERIC
    RH_INSERT_INFTY_1001_EXT
    RH_UPDATE_INFTY_1001_EXT
    RH_BASE_READ_INFTY_1001
    RH_READ_INFTY_1001
    RH_READ_INFTY_1001_EXT
    RH_READ_INFTY_1001_EXT_ONLY
    Reward if useful
    Regards
    Prax

  • How does SAP updates MKPF Table Through TCODE MB0A

    Hello There,
       how does SAP updates MKPF Table Through TCODE MB0A ( POST GOODS RECEIPT )? I tried to debug the same by posting GR, but could not figure out.
    Awaiting Reply
    Santosh

    Hi ,
    These are the table that are updated through the MB0A ,,
    DGESV DMAEX DMAKT DMAPE
    DMARM DMEAN DMKAL DMLAN
    DPROW DQMAT DUNGV MARA
    MARC MARD MBEW MFHM
    MLGN MLGT MPGD MPOP MVKE,
    MCHA, MCHB, MCHD.
    Regards,
    Bharani

  • Error while updating lookup table through PSI

    Hi,
    I am trying to update a lookuptable through PSI using following code : 
    $lookupTableGuid = $svcPSProxy.ReadLookupTables($EPMTYString, 0 , 1033).LookupTables | where {$_.LT_NAME -eq $Lookuptablename}
    $lookuptable = $svcPSProxy.ReadLookupTablesbyUids($lookupTableGuid.LT_UID, 1 , 1033)
    $lookuptablerowValues = $svcPSProxy.ReadLookupTablesbyUids($lookupTableGuid.LT_UID, 0 , 1033).LookupTableTrees
    #get lookup table count
    $lookuptableValues = $svcPSProxy.ReadLookupTablesbyUids($lookupTableGuid.LT_UID, 0 , 1033).LookupTableTrees
    $count = $lookuptableValues.Count +1
    #Insert the rows of table in Lookup Table
    foreach ($rows in $table)
    $value_Code = $rows.Item("Project_code")
    $value_Name = $rows.Item("project_desc")
    $GUID = [System.Guid]::NewGuid()
    $LookupRow = $lookuptable.LookupTableTrees.NewLookupTableTreesRow()
    $LookupRow.LT_STRUCT_UID = $GUID
    $LookupRow.LT_UID = $lookupTableGuid.LT_UID
    $LookupRow.LT_VALUE_TEXT = $value_Code
    $LookupRow.LT_VALUE_DESC = $value_Name
    $LookupRow.LT_VALUE_SORT_INDEX = ($count ++)
    $lookuptable.LookupTableTrees.AddLookupTableTreesRow($LookupRow)
    $error.clear()
    #Exceptions Handling :
    Try
    $svcPSProxy.UpdateLookupTables($lookuptable , 0 , 1 , 1033)
    Catch
    write-host "Error updating the Lookup table, see the error below:" -ForeGroundColor Red -BackGroundColor White
    write-host "$error" -ForeGroundColor Red
    Initially, I tried to run with value of $value_code as "AACL", the code worked.
    But when I tried to insert value of code as "AACL - ALKYL AMINES CHEMICALS LIMITED"
    I got following error:
    Exception calling "UpdateLookupTables" with "4" argument(s): "Response is not well-formed XML."
    I could not understand why this error is appearing as I just added ' - ' to my code value. I checked for validity of ' -  'in the targeted column. No issue with that.
    Please help.
    Thanks and regards,
    Jayesh

    Hi All,
    The entries are maintained from DB level.
    Thanks for the help.
    DVRK

  • PL/SQL Trying to update a table through trigger on the same table

    Hi everyone my name is Edwin and I'm new to this forum. I hope I can learn a lot from this community and over time contribute to it.
    The problem I'm facing at the moment is a tough one. I need to update a table (table a) with a value called block_id. This block_id is generated by a procedure I have written myself, the end result is stored in another table (table b). This block_id needs to be generated after certain rows of table a get updated with a trans_id. The trans_id is all the same for these rows in table a, but the generated block_id isn't. In my code I use an after update on collumn a of table a trigger. So if the the collumn gets updated the trigger fires. The trigger calls the procedure that generates the block_id and the procedure generates table b with all the block_id's. But then I want to update the rows in table a with the generated block_id in table b. The problem is that this self-deadlocks.
    You might think that this would call a recursive trigger, but I have written code in the trigger that checks if the block_id isn't allready filled in on table a.
    Also I really need all the values wich get updated (table a), so I believe a before update is also out of the question.
    And the first update of table a is done through an erp-packet and I can't get at that code, otherwise I would just have run my code from there.
    Message was edited by:
    user625855

    CREATE OR REPLACE TRIGGER block_id_trigger AFTER UPDATE ON unload_details_tab
    DECLARE
    current_transport_id NUMBER;
    check_value NUMBER;
    check_block_id NUMBER;
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    current_transport_id := get_curent_trans_id; --function that gets the current transport_id
    check_value := check_site_and_directive(current_transport_id); --function checks if this transport_id should have a block_id
    check_block_id := check_for_block_id(current_transport_id); --function checks if there isn't allready a block_id set.
    IF check_value = 1 AND check_block_id = 0 THEN
    create_blok_id_table(current_transport_id); --this procedure creates the blok_id in temptable
    UPDATE unload_details_tab a SET a.block_id = (SELECT DISTINCT b.blok_id FROM temptable b WHERE b.mark = a.mark_1) WHERE a.transport_id = current_transport_id; --this statement should update the table back, if I leave it out everything works fine, but when I leave it I get the self-deadlock error.
    ELSE
    null;
    END IF;
    END block_id_trigger;
    Ok, I cleaned the code somewhat.
    user625855

  • Updating two tables through JDBC

    <b>Hai,
    Can anybody please answer the following question?
    How can I update two table in Receiver by using JDBC Adapter at receiver side from single source structure.
    Thanks in advance.</b>

    Hi ,
    Create following structure for inbound data type to insert data in DB using JDBC receiver adapter here dbTableName1 is for first table and dbTableName2 for second table .
    <StatementName2>
    <dbTableName1 action="UPDATE_INSERT">
    <table>realDbTableName</table>
    <access>
    <col1>val1</col1>
    <col2>val2</col2>
    </access>
    <access>
    <col1>val11</col1>
    </access>
    </dbTableName1> 
    <dbTableName2 action="UPDATE_INSERT">
    <table>realDbTableName</table>
    <access>
    <col1>val1</col1>
    <col2>val2</col2>
    </access>
    <access>
    <col1>val11</col1>
    </access>
    </dbTableName2> 
      </StatementName2>
    Thanks ,
    Suvarna
    pls award pts if it helps

  • 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

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

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

  • Updating Database table through Format Trigger in 10g Reports

    Dear Users
    I'm using 10g Reports Rel.2. I'm using a report column as a hyperlink using SRW.Set_Hyperlink. I've taken 2 actions through this hyperlink. 1stly I'm callin a report from this link n 2ndly I'm running an update statement after the hyperlink statement like below:
    SRW.Set_Hyperlink('....');
    Begin
    Update table_name Set
    column_name=value;
    End;
    So the 1st statement is running well i.e report is being called but update statement is not executing. I've tried this both in HTMLCSS and PDF formats but Update statement is not executing. I was doing the same job successfully in 6i reports behind a button (except that report was being called using Srw.Run_Report). Is there any thing different in 10g reports for this job ???

    I'm using 'Update statement' behind the hyperlink in different situations for example I wish that a report should print only through a button or a hyperlink and its destination should be a printer. 2ndly I want to keep record of printed reports through updating a field against printed records in a table so that user should not be able to print a data again and again. I was doing this successfully in 6i behind a button but in 10g, report is being called through hyperlink but update statement below the report calling code does not execute.
    Have u understood the situation

  • 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

  • Can we update mseg table through badi mb-migo_badi or not???

    Hi Experts
    I had a requirement to add an additional tabstrip at the item level of MIGO transaction .
    I have implmeented the same using MB_MIGO_BADI .
    I have also added a field quantity on this tab.
    The problem now is i'm not able to update this field in the MSEG table.
    I have extended the MSEG table using append structures.
    Regards,
    Sunny

    use this fm inside ur badi
    J_1IEXGM_BADI_POST_DOCUMENT
    also chk this thread
    Re: MB_MIGO_BADI   IMPLEMENTATION
    кu03B1ятu03B9к
    Edited by: kartik tarla on Mar 11, 2009 12:12 AM

  • Updating a table through a manually created tabular form does not work.

    Hi Friends,
    I don't know why the "On submit - After computations and validations" process does not update the referenced table. May I miss something. Here is my source :
    select
    apex_item.hidden(1,eqp_id) id,
    apex_item.hidden(2,tcs_tcs_id) tcs,
    apex_item.text(3,eqp_equip_name,50) name,
    apex_item.text(4,eqp_equip_ident,50) ident,
    apex_item.text(5,eqp_equip_type,15) type
    from equip_physical
    where tcs_tcs_id = :P1_TCS_ID
    and here is the process source
    FORALL i IN 1..apex_application.g_f01.count
    UPDATE equip_physical
    SET eqp_equip_name=apex_application.g_f03(i),
    eqp_equip_ident=apex_application.g_f04(i),
    eqp_equip_type=apex_application.g_f05(i)
    WHERE eqp_id=apex_application.g_f01(i);
    No error message is displayed and my success message associated to the process is displayed. But the modified text field value is erased and the database table is not updated.

    I'd call it a bug/missing feature.
    It appears that within a Basic report, sorting on a column created using APEX_ITEM.DATE_POPUP2() does not sort by date.
    I'd file this with Oracle Support and see what they say.
    Include a link to this thread and your workspace login information.
    I got something to work by: (probably not what you want.)
    using the C004 column directly. (I just added it to the SQL code)
    setting the column's attribute "Display As" to "Date Picker"
    setting the column's attribute "Number /Date Format" to DD-MM-YYYY
    I suspect: since you don't start with p_idx => 1, this column becomes "1" ==> g_f01
    MK

  • 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

Maybe you are looking for

  • Monitoring IDoc Receiver Adapter

    Dear experts, in FILE -> XI -> IDoc scenarios erros are not shown correctly. Neither SXMB_MONI nor RWB shows errors for outbound status of the IDoc when I select for errors. If XI sends an IDoc to another System and the partner for the RFC connection

  • No ''BS: SRM-Portal(Basic Configuration) V1'' in /NWA Deply and Change

    Hi Expert i want to integrate SRM7.0 with Portal, Enviroment :                SRM7.0 AS ABAP                ERP 6.0SR3 AS ABAP/AS JAVA                BP for SRM7.0 has installed                SRM has been added into Trused System in Portal and i fol

  • Select records across multiple pages

    i have a resultset of 100 records. 10 records are displayed and pagination is displayed for the users to navigate to other pages. All this is accomplished using jstl. if the user selects 2 records on page 1, navigates to page 2 and selects 2 more rec

  • FormItem Vertical Alignment

    I have a custom skin for a TextInput that's inside a FormItem, and they don't align vertically.  The skin is fairly basic, and even has a fixed height.  I've dug through the FormItem and FormItemSkin trying to figure out how to fix this, but haven't

  • Install scripts location [SOLVED]

    In Ubuntu, I had all installed packages' install scripts, md5sum and file lists in /var/lib/dpkg/info. Where can I find this information (especially the install scripts) on arch? Last edited by doru001 (2013-07-01 16:43:03)