Scrolling-problem in an editable ALV-list

Hi,
I have built an <b>ALV-list</b> with one of the fields <b>open for input</b>. The user wants to use the arrow to scroll <u>down</u> through the table and update that particular field in every row. I have <b>2</b> questions about this:
- First of all, the cursor moves in a strange way. The first number of rows it stays in the right column, but then, out of the blue, it jumps back and forth to other columns after scrolling.
- Secondly, the field I want to edit is always in Insert-mode. Is there any way I can get it into Overwrite-mode? I cannot use the Tab-key, because of the lead-selection.
Thanks in advance for your help.
Kind regards,
Andre Moniharapon

Hi Vijay,
please don't get me wrong, I really appreciate your attempts to help me, but my problem is that when I press the Down-arrow it <u>doesn't</u> always go to the next cell in the <i>same</i> column. It sometimes goes to the next cell in <i>another</i> column. And if I can't force it to stay in the same column in some way, than my problem cannot be solved and I must think of another solution. So, I don't want the cursor to stay in the same field, I want it to go to the next cell in the same column. You got that right. Again, I really appreciate your help, but it looks more and more that there's no solution to my problem.
Kind regards,
Andre

Similar Messages

  • Editable ALV list

    All,
    In release 4.7 there is a possibility to create an editable ALV list (see programs BCALV_EDIT_xx).
    Now I want to use this functionality also in release 4.6B but I don't find these programs.
    Is this not possible in this release?
    Has someone already programmed an editable ALV list in this release?
    Regards,
    Kris

    Hello Kris,
    I must make myself clearer. There is a chance that these programs have got a slightly different name in 4.6B. So, just try and see if there's something in the development class SLIS through SE80.
    If you have already done that, then you just have to copy the code from 4.7 and paste it in the 4.6B system. hopefully, there will not be any syntax errors.
    Even if there are, When you have seen the program in 4.7, I don't see what the problem is in trying to write a similar program in 4.6B. It is the concept that matters, right ?
    Regards,
    Anand Mandalika.

  • Problem  in Printing the ALV list

    Hi,
       I have one problem with printing the ALV list. While printing the ALV list(thro Print Icon on application Tool bar) ,Fist page of my print out contains some other inforamtion.
      inforamtions included two tables
      first table  contains Sort Criteria, Ascdg, Descnd, Subtotal  columns.
      And second table contains Data statistics , number of
    columns.
    But from Second page onwards , my alv list printed correctly .
      How can i avoid the First page inforamtion and
          what is the Reason of coming like this?
    Thanks,
    Neptune.M

    I assume you are using function module Reuse_alv_grid_display or reuse_alv_list_display for ALV.
    If this is the case, there is a parameter called IS_PRINT that you need to supply while calling the function module.
    you can for exapmle declare
    data:
    printstruc type SLIS_PRINT_ALV.
    printstruc-NO_PRINT_LISTINFOS = 'X'.
    call function 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
    IS_PRINT = printstruc
    There are many other flags in is_print structures that you can use to manipulate the printing.
    Cheers!

  • Add(Copy)/Change/Delete in editable ALV list

    I want to add a column to my ALV list where the user can enter an 'A' to Copy, 'C' to Change or 'D' to Delete. If the user enters an 'A', the code needs to insert a new line into the ALV list.  After the user makes the changes on the screen and selects Save, I need the program to perform different functions depending on whether the user entered an 'A', 'C' or 'D' in the column.  I have never used an editable ALV list and would like to have some sample code to get started.  Does anyone have any code similar to what I am trying to do?
    Thanks.
    Sandy

    Hi,
    check this code... if you trying with ALV FM, and editable grid then check this code.
    REPORT  ZTESTDFALV1                             .
    *Data Declaration
    DATA: BEGIN OF T_EKKO,
      EBELN TYPE EKPO-EBELN,
      EBELP TYPE EKPO-EBELP,
    *  FLAG TYPE C,
    *  HANDLE_STYLE TYPE LVC_T_STYL,
    END OF T_EKKO.
      DATA: GD_REPID LIKE SY-REPID, "Exists
      REF_GRID TYPE REF TO CL_GUI_ALV_GRID. "new
    DATA: BEGIN OF IT_EKKO OCCURS 0.
            INCLUDE STRUCTURE T_EKKO.
    DATA: END OF IT_EKKO.
    DATA: BEGIN OF IT_BACKUP OCCURS 0.
            INCLUDE STRUCTURE T_EKKO.
    DATA: END OF IT_BACKUP.
    *ALV data declarations
    TYPE-POOLS: SLIS.                                 "ALV Declarations
    DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          GD_LAYOUT    TYPE SLIS_LAYOUT_ALV.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_FIELDCATALOG.
      PERFORM BUILD_LAYOUT.
      IT_BACKUP[] = IT_EKKO[].
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  build_fieldcatalog
    *       text
    FORM BUILD_FIELDCATALOG.
      REFRESH FIELDCATALOG.
      CLEAR FIELDCATALOG.
      FIELDCATALOG-FIELDNAME   = 'EBELN'.
      FIELDCATALOG-SELTEXT_M   = 'Purchase Order'.
      FIELDCATALOG-INPUT     = 'X'.
      FIELDCATALOG-EDIT     = 'X'.
      FIELDCATALOG-COL_POS     = 2.
      APPEND FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-FIELDNAME   = 'EBELP'.
      FIELDCATALOG-SELTEXT_M   = 'PO Item'.
      FIELDCATALOG-COL_POS     = 3.
      APPEND FIELDCATALOG.
      CLEAR  FIELDCATALOG.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    FORM BUILD_LAYOUT.
      "Permet d'ajuster les colonnes au text
    *  gd_layout-colwidth_optimize = 'X'.
    *  GD_LAYOUT-TOTALS_TEXT       = 'Totals'(201).
    *  gd_layout-box_fieldname = 'SELECT'.
    *  gd_layout-box_tabname   = 'IT_EKKO'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    FORM DISPLAY_ALV_REPORT .
      GD_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM        = GD_REPID
    *            i_callback_top_of_page   = 'TOP-OF-PAGE'
                I_CALLBACK_PF_STATUS_SET  = 'SET_PF_STATUS'
                I_CALLBACK_USER_COMMAND   = 'USER_COMMAND'
    *            i_grid_title             = 'My Title'
                IS_LAYOUT                 = GD_LAYOUT
                IT_FIELDCAT               = FIELDCATALOG[]
           TABLES
                T_OUTTAB                  = IT_EKKO
           EXCEPTIONS
                PROGRAM_ERROR             = 1
                OTHERS                    = 2.
      IF SY-SUBRC <> 0.
        WRITE:/ SY-SUBRC.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN EBELP
       UP TO 10 ROWS
        FROM EKPO
        INTO CORRESPONDING FIELDS OF TABLE  IT_EKKO.
    ENDFORM.                    " DATA_RETRIEVAL
    *                      FORM SET_PF_STATUS                              *
    FORM SET_PF_STATUS USING RT_EXTAB   TYPE  SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD_FULLSCREEN1' EXCLUDING RT_EXTAB.
    ENDFORM.                    "set_pf_status
    *&      Form  user_command
    *       text
    *      -->R_UCOMM    text
    *      -->RS_SELFIELDtext
    FORM USER_COMMAND  USING R_UCOMM LIKE SY-UCOMM
                             RS_SELFIELD TYPE SLIS_SELFIELD.
    <b>
    *then insert the following code in your USER_COMMAND routine...
      IF REF_GRID IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            E_GRID = REF_GRID.
      ENDIF.
      IF NOT REF_GRID IS INITIAL.
        CALL METHOD REF_GRID->CHECK_CHANGED_DATA
      ENDIF.</b>*modify
      CASE R_UCOMM.
        WHEN '&IC1'.
          CHECK RS_SELFIELD-TABINDEX > 0.
          IF RS_SELFIELD-VALUE EQ '6000000001'.
            CALL TRANSACTION 'ZDF2'.
          ENDIF.
        WHEN 'REFRESH'.
          READ TABLE IT_EKKO INDEX  RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            READ TABLE IT_BACKUP INDEX RS_SELFIELD-TABINDEX.
            IF SY-SUBRC = 0.
              IF IT_EKKO <> IT_BACKUP.
    *  then do your check
              ENDIF.
            ENDIF.
          ENDIF.
          PERFORM DATA_RETRIEVAL.
          RS_SELFIELD-REFRESH = 'X'.
      ENDCASE.
    ENDFORM.                    "user_command
    regards
    vijay

  • Search Help For An Editable ALV List

    Hi,
    All ABAP Gurus !!
    I have made an Editable ALV with the fields of ZTable. In ALV I want the search help in one of the columns.The entry in that should come from the standard table name-TVM5 and the field which should come is MVGR5. MVGR5  does not contain the search help .Following are the description for my ZTable-------
    Field Name    - MC_NO,
    Data Element - ZZMC_NO1,
    Domain          -ZZMC_NO1.
    While creating this ZTable, in the Entry help/check tab I have also mention Input help with fixed values in the column- Origin of the input help and entered the entries also.
    About ALV (Only one alv column is shown here for reference in which search help or input help is needed of all the possible entries)---
    DATA: INT_FIELDCATALOG2 TYPE LVC_T_FCAT WITH HEADER LINE.
    DATA: WA_FIELDCATALOG2  TYPE LVC_S_FCAT ,
               WA_LAYOUT2        TYPE SLIS_LAYOUT_ALV ,
              GD_LAYOUT2        TYPE LVC_S_LAYO.     "slis_layout_alv.
      WA_FIELDCATALOG2-FIELDNAME      = 'MC_NO'.
      WA_FIELDCATALOG2-TABNAME        = 'T_ITAB2'.            " T_ITAB2 contains all the other fields
      WA_FIELDCATALOG2-SCRTEXT_M     = 'Machine No.'.
      WA_FIELDCATALOG2-EDIT                  = 'X'.
      WA_FIELDCATALOG2-F4AVAILABL   = 'X'.
      WA_FIELDCATALOG2-REF_FIELD       = 'MVGR5'.
      WA_FIELDCATALOG2-REF_TABLE     = 'TVM5'.
    APPEND WA_FIELDCATALOG2 TO INT_FIELDCATALOG2.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          I_CALLBACK_PROGRAM              = V_REPID
          I_CALLBACK_PF_STATUS_SET   = 'SET_PF_STATUS1'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          IT_FIELDCAT_LVC                        = INT_FIELDCATALOG2[]
          IS_LAYOUT_LVC                         = GD_LAYOUT2
        TABLES
          T_OUTTAB                 = T_ITAB2.
    Please explain in detail
    Thanks to all in advance.

    Please check the following links :
    F4 help -- on editable alv field.
    F4 help in editable ALV
    ALV Editable Grid Control F4 help problem
    And search the forum for  f4 help on editable alv
    KR
    Veeranji Reddy P.

  • How to save edited ALV List.

    hi all,
    i have created a program which displays two ALV LISTS and i made some of the fileds editable by using input key. Now when i press the SAVE button ,i couldnt capture the edited fileds contents .
    have a look at the code below .
    call function 'REUSE_ALV_BLOCK_LIST_INIT'
        exporting
          i_callback_program             = sy-repid
          i_callback_pf_status_set       = 'SET_PF_STATUS'
          i_callback_user_command        = 'USER_COMMAND'.
    *---------------------for top of page----------------*
          xs_event-name = slis_ev_top_of_page.
          xs_event-form = 'TOP_OF_PAGE'.
          append xs_event to IT_events.
          xs_event-name = slis_ev_top_of_page.
          xs_event-form = 'TOP_OF_PAGE1'.
          append xs_event to IT_events1.
    *---------------------appending 1st alv---------------*
        if not it_DATA is initial.
        call function 'REUSE_ALV_BLOCK_LIST_APPEND'
          exporting
            is_layout                        = gd_layout
            it_fieldcat                      = it_fieldcat
            i_tabname                        = 'IT_DATA'
            it_events                        = IT_events
          tables
            t_outtab                         = it_DATA.
      endif.
    *---------------------appending 2nd alv---------------*
       call function 'REUSE_ALV_BLOCK_LIST_APPEND'
          exporting
            is_layout                        = gd_layout1
            it_fieldcat                      = it_fieldcat1
            i_tabname                        = 'IT_PEND'
           it_events                        = IT_events1
          tables
            t_outtab                         = IT_PEND.
    *---------------------ALV Display------------------------------*
      gt_print-reserve_lines = 2.
          call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
         exporting
           is_print                      = gt_print.
    endform.                    " report_output
    regards,
    Venkat

    i was able to get the changed data in ALV grid by this code
    data: gd_repid like sy-repid,
            ref_grid type ref to cl_gui_alv_grid.
      if ref_grid is initial.
        call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          importing
            e_grid = ref_grid.
      endif.
      if not ref_grid is initial.
        call method ref_grid->check_changed_data .
    endif.
    is there any equivalent code for ALV LIST like the above code??

  • ALV list which is editable ?     :-)   :-)

    Hi Team,
             Can you please guide me on how to Create an editable ALV list output (step by step,, Please).
    I am only familiar with normal ALV list.
    Thanks...Aby Jacob

    Hi Sükrü
            Thanks,that was a really fast answer.   
    Your suggestion ( BCALV_EDIT_**)
    was really helpful in solving my problem.
    warm regards......Aby

  • Check unchanged data in an editable alv grid

    Hi,
    I have a problem with my editable ALV. As long as I'm changing my data the event DATA_CHANGED is raised and my fields are checked correctly. But what about unchanged data like appended rows. In that case no changes have been made and the event is not triggered.
    Even if i raise the event by using the method:      
    CALL METHOD gr_grid1->check_changed_data
        IMPORTING
          e_valid   = lv_valid
        CHANGING
          c_refresh = lv_refresh.
    there are no changed data so that my checks:
    FORM data_changed USING  lr_data_changed TYPE REF TO
                                             cl_alv_changed_data_protocol.
      DATA: ls_mod_cells TYPE lvc_s_modi.
      DATA: ls_cells TYPE lvc_s_modi,
            lv_value TYPE lvc_value ,
            lv_matnr TYPE matnr,
            lv_maktx TYPE maktx,
            lv_error TYPE c.
      CLEAR lv_error.
      LOOP AT lr_data_changed->mt_good_cells INTO ls_mod_cells.
        CASE ls_mod_cells-fieldname.
          WHEN 'MATNR'.
            CALL METHOD lr_data_changed->get_cell_value
              EXPORTING
                i_row_id    = ls_mod_cells-row_id
                i_fieldname = 'MATNR'
              IMPORTING
                e_value     = lv_value.
    * CHECK MARA SEGMENT
            SELECT SINGLE mara~matnr
                          makt~maktx INTO (lv_matnr,
                                           lv_maktx)
                                      FROM mara AS mara
                                INNER JOIN makt AS makt
                                        ON mara~matnr = makt~matnr
                                WHERE mara~matnr = lv_value AND
                                      makt~spras = sy-langu.
            IF NOT sy-subrc IS INITIAL.
              CALL METHOD lr_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = 'M3'
                  i_msgno     = '305'
                  i_msgty     = 'E'
                  i_msgv1     = lv_value
                  i_fieldname = ls_mod_cells-fieldname
                  i_row_id    = ls_mod_cells-row_id.
              lv_error = 'X'.
            ELSE.
              CALL METHOD lr_data_changed->modify_cell
                EXPORTING
                  i_row_id    = ls_mod_cells-row_id
                  i_fieldname = 'MAKTX'
                  i_value     = lv_maktx.
            ENDIF.
          WHEN OTHERS.
        ENDCASE.
      ENDLOOP.
    ENDFORM.
       are not working.
    Thank you for your help
    Gregor
    Edited by: Gregor Sure on Oct 13, 2009 1:58 PM

    Try to capture the event DATA_CHANGED_FINISHED. You can use the method REGISTER_EDIT_EVENT of the class CL_GUI_ALV_GRID to register the edit events.
    Regards,
    Naimesh Patel

  • Save changed data in editable ALV

    Hi experts,
    I have a problem with an editable ALV. I get data out of a table and show it with my web dynpro application in an alv. Now I made the alv editablke, so that I can change the content of each cell in the alv in the web browser. But how will this changed data be saved? I want that it will be changed after ENTER or clicking a save button. I have a button, but all I tried yet brought no success.
    Which code has to be in which method? Have I to do something eith the context. How can I reach that the changed content is also changed in the table, so that after reload the web dynpro application, the changed content is shown?
    It would be nice if you had an answer with code examples and the exact place where to put it in, because I am very new to ABAP and WD4A.
    Thanks a lot!
    Best Regards
    Ingmar

    If you look on the following lokn, there is the tutorial "Editing ALV in Web Dynpr for ABAP".
    There is described how to save the data. But in the implementation of On_data_check on page 8 and 9 the code detail for saving the data to database is missing, because the flight model shall not be changed.
    Would the missing code be the solution? What is the code?
    Thanks!!!
    Best Regards Ingmar
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1

  • Error message when running editable alv

    Hi all,
    I hava a problem with an editable ALV. I created it with the following method wddoinit:
    METHOD wddoinit .
    initialize ALV Component
      DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
      l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
    Get model data
      DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
      l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
      DATA:
      l_value TYPE REF TO cl_salv_wd_config_table.
      l_value = l_ref_interfacecontroller->get_model( ).
    set read only mode to false (and display edit toolbar)
      DATA: lr_table_settings TYPE REF TO
      if_salv_wd_table_settings.
      lr_table_settings ?= l_value.
      lr_table_settings->set_read_only( abap_false ).
    set cell editor for input fields (~make colum editable)
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
      lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
      lr_column_settings ?= l_value.
      lr_column = lr_column_settings->get_column( 'SAMPLE' ).
      CREATE OBJECT lr_input_field
        EXPORTING
          value_fieldname = 'SAMPLE'.
    lr_column->set_cell_editor( lr_input_field ).
    ENDMETHOD.
    But when I run the Web Dynpro Application I get an error message with the note:
    "Access over "Null" Object Reference not possible" ( I translated it from german to english )
    The error occures in the line:
    lr_column->set_cell_editor( lr_input_field ).
    But what is wrong?
    Thanks for your help!!
    Regards
    Ingmar

    Sorry. I'm stupid. I didn't the "Sample" for column and field!!!
    But:
    How can I reach that not only one cell is editable, but the whole table? And how can I save the data that I put in, when I add a new line?
    Thanks!!

  • Editable ALV issue: When Delete/Modify a row, ztable doesnt reflect changes

    Greeting Fellow Abapers,.
    I have been running into an issue that I need some advice on.  I am allowing users to edit a Ztable via ALV.  When the quantity field is updated everything is fine. However, when the field "lic_plate" is edited the code appends another row into the Ztable instead of modifying it.  Also, when the delete row functionality of the grid is used the row is not deleted from the Ztable.
    Here is the ztable structure. The fields I allow to be edited are in BOLD...
    ZPALLET-VBELN
    ZPALLET-MATNR
    ZPALLET-LINE_NUM
    ZPALLET-LIC_PLATE
    ZPALLET-LOT_NUMBER
    ZPALLET-PAL_TYPE
    ZPALLET-MAN_DATE
    ZPALLET-QUANTITY
    ZPALLET-PROC_DATE
    Here is the source code that the APPEND is taking place...
    FORM save_database .
    Getting the selected rows index*
      CALL METHOD o_grid->get_selected_rows
        IMPORTING
          et_index_rows = i_selected_rows.
    Through the index capturing the values of selected rows*
      LOOP AT i_selected_rows INTO w_selected_rows.
        READ TABLE itab INTO wa INDEX w_selected_rows-index.
        IF sy-subrc EQ 0.
          MOVE-CORRESPONDING wa TO w_modified.
          APPEND w_modified TO i_modified.
        ENDIF.
      ENDLOOP.
    IF sy-subrc = 0.
        MODIFY zpallet FROM TABLE i_modified.
    ENDIF.
    ENDFORM.
    Please help. I am in your debt.
    ...as always, points will be awarded.
    Best,
    Dan

    Hello Dan
    When you are using an editable ALV for table maintenance you have to take care that the users
    - cannot edit the key fields of existing DB records   and
    - every new record (row) does not match any existing record (i.e. has identical key field values)
    Instead of relying on selected rows for the DB update I would recommend to store a "PBO image" of your data and compare this with the "PAI image" of the data as soon as the user pushes the SAVE button.
    Example:
    DATA:
      gt_outtab_pbo    TYPE   < your table type>,  " PBO image
      gt_outtab           TYPE   < your table type>.  " PAI image
    " 1. Select data from DB table and store in both itabs:
      SELECT * ... INTO TABLE gt_outtab.
      gt_outtab_pbo = gt_outtab.
    " 2. Display editable ALV list -> user modifies gt_outtab
    " 3. SAVE function requested
    " ... compare gt_outtab vs. gt_outtab_pbo
    " .... INSERT, UPDATE, or DELETE DB records
    " Finally set:
      gt_outtab_pbo = gt_outtab.
    " 2. User continues with editing
    In order to compare PBO vs. PAI data you may have a look at my sample coding:
    [Comparing Two Internal Tables - A Generic Approach|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/comparing%2btwo%2binternal%2btables%2b-%2ba%2bgeneric%2bapproach]
    Regards,
      Uwe

  • Editable alv: add custom validation and display "errors" in protocol list

    Hi,
    What I want to do:
    PAI validation of editable alv with displaying error's in the protocol list by adding custom entries to the existing protocol object.
    What is my problem:
    After registering "data_changed event", the protocol list don't appear.
    My understanding is, that the object "er_data_changed" is passed by the event "data_changed"
    an so I thought I can add some more entries to the protocol list.
    After "de-registering" the "data_changed" event, the protocol appears with the standard errros messages (e.g. "input to numeric" by enter charachters)
    One more hint:
    By creating a new object "er_data_changed" in the handler method the protocol list works, but I would like to append entries to the object that was passed with the event.
    Probably I've misunderstand something, please help !
    My coding:
    PAI:
    trigger event "data_changed" -> calls handler method
      CALL METHOD r_myalv->check_changed_data
        IMPORTING
          e_valid = is_valid.
    stop processing
      IF is_valid NE 'X'.
        MESSAGE 'invalid input' TYPE 'E' .
      ENDIF.
    handler method:
    handle_data_changed FOR EVENT data_changed  OF cl_gui_alv_grid  IMPORTING e_ucomm
                                                                                    er_data_changed.
    METHOD handle_data_changed.
        data: ls_mod_cell type lvc_s_modi.
         CALL METHOD er_data_changed->add_protocol_entry
                    EXPORTING
                           i_msgid     = 'SU'
                           i_msgty     = 'E'
                           i_msgno     = '000'
                           i_msgv1     = 'This is a test !'
                           i_fieldname = ls_mod_cell-fieldname.
         er_data_changed->refresh_protocol( ).
         er_data_changed->DISPLAY_PROTOCOL( ).
    ENDMETHOD.                    "handle_data_changed

    Dear Olaf,
        If understood correctly, you want to Edit an ALV and do some data validations when some data is changed in an ALV.   To do this follow the following steps:
    1.   Before displaying ALV, Register the edit event.
    * Set cell modified to trigger data_changed
    CALL METHOD go_alv_grid->register_edit_event
    EXPORTING
    i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    2.  Register the event DATA_CHANGED of class CL_GUI_ALV_GRID & handle the event.
    SET HANDLER lo_event_receiver->handle_data_changed FOR go_alv_grid.
    The event DATA_CHANGED of class CL_GUI_ALV_GRID has a parameter ER_DATA_CHANGED which is of type CL_ALV_CHANGED_DATA_PROTOCOL.
    This er_data_changed has internal table MT_MOD_CELLS(contains index of records changed ) & MP_MOD_ROWS(contains the changed row), using these update your internal table accordingly.
    DATA : wa_mod_cell TYPE lvc_s_modi.
    FIELD-SYMBOLS: <fs> TYPE table.
    LOOP AT er_data_changed->mt_mod_cells INTO wa_mod_cell.
    ASSIGN er_data_changed->mp_mod_rows->* TO <fs>.
    READ TABLE <fs> INTO wa_output INDEX wa_mod_cell-tabix.
    MODIFY lt_output FROM wa_output INDEX wa_mod_cell-row_id.
    ENDLOOP.
    3.   Here it self you can do the required data validations(No need of any PAI modules) as below.
    IF wa_orders-zfstfirmtyp = c_9.
    MESSAGE s288(zcsp).
    DELETE er_data_changed->mt_mod_cells.
    EXIT.
    ENDIF.
    Regards
    Kesava

  • Drop-down list in editable ALV

    Hello all,
    Does anyone know how to display the values instead of the internal values when using the alias table to specify a drop-down list in an editable ALV grid ?
    Apparently the BC_ALV* examples have the same problem.
    thx
    Pieter

    Hi,
    These links will help you to implement a drop down list...
    http://help.sap.com/saphelp_46c/helpdata/en/9f/dbabe435c111d1829f0000e829fbfe/content.htm
    Also refer the pgm:
    RSDEMO_DROPDOWN_LISTBOX
    BCALV_TEST_GRID_F4_HELP
    Also take a look the SAP example program BCALV_TEST_GRID_EDITABLE.  It has a working Drop Down List Box.
    You have to fill a table of type lvc_t_drop. In this you set a handle and value for every item you want to have in a all possible drop down lists. You will later connect a sub set of this data to your grid display data by joining on this handle. You can then send this table to your ALV grid using the method SET_DROP_DOWN_TABLE. You will also want to set the DRDN_FIELD in your field catalog to the field name in your data table that will contain the handle for the values in your drop down table you want to expose. You will need to add this field to your data table.
    Best Regards,
    Anjali

  • How to edit particular field in alv list display-urgent

    HI ALL,
    my requirement is i am displaying output using alv list display. now my rewuirement :
    i am displaying out in edit mode only. when user clicks one particular field
    for example record is like
    runrate a01 maheed  -> if user clicks on a01 this field should be editable. i have a following code
      w_field-edit = w_edit.
      w_field-input = 'X'.    -> using this code i can able to display entire colomn in edit mode. this not suits my requirement.anybody can send me the sample code please.
    thanks,
    maheedhar.t

    Can you please send me the sample code plz.
    i am sending my code below.
    type-pools : slis.
    tables : zuser_secobjects.
    data : t_header1 like zuser_secobjects.
    data : begin of it_secobjects occurs 0.
            include structure t_header1.
    data :   checkbox type c value 'X',
            action type c,
          end of it_secobjects.
    data : begin of it_secobjects1 occurs 0.
            include structure ZUSER_SECOBJECTS.
    data :   checkbox type c VALUE 'X',
          end of it_secobjects1.
    data : wa_ita like line of it_secobjects.
    data : i_field type slis_t_fieldcat_alv with header line.
    data : w_field like line of i_field.
    data : i_sort type slis_t_sortinfo_alv.
    data : w_sort like line of i_sort.
    data : it_filt1 type slis_t_filter_alv with header line.
    data:
    i_tabname type tabname,
    i_repid like sy-repid,
    is_lout type slis_layout_alv.
    data :   it_filt type slis_t_filter_alv   with header line,
             it_evts type slis_t_event        with header line.
    DATA : is_vari type disvariant.
    constants :   c_default_vari value 'X',
                  c_save_vari    value 'U',
                   c_checkfield type slis_fieldname     value 'ACTION',
                   c_f2code     type sy-ucomm           value '&ETA'.
    data : chk_box type slis_fieldname.
    selection-screen: begin of block b1 with frame title text-t01.
    parameters : p_appln type zuser_secobjects-appln.
    parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
    p_partnr type zuser_secobjects-appln_partner,
    p_ptype type zuser_secobjects-partner_type default '02',
    p_upostn type zuser_secobjects-user_position,
    p_sdate like likp-erdat default sy-datum,
    p_edate(10) default '12/31/9999',
    p_revnum type zuser_secobjects-revnum,
    p_cted type zuser_secobjects-created_by,
    p_cdate type zuser_secobjects-creation_date,
    p_ctime type zuser_secobjects-creation_time,
    p_chnby type zuser_secobjects-changed_by,
    p_cdate1 type zuser_secobjects-changed_date,
    p_ctime1 type zuser_secobjects-changed_time.
    selection-screen: end of block b1.
    form user_command using p_ucomm like sy-ucomm
    rs_selfield type slis_selfield.
      case p_ucomm.
        when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
          loop at it_secobjects into wa_ita.
            wa_ita-checkbox = 'X'.
            modify it_secobjects from wa_ita.
          endloop.
      rs_selfield-refresh = 'X'.   "<-  ADD THIS
      when 'DESLCT_ALL'.
        loop at it_secobjects into wa_ita.
            wa_ita-checkbox = ' '.
            modify it_secobjects from wa_ita.
          endloop.
    rs_selfield-refresh = 'X'.   "<-  ADD THIS
       is_lout-f2code               = c_f2code.
       is_lout-box_fieldname        = c_checkfield.
       is_lout-get_selinfos         = 'X'.
       is_lout-detail_popup         = 'X'.
       is_lout-detail_initial_lines = 'X'.
    maheed-start.
    *when 'SAVE'.
    *LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
    MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
    APPEND IT_SECOBJECTS1.
    CLEAR IT_SECOBJECTS1.
    DELETE IT_SECOBJECTS.
    *ENDLOOP.
    *DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
    WHEN 'DELETE'.
        loop at it_SECOBJECTS where checkbox eq 'X'.
            delete it_SECOBJECTS.
        endloop.
    *RS_SELFIELD-REFRESH = 'X'.
    maheed-end.
    maheed-start.  apr 13
    WHEN 'DELETE'.
    loop at it_SECOBJECTS where checkbox eq 'X'.
    MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
    APPEND IT_SECOBJECTS1.
    delete it_SECOBJECTS.
    endloop.
    RS_SELFIELD-REFRESH = 'X'.
    when 'SAVE'.
    DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
    commit work.
    refresh :IT_SECOBJECTS1.
    maheed-end.    apr 13
    *when 'SAVE'.
    *LOOP AT IT_SECOBJECTS WHERE CHECKBOX = 'X'.
    MOVE-CORRESPONDING IT_SECOBJECTS TO IT_SECOBJECTS1.
    APPEND IT_SECOBJECTS1.
    CLEAR IT_SECOBJECTS1.
    DELETE IT_SECOBJECTS.
    *ENDLOOP.
    *DELETE ZUSER_SECOBJECTS FROM TABLE IT_SECOBJECTS1.
    ENDCASE.
    endform.
    *&      Form  delete
    form delete.
      data : begin of is_secobjects occurs 0.
              include structure zuser_secobjects.
      data : checkbox type c.
      data : end of is_secobjects.
      is_secobjects-checkbox = 'X'.
      modify is_secobjects
        from it_secobjects
        transporting checkbox
      where checkbox = 'X'.
    endform.
    *&      Form  get_data
    form get_data.
      select * from zuser_secobjects
      into table it_secobjects.
    endform.                    " get_data
    *&      Form  prepare_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    form prepare_fieldcatalog." USING w_edit TYPE any.
    data : w_edit type c.
    clear w_edit.
      clear: w_field,i_field.
      refresh:i_field.
      i_field-key = 'X'.
      i_field-col_pos = 1.
      i_field-ddictxt = 'S'.
      i_field-seltext_s = '@11@'.
    i_field-checkbox = 'X'.
      i_field-input = 'X'.
      i_field-fieldname = 'HEADER'.
      i_field-outputlen = 0.
      append i_field.
      clear i_field.
      w_field-fieldname = 'APPLN'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-seltext_l = text-m01.
      w_field-outputlen = '10'.
      w_field-EDIT = 'X'.      "maheed
      w_field-col_pos = 1.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'APPLN_USER'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m02.
      w_field-outputlen = '7'.
      w_field-col_pos = 2.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'APPLN_PARTNER'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m03.
      w_field-edit = w_edit.
      w_field-input = 'X'.
      w_field-outputlen = '7'.
      w_field-col_pos = 2.
      append w_field to i_field.
      clear w_field.
      w_field-fieldname = 'INACTIVE'.
      w_field-tabname = 'IT_SECOBJECTS'.
      w_field-just = 'C'.
      w_field-seltext_l = text-m02.
      w_field-outputlen = '7'.
      w_field-col_pos = 3.
      append w_field to i_field.
      clear w_field.
    endform.                    " prepare_fieldcatalog
    *&      Form  ALV_LIST_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    form alv_list_display.
    DATA : LC_GLAY TYPE LVC_S_GLAY.
    LC_GLAY-EDT_CLL_CB = 'X'.
      i_repid = sy-repid.
      is_lout-box_fieldname = 'CHECKBOX'.
      it_filt-fieldname = 'ACTION'.
      call function 'REUSE_ALV_LIST_DISPLAY'
           exporting
                i_callback_program       = i_repid
                i_callback_pf_status_set = 'PF_STATUS_SET'
                i_callback_user_command  = 'USER_COMMAND'
                is_layout                = is_lout
                it_fieldcat              = i_field[]
                it_filter                = it_filt[]
                 it_events                = it_evts[]
                i_default                = c_default_vari
                i_save                   = c_save_vari
                is_variant               = is_vari
           tables
                t_outtab                 = it_secobjects.
    endform.                    " ALV_LIST_DISPLAY
    *&      Form  display
          text
         -->P_I_OBJECT  text
    form display using    object.
      case object.
    ENDCASE.
    endform.                    " display
    thanks,
    maheedhar.t

  • Editable field in alv list display

    i WANT TO GIVE COLOR FOR EDITABLE FIELD IN ALV LIST DISPLAY.i TRIED WITH EMPHASIZE IN FIELD CATALOGUE ASSIGNING.bUT,IT IS NOT WORKING.HOW TO DO.tHANX IN ADVANCE.........

    HI,
    Please refer the link below:
    http://www.****************/Tutorials/ALV/Edit/demo.htm
    http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
    Thanks,
    Sriram Ponna.

Maybe you are looking for