Editing o/p of alv

how to edit the output of alv report and alvgrid .ans plz asap.

hi,
how to edit the output of alv report and alvgrid
here is the code for one cell edit based on condition, rest of the cells in disable mode(just cope n paste in se38 and run the program)
*Essential steps (search for '§')
~~~~~~~~~~~~~~~
1.Extend your output table for a field, e.g., CELLTAB, that holds
  information about the edit status of each cell for the
  corresponding row (the table type is SORTED!).
2.After selecting data, set edit status for each row in a loop
  according to field SEATSMAX.
2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
   to status "editable".
2b.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_DISABLED to set a cell
   to status "non-editable".
2c.Copy your celltab to the celltab of the current row of gt_outtab.
3.Provide the fieldname of the celltab field by using field
  STYLEFNAME of the layout structure.
*for reference BCALV_EDIT_02
TABLES: VBAK.
TYPE-POOLS: ICON.
*& Declaration Section for the Internal Tables *
DATA: BEGIN OF GT_OUTTAB OCCURS 0.
        vbeln TYPE vbak-vbeln,
        erdat TYPE vbak-erdat,
        erzet TYPE vbak-erzet,
        ernam TYPE vbak-ernam,
        netwr TYPE vbak-netwr,
        INCLUDE STRUCTURE ZVBAK_INTERNAL1.
DATA: CELLTAB TYPE LVC_T_STYL.
DATA:   END OF GT_OUTTAB.
DATA: IT_VBAK TYPE TABLE OF ZVBAK_INTERNAL1 WITH HEADER LINE.
DATA: OK_CODE LIKE SY-UCOMM,
      SAVE_OK LIKE SY-UCOMM,
      G_CONTAINER TYPE SCRFNAME VALUE 'GRID_CONTROL',
      GRID1  TYPE REF TO CL_GUI_ALV_GRID,
      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      GS_LAYOUT TYPE LVC_S_LAYO,
      I_FCAT TYPE LVC_T_FCAT,
      W_FCAT TYPE LVC_S_FCAT.
CALL SCREEN 200.
*&      Module  STATUS_0200  OUTPUT
      text
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAIN100'.
  IF G_CUSTOM_CONTAINER IS INITIAL.
    CREATE OBJECT G_CUSTOM_CONTAINER
      EXPORTING
        CONTAINER_NAME = G_CONTAINER.
    CREATE OBJECT GRID1
      EXPORTING
        I_PARENT = G_CUSTOM_CONTAINER.
    PERFORM SELECT_DATA_AND_INIT_STYLE.
*§3.Provide the fieldname of the celltab field by using field
  STYLEFNAME of the layout structure.
    GS_LAYOUT-STYLEFNAME = 'CELLTAB'.
creat of structure'ZVBAK_INTERNAL1'  like an internal table in se11.
    CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        I_STRUCTURE_NAME = 'ZVBAK_INTERNAL1'
        IS_LAYOUT        = GS_LAYOUT
       ls_fieldcat      = it_fieldcatalog
      CHANGING
        IT_OUTTAB        = GT_OUTTAB[]
IT_FIELDCATALOG = I_FCAT.
  ENDIF.
ENDMODULE.                 " STATUS_0200  OUTPUT
*&      Module  USER_COMMAND_0200  INPUT
      text
MODULE USER_COMMAND_0200 INPUT.
  SAVE_OK = OK_CODE.
  CLEAR OK_CODE.
  CASE SAVE_OK.
    WHEN 'EXIT'.
      PERFORM EXIT_PROGRAM.
    WHEN 'SWITCH'.
      PERFORM SWITCH_EDIT_MODE.
    WHEN OTHERS.
    do nothing
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0200  INPUT
*&      Form  exit_program
      text
-->  p1        text
<--  p2        text
FORM EXIT_PROGRAM .
  LEAVE PROGRAM.
ENDFORM.                    " exit_program
*&      Form  select_data_and_init_style
      text
-->  p1        text
<--  p2        text
FORM SELECT_DATA_AND_INIT_STYLE.
  DATA: LT_CELLTAB TYPE LVC_T_STYL,
        L_INDEX TYPE I.
  SELECT  VBELN
         ERDAT
         ERZET
         ERNAM
         NETWR UP TO 100 ROWS
         FROM VBAK
         INTO TABLE IT_VBAK.
move corresponding fields from lt_sflight to gt_outtab
  LOOP AT IT_VBAK.
    MOVE-CORRESPONDING IT_VBAK TO GT_OUTTAB.
    APPEND GT_OUTTAB.
  ENDLOOP.
*§2.After selecting data, set edit status for each row in a loop
  according to field NETWR.
  LOOP AT GT_OUTTAB.
    L_INDEX = SY-TABIX.
    REFRESH LT_CELLTAB.
    IF GT_OUTTAB-VBELN EQ '0000000080'.
      PERFORM FILL_CELLTAB USING 'RW'
                           CHANGING LT_CELLTAB.
    ELSE.
      PERFORM FILL_CELLTAB USING 'RO'
                           CHANGING LT_CELLTAB.
    ENDIF.
*§2c.Copy your celltab to the celltab of the current row of gt_outtab.
    INSERT LINES OF LT_CELLTAB INTO TABLE GT_OUTTAB-CELLTAB.
    MODIFY GT_OUTTAB INDEX L_INDEX.
  ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
   EXPORTING
     input  = input
   IMPORTING
     output = output.
ENDFORM.                    " select_data_and_init_style
*END-OF-SELECTION.
*&      Form  fill_celltab
      text
     -->P_0194   text
     <--P_LT_CELLTAB  text
FORM FILL_CELLTAB  USING    VALUE(P_MODE)
                   CHANGING P_LT_CELLTAB TYPE LVC_T_STYL.
  DATA: LS_CELLTAB TYPE LVC_S_STYL,
          L_MODE TYPE RAW4.
This forms sets the style of column 'PRICE' editable
according to 'p_mode' and the rest to read only either way.
  IF P_MODE EQ 'RW'.
*§2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
   to status "editable".
    L_MODE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.
  ELSE. "p_mode eq 'RO'
*§2b.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_DISABLED to set a cell
   to status "non-editable".
    L_MODE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
  ENDIF.
*if u assign L_MODE to ERDAT then that field should be in edit *rest in disable mode
  LS_CELLTAB-FIELDNAME = 'VBELN'.
  LS_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
  INSERT LS_CELLTAB INTO TABLE P_LT_CELLTAB.
  LS_CELLTAB-FIELDNAME = 'ERDAT'.
  LS_CELLTAB-STYLE = L_MODE.
  INSERT LS_CELLTAB INTO TABLE P_LT_CELLTAB.
  LS_CELLTAB-FIELDNAME = 'ERZET'.
  LS_CELLTAB-STYLE = L_MODE.
  INSERT LS_CELLTAB INTO TABLE P_LT_CELLTAB.
  LS_CELLTAB-FIELDNAME = 'ERNAM'.
  LS_CELLTAB-STYLE = L_MODE.
  INSERT LS_CELLTAB INTO TABLE P_LT_CELLTAB.
  LS_CELLTAB-FIELDNAME = 'NETWR'.
  LS_CELLTAB-STYLE = L_MODE.
  INSERT LS_CELLTAB INTO TABLE P_LT_CELLTAB.
ENDFORM.                    " fill_celltab
*&      Form  switch_edit_mode
      text
-->  p1        text
<--  p2        text
FORM SWITCH_EDIT_MODE.
  IF GRID1->IS_READY_FOR_INPUT( ) EQ 0.
set edit enabled cells ready for input
    CALL METHOD GRID1->SET_READY_FOR_INPUT
      EXPORTING
        I_READY_FOR_INPUT = 1.
  ELSE.
lock edit enabled cells against input
    CALL METHOD GRID1->SET_READY_FOR_INPUT
      EXPORTING
        I_READY_FOR_INPUT = 0.
  ENDIF.
ENDFORM.                    " switch_edit_mode
*&      Form  build_field_cat
FORM BUILD_FIELD_CAT.
  CLEAR I_FCAT.
  W_FCAT-COL_POS         = '1'.
  W_FCAT-FIELDNAME          = 'VBELN'.
  W_FCAT-REF_TABLE        = 'VBAK'.
  W_FCAT-SELTEXT          = 'Sales and Distribution'.
  APPEND W_FCAT TO I_FCAT.
  CLEAR W_FCAT.
  W_FCAT-COL_POS         = '2'.
  W_FCAT-FIELDNAME          = 'ERDAT'.
  W_FCAT-REF_TABLE        = 'VBAK'.
  W_FCAT-SELTEXT          = 'Date'.
  APPEND W_FCAT TO I_FCAT.
  CLEAR W_FCAT.
  W_FCAT-COL_POS         = '3'.
  W_FCAT-FIELDNAME          = 'ERZET'.
  W_FCAT-REF_TABLE        = 'VBAK'.
  W_FCAT-SELTEXT          = 'Entry time'.
  APPEND W_FCAT TO I_FCAT.
  CLEAR W_FCAT.
  W_FCAT-COL_POS         = '4'.
  W_FCAT-FIELDNAME          = 'ERNAM'.
  W_FCAT-REF_TABLE        = 'VBAK'.
  W_FCAT-SELTEXT          = 'Name of Person'.
  APPEND W_FCAT TO I_FCAT.
  CLEAR W_FCAT.
  W_FCAT-COL_POS         = '5'.
  W_FCAT-FIELDNAME          = 'NETWR'.
  W_FCAT-REF_TABLE        = 'VBAK'.
  W_FCAT-SELTEXT          = 'Net Value'.
  W_FCAT-CFIELDNAME         = 'NETWR_AK'.
  APPEND W_FCAT TO I_FCAT.
dont build w_fact-edit = 'X'. if u give like this , the entire colum *is in editable mode.
ENDFORM.                    " build_field_cat
Hope usefull to u lot , pls do reward points to me
Regards
Fareedas

Similar Messages

  • Editable column in OO ALV

    Hi all,
    Is it possible to make a column editable in the new ALV (cl_salv_table).
    I have a checkbox column but it is greyed out as I presume I need to make this field editable.
    Thanks

    Hi Gregor Brett
    step1: Add your structure inside create one lvc_t_styl type
    TYPES: BEGIN OF ty_cons.
            include TYPE z1259_str_cons as z1259_str_cons.
             TYPES cell TYPE lvc_t_styl.
    TYPES:    END OF ty_cons.
    TYPES ty_cons1 TYPE STANDARD TABLE OF ty_cons.
    Step2: Before calling set_table_for_first_display 
    DATA:
           ls_fcat        TYPE lvc_s_fcat.
       CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING
    *     I_BUFFER_ACTIVE                =
           i_structure_name                    = 'Z1259_STR_CONS'   " write your structure name
    *     i_client_never_display             = 'X'
    *     I_BYPASSING_BUFFER        =
    *     I_INTERNAL_TABNAME         =
         CHANGING
            ct_fieldcat                               = gt_fcat
          EXCEPTIONS
            inconsistent_interface             = 1
            program_error                        = 2
            OTHERS                               = 3.
       IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    step3: after that assign the layout ( stylefname and created lvc_t_styl name shoud be same)
    CLEAR: gs_layout.
       gs_layout-cwidth_opt = 'X'.
       gs_layout-no_toolbar = 'X'.
       gs_layout-zebra      = 'X'.
       gs_layout-sel_mode   = 'D'.
       gs_layout-no_toolbar = 'X'.
    *    ls_layout-grid_title = 'Material Master'.
    *gs_layout-edit       = abap_true. " entire grid editable
       gs_layout-stylefname = 'CELL'.
    step3: after that
    DATA lt_stylerow TYPE lvc_t_styl .
         DATA ls_stylerow TYPE lvc_s_styl .
    *    CALL METHOD obj_grid->get_selected_rows
    *      IMPORTING
    **        et_index_rows =
    *        et_row_no     = lt_index
         DATA: ls_outtab   TYPE z1259_str_cons,
               ls_fcat     TYPE lvc_s_fcat,
               ls_cell     TYPE lvc_s_styl,
               lt_celltab  TYPE lvc_t_styl,
               ls_row      TYPE lvc_s_row,
               lt_rows     TYPE lvc_t_row.
         CALL METHOD obj_grid->get_selected_rows
           IMPORTING
             et_index_rows = lt_rows.
         CHECK ( lt_rows IS NOT INITIAL ).
         LOOP AT gt_fcat INTO ls_fcat.
           ls_cell-fieldname = ls_fcat-fieldname.
           IF ( ls_cell-fieldname  = 'MATNR' ).
             ls_cell-style = cl_gui_alv_grid=>mc_style_disabled.
           ELSE.
             ls_cell-style = cl_gui_alv_grid=>mc_style_enabled.
           ENDIF.
           INSERT ls_cell INTO TABLE lt_celltab.  " sorted itab !!!
         ENDLOOP.
         DATA lv_inc TYPE i.
         CLEAR lv_inc.
         CLEAR lv_changed.
         LOOP AT lt_rows INTO ls_row.
           lv_inc = lv_inc + 1.
           lv_changed = lv_inc.
           READ TABLE gt_cons INTO gs_cons INDEX ls_row-index.
           gs_cons-cell = lt_celltab.
           MODIFY gt_cons FROM gs_cons INDEX ls_row-index.
         ENDLOOP.
         CALL METHOD obj_grid->set_ready_for_input
           EXPORTING
             i_ready_for_input = 1.
         CALL METHOD obj_grid->refresh_table_display
           EXCEPTIONS
             finished = 1
             OTHERS   = 2.
         IF sy-subrc <> 0.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
         ENDIF.
    Message was edited by: PARASURAMAN K
    Message was edited by: PARASURAMAN K

  • Editable Drop down in ALV

    Hi,
    I am working on the ALV report using objects (custom container
    and cl_gui_alv_grid).
    I have a drop down editable field in the alv. How can i capture the
    selected values in the dropdowns for all rows when a button is clicked on appln tool bar.
    Thanks,
    Prasad

    Hi,
    Refer demo programs:-
    BCALV_EDIT_06 --                 Dropdown Listbox at Column Level
    BCALV_EDIT_07 --                 Dropdown Listbox at Cell Level
    Also you can refer:-
    Alv Drop down filling
    Hope this helps you.
    Regards,
    Tarun

  • Edit and save dynamic alv.

    Hi Experts
    I have created a dynamic table then filled this dynamic table with the help of field symbols and then passed this dynamic table to grid1->set_table_for_first_display and hence the dynamic alv is shown on the screen. Now, can I do something to make this alv editable and store these values in z table. I have tried the method get_changed_cell method, but no help.
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = LT_LVC_CAT
        IMPORTING
          EP_TABLE        = LP_TABLE.
      ASSIGN LP_TABLE->* TO <LT_DATA>.
    *Create structure = structure of the internal table
      CREATE DATA LP_STRUCT LIKE LINE OF <LT_DATA>.
      ASSIGN LP_STRUCT->* TO <HEADER>.
    *  SORT gt_data BY erdat.
    *sort IT_VEWAO by MATNR.
      LOOP AT IT_VEWZO INTO WA_VEWZO.
        AT NEW VKBUR.
          CLEAR <HEADER>.
          ASSIGN COMPONENT 'VKBUR' OF STRUCTURE <HEADER> TO <FIELD>.
          IF SY-SUBRC NE 0.
            EXIT .
          ENDIF.
          <FIELD> = WA_VEWZO-VKBUR.
        ENDAT.
        MOVE WA_VEWZO-PD_HIER  TO L_COL.
        ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
        IF SY-SUBRC NE 0.
          EXIT .
        ENDIF.
        <FIELD> = WA_VEWZO-PLAN_QTY.
        CONCATENATE WA_VEWZO-PD_HIER '_AP' INTO WA_VEWZO-PD_HIER .
        MOVE WA_VEWZO-PD_HIER  TO L_COL.
        ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
        IF SY-SUBRC NE 0.
          EXIT .
        ENDIF.
        <FIELD> = WA_VEWZO-APROV_QTY.
        AT END OF VKBUR.
          APPEND <HEADER> TO <LT_DATA>.
        ENDAT .
      ENDLOOP.
    CREATE OBJECT CUSTOM_CONTAINER1
             EXPORTING
                  CONTAINER_NAME = 'CUST_CONT'.
      CREATE OBJECT GRID1
              EXPORTING
                  I_PARENT = CUSTOM_CONTAINER1.
      CALL METHOD grid1->REGISTER_EDIT_EVENT
              EXPORTING
                  i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
    *      I_STRUCTURE_NAME = lv_lp_struct
          IS_LAYOUT        = LS_LAYOUT
        CHANGING
    *      IT_SORT          = LT_SORT1
          IT_FIELDCATALOG  = LT_FIELDCAT
          IT_OUTTAB        = <LT_DATA>.

    Hi,
    What help u need?
    to activate the editable field u need to pass the field catalog parameter
    EDIT = 'X'
    Then Edit values in your alv
    and press enter or define any icons in ur alv list useing user command
    check the changed values using the method
    CALL METHOD g_alvgrid1->check_changed_data( ).
    It will help you i think.
    Regards,
    Nandha

  • How to add an editable checkbox to an alv grid

    Hi..
    I need to add an editable checkbox to a alv grid.
    I wouls appreciatet it if anyone could provide some sample code.
    The standard example  BCALV_EDIT_05 is an oops example... I need a simple example
    Please help
    thanks
    Karen

    hi
    after you pass a field as checkbox in fieldcat
    then in layout populate edit
    ex wa_layout-edit = 'X'.
    try the following code
    REPORT  ZALV5.
    TYPE-POOLS: slis.
    tables: mara.
    DATA: begin of it_mara OCCURS 0,
          matnr like mara-matnr,
          mbrsh like mara-mbrsh,
          matkl like mara-matkl,
          meins like mara-meins,
          ersda like mara-ersda,
          ernam like mara-ernam,
          W_CHK type c ,
         END OF it_mara.
    *data: it_mara like  mara occurs 0 with header line.
    data:it_feildtab type slis_t_fieldcat_alv,
         wa_fieldcat type slis_fieldcat_alv.
    *DATA: i_private TYPE slis_data_caller_exit,
    data:     i_selfield TYPE slis_selfield,
          W_exit(1) TYPE c.
    PARAMETERS: p_title TYPE sy-title default 'ALV'.
    START-OF-SELECTION.
      SELECT matnr mbrsh matkl meins  ersda ernam FROM mara
        INTO corresponding fields of  table it_mara.
    wa_fieldcat-col_pos   = '1'.
    wa_fieldcat-fieldname = 'W_CHK'.
    *wa_FIELDCAT-KEY = 'X'.
    *wa_fieldcat-tabname   = 'IT_MARA'.
    *wa_fieldcat-seltext_s = 'units of measure'.
    wa_fieldcat-checkbox = 'X'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos   = '2'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-key = 'X'.
    wa_fieldcat-hotspot = 'X'.
    wa_fieldcat-seltext_s = 'no'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    wa_fieldcat-col_pos   = '3'.
    wa_fieldcat-fieldname = 'MBRSH'.
    *wa_FIELDCAT-KEY = 'X'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-seltext_s = 'Ind.sec'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    wa_fieldcat-col_pos   = '4'.
    wa_fieldcat-fieldname = 'MATKL'.
    *wa_FIELDCAT-KEY = 'X'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-seltext_s = 'Description'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    wa_fieldcat-col_pos   = '5'.
    wa_fieldcat-fieldname = 'MEINS'.
    *wa_FIELDCAT-KEY = 'X'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-edit      = 'X'.
    wa_fieldcat-seltext_s = 'units of measure'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
           EXPORTING
                i_title                 = p_title
                i_selection             = 'X'
                i_zebra                 = 'X'
               I_SCREEN_START_COLUMN   = 0
               I_SCREEN_START_LINE     = 0
                I_SCREEN_END_COLUMN     = 0
               I_SCREEN_END_LINE       = 0
                i_checkbox_fieldname    = 'W_CHK'
              I_LINEMARK_FIELDNAME    =
              I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'IT_MARA'
              i_structure_name        = 'IT_MARA'
               IT_FIELDCAT             = it_feildtab
              IT_EXCLUDING            =
              I_CALLBACK_PROGRAM      =
              I_CALLBACK_USER_COMMAND =
               IS_PRIVATE             = I_PRIVATE
         IMPORTING
                es_selfield             = i_selfield
                e_exit                  = w_exit
           TABLES
                t_outtab                = it_mara
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
       MESSAGE i000(0k) WITH sy-subrc.
      ENDIF.
      LOOP AT it_mara WHERE W_CHK = 'X'.
        WRITE: /  it_mara-ersda, it_mara-ernam.
      ENDLOOP.
    reward if helpful
    prasanth

  • Edit One Cell In Alvs Based On Some Condition

    Hi Experts,
          My Requirement Is  :
    Has To *Edit one cell using alv grid *, for ex: If  Netpr > 100(value). that should be in editable mode,rest of the cells  in non-editable mode. pls let me know how to do it,
    best answer rewarded
    Reagrds,
    Fareedas.

    Hi Fareedas,
    The follow program demonstrates how to make individual fields of an ALV grid editable (NetPR greater than 10). Changes required from a basic ALV grid include adding a new field to ALV grid data table(it_ekko), Populating this field with style attribute and adding an entry to layout control table. Also from the previous examples used on this website you will also need to change the data type of the fieldcatalog, the layout and use a different function module for displaying the report
    *& Report  ZDEMO_ALVGRID_EDIT                                          *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display specific fields as          *
    *& editable depending on field value                                   *
    REPORT  ZDEMO_ALVGRID_EDIT                 .
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      field_style  TYPE lvc_t_styl, "FOR DISABLE
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER LINE,
          wa_fieldcat TYPE lvc_s_fcat,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM set_specific_field_attributes.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      wa_fieldcat-fieldname   = 'EBELN'.
      wa_fieldcat-scrtext_m   = 'Purchase Order'.
      wa_fieldcat-col_pos     = 0.
      wa_fieldcat-outputlen   = 10.
      wa_fieldcat-emphasize   = 'X'.
      wa_fieldcat-key         = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'EBELP'.
      wa_fieldcat-scrtext_m   = 'PO Item'.
      wa_fieldcat-col_pos     = 1.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'STATU'.
      wa_fieldcat-scrtext_m   = 'Status'.
      wa_fieldcat-col_pos     = 2.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'AEDAT'.
      wa_fieldcat-scrtext_m   = 'Item change date'.
      wa_fieldcat-col_pos     = 3.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MATNR'.
      wa_fieldcat-scrtext_m   = 'Material Number'.
      wa_fieldcat-col_pos     = 4.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MENGE'.
      wa_fieldcat-scrtext_m   = 'PO quantity'.
      wa_fieldcat-col_pos     = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MEINS'.
      wa_fieldcat-scrtext_m   = 'Order Unit'.
      wa_fieldcat-col_pos     = 6.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'NETPR'.
      wa_fieldcat-scrtext_m   = 'Net Price'.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      wa_fieldcat-col_pos     = 7.
      wa_fieldcat-outputlen   = 15.
      wa_fieldcat-datatype     = 'CURR'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'PEINH'.
      wa_fieldcat-scrtext_m   = 'Price Unit'.
      wa_fieldcat-col_pos     = 8.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    FORM build_layout.
    * Set layout field for field attributes(i.e. input/output)
      gd_layout-stylefname = 'FIELD_STYLE'.
      gd_layout-zebra             = 'X'.
    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'
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
           EXPORTING
                i_callback_program      = gd_repid
    *            i_callback_user_command = 'USER_COMMAND'
                is_layout_lvc               = gd_layout
                it_fieldcat_lvc             = it_fieldcat
                i_save                  = 'X'
           TABLES
                t_outtab                = it_ekko
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  set_specific_field_attributes
    *       populate FIELD_STYLE table with specific field attributes
    form set_specific_field_attributes .
      DATA ls_stylerow TYPE lvc_s_styl .
      DATA lt_styletab TYPE lvc_t_styl .
    * Populate style variable (FIELD_STYLE) with style properties
    * The NETPR field/column has been set to editable in the fieldcatalog...
    * The following code sets it to be disabled(display only) if 'NETPR'
    * is gt than 10.
      LOOP AT it_ekko INTO wa_ekko.
        IF wa_ekko-netpr GT 10.
          ls_stylerow-fieldname = 'NETPR' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                                 "set field to disabled
          APPEND ls_stylerow  TO wa_ekko-field_style.
          MODIFY it_ekko FROM wa_ekko.
        ENDIF.
      ENDLOOP.
    endform.                    " set_specific_field_attributes
    Check the above code.
    For a sample code using ABAP OO check the program BCALV_EDIT_02.
    Hope this helps.
    Rwd points if helpful.
    Thanks,
    Balaji

  • Editing a field in ALV and validating the newly entered Value

    Hi Experts,
       I have an ALV report in grid display (not object oriented). My requirement is to edit a field on the output and write the validations to validate the value that was edited on the ALV output.
    This can be done using object oriented coding by using the method check_changed_data. For this to happen, i need to change the entire scope of my report into object oriented, which is like reinventing the wheel.
    Since my report was developed using classical ABAP, what needs to be done to get this functionality. Any suggestions are welcome.
    Thanks.

    in the FM 'REUSE_ALV_GRID_DISPLAY'  import parameter IS_LAYOUT check out the columsn EDIT and EDIT_COLUMN. Also Use FM 'REUSE_ALV_EVENTS_GET' to get list possible event and pass a subroutine name which will be called when ever event is fired.
    example:
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = l_events.
      READ TABLE l_events WITH KEY name = slis_ev_top_of_page
                                   INTO g_event.
      IF sy-subrc = 0.
        MOVE top_of_page TO g_event-form.
        APPEND g_event TO t_events.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_buffer_active    = 'X'
          i_callback_program = t_repid
          is_layout          = t_layout
          it_fieldcat        = t_fieldcat[]
          i_save             = t_save
          it_events          = t_events[]
        TABLES
          t_outtab           = g_editpos1[].

  • Edit a field in ALV tree in a subscreen of a module pool

    Hi
    I want to make a field editable in the ALV tree based on some condtions in a subscreen of a module pool.  I used the edit = 'X' field in the fieldcatalog still it  is showing the field as display and not edit.
    Please help me to get the field as editable and save it to the database table.
    Please not this is ALV TREE
    Regards,
    Mozila

    Hi Mayank,
    Thanks for the reply
    I am using oops method.
    I tried making the field which is to be made editable  as wa_fieldcatalog-edit = 'X'. But its not working. I didnt get you when you said  edit in layout object.
    I also went through the demo programs but these programs are not having editable fields.
    My code is as follows:
    IF tree4 IS INITIAL.
    * create container for alv-tree
      l_tree_container_name = 'TREE4'.
      CREATE OBJECT l_custom_container
        EXPORTING
          container_name              = l_tree_container_name
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5.
    * create tree control
      CREATE OBJECT tree4
        EXPORTING
          i_parent                    = l_custom_container
          i_node_selection_mode       = cl_gui_column_tree=>node_sel_mode_multiple
          i_item_selection            = 'X'
          i_no_html_header            = 'X'
          i_no_toolbar                = 'X'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          illegal_node_selection_mode = 5
          failed                      = 6
          illegal_column_name         = 7.
    * create hierarchy
      CALL METHOD tree4->set_table_for_first_display
        EXPORTING
          is_layout       = s_layo
        CHANGING
          it_sort         = it_sort
          it_outtab       = it_final
          it_fieldcatalog = it_fieldcat.
    ELSE.
      CALL METHOD tree4->refresh_table_display
        EXPORTING
          it_sort           = it_sort
        EXCEPTIONS
          program_error     = 1
          failed            = 2
          cntl_system_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.
    endif.

  • To capture the selected rows along with edited field contents in alv report

    Dear All,
             I do have requirement where, in alv report output one field is editable and need to save the content of the edited field along with the selected rows.
             For example If there are 10 records displayed in the alv output with 20 fields.
    Out of this 20 fields one field (say XYZ) is editable. Also i have already created a new pushbutton (say ABC) on alv output. Now in the alv output if we maintain some value in the field (XYZ ) for the 2nd and 4th record and select this two records, and when clicked on the pushbutton (ABC) it has to update the DB table.
          I am using the Func Module  'REUSE_ALV_GRID_DISPLAY'. 
          Your early reply with sample code would be appreciated.
    Thanks in Advance.

    HI Naveen ,
    There is an import parameter "i_callback_program" in the function module,
    plz pass the program name to it.
    Capture the command by passing a field of type sy-ucomm to "I_CALLBACK_USER_COMMAND ".  Check the returned command and
    and program a functionality as desired.
    u can try the event double_click or at line selection. there u can use READLINE command to c if the line has been selected.
    In case it is , process the code segment.
    Regards
    Pankaj

  • 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

  • Edit an field in alv and save it

    i have an report in alv, i have used func module 'alv_list_display'.
      i have to make an field edit'able,(so that i can edit,change the existing data) then i have to save the data so that the data is stored in the table.

    Hi,
    you have to use fieldcat-input = 'X', and edit = 'X'.to make the fields editable in alv display.and SAVE you need the SAVE button.
    report  ztest_alv_check     message-id zz           .
    type-pools: slis.
    data: x_fieldcat type slis_fieldcat_alv,
          it_fieldcat type slis_t_fieldcat_alv,
          l_layout type slis_layout_alv,
          x_events type slis_alv_event,
          it_events type slis_t_event.
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          posnr like vbap-posnr,
         end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into table itab.
    x_fieldcat-fieldname = 'VBELN'.
    x_fieldcat-seltext_l = 'VBELN'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-input = 'X'.
    x_fieldcat-edit = 'X'.
    x_fieldcat-col_pos = 1.
    append x_fieldcat to it_fieldcat.
    clear x_fieldcat.
    x_fieldcat-fieldname = 'POSNR'.
    x_fieldcat-seltext_l = 'POSNR'.
    x_fieldcat-tabname = 'ITAB'.
    x_fieldcat-input = 'X'.
    x_fieldcat-edit = 'X'.
    x_fieldcat-col_pos = 2.
    append x_fieldcat to it_fieldcat.
    clear x_fieldcat.
    l_layout-zebra = 'X'.
    call function 'REUSE_ALV_LIST_DISPLAY'
      exporting
        i_callback_program       = sy-repid
        is_layout                = l_layout
        i_callback_pf_status_set = 'STATUS'
        i_callback_user_command  = 'USER_COMMAND'
        it_fieldcat              = it_fieldcat
       tables
        t_outtab                 = itab
      exceptions
        program_error            = 1
        others                   = 2.
    if sy-subrc <> 0.
      message id sy-msgid type sy-msgty number sy-msgno
              with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    "using the PF-status enable the SAVE button
    "give some OKCODE to SAVE button and handle it
    "using user_command form
    form status using p_extab type slis_t_extab.
    *- Pf status
      set pf-status 'STATUS'.
    endform.                 " STATUS
    form user_command using r_ucomm     like sy-ucomm
                                   rs_selfield type slis_selfield.
      case r_ucomm.
        when 'BACK' or 'CANC' or 'EXIT'.
          leave to screen 0.
        when 'SAVE'.
         "here you have to find the changed records,and   modify the DB.
      endcase.
    endform.                    "USER_COMMAND
    Regards
    vijay

  • Making cells editable in a dynamic ALV

    Hi all
    I have a dynamic table which I am displaying as an ALV.
      call method ref_grid->set_table_for_first_display
        exporting
          is_layout            = lwa_layout
          it_toolbar_excluding = t_toolbarexclude[]
        changing
          it_fieldcatalog      = t_fldcat
          it_outtab            = <t_itab>.
    In the table <t_itab>, there is a checkbox, one fixed column and the others dynamic. Along with the normal columns, there is also a table of type lvc_s_styl.
    My requirement is that, after my ALV grid is displayed, when I click on the Edit button(toolbar), for the rows where the checkbox is checked, the dynamic columns should become editable.
        loop at <t_itab> assigning <wa_itab>.
          assign component 'STYLE' of structure <wa_itab> to <fs_table>.
          lt_style = <fs_table>.
             Here I have made changes to the STYLE table for the necessary fields for the required rows and then called the methods:
        call method ref_grid->set_ready_for_input
          exporting
            i_ready_for_input = c_1.
        call method ref_grid->refresh_table_display.
    But, it does not work.
    I have checked the forum and there are a number of posts on this issue. I have followed all the steps which are mentioned there.
    Please help! Any suggestions are welcome
    Regards
    Debolina

    hi,
    try using :
        ls_layo-stylefname = 'CELLTAB'. for layput
    and then fill the cellstyle before calling the Fm for table display.
      l_mode = cl_gui_alv_grid=>mc_style_enabled.
      ls_celltab-fieldname = 'BUKRS'.
      ls_celltab-style     = l_mode.
      INSERT ls_celltab INTO TABLE pt_celltab.

  • How To Edit Selected Row In ALV Table

    Hello Experts,
    In My Webdynpro Application, I am displaying records from database table into an ALV Table.
    I want to edit only selected record from  ALV table.
    Please Suggest How to achieve this.
    Thanks,
    Pratibha

    The link given above is for the UI element 'Table' and does not pertain to ALV.
    To Make an ALV Editable on lead selection for that particular lead selected row.
    1. The ALV should be made lead selectable, when initializing
    2. The ON_LEAD_SELECT function should be invoked.
    3. Withing this function the index has to be retrieved to know which row was selected.
    4. Based on the index retrived all the columns have to pass FALSE to read_only in the column properties.
    Regards,
    Pramod

  • How to grey out ( make it non editable ) one line in ALV

    hi i am working on a report which is ALV o/p report .the report has some editable and some non editable fields. based on the value of 1 column field i need to make the full line non editable . how is this possible.
    please guide me.
    Thanks,
    Shiva.
    Edited by: Alvaro Tejada Galindo on Mar 19, 2008 5:07 PM

    Hi,
        Try using the structure LVC_S_STYLE.
    Declare a field of type LVC_S_STYLE in ur internal table,
    Now,in ur new PERFORM chk this code:
    ls_stylerow type LVC_S_STYLE.
    LOOP AT it_itab INTO wa_itab.
    IF wa_itab-field1(this will be the field by which u will validate) =  'X'.
    ls_stylerow-fieldname = 'FIELD2' .   "Field which you want to grey
    ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.  "set field to disabled
    APPEND ls_stylerow TO wa_itab-field_style.
    MODIFY it_itab FROM wa_itab.
    ENDIF.
    ENDLOOP.

  • Make editable and non-editable some cells in ALV OO

    Hello Experts, i have a table like this:
    KUNNR DATE VALUE1
    And a search button that obtains data, and then display the information in the ALV, like this
    KUNNR DATE       VALUE1
    1000     1.1.2009    A
    1001     2.2.2009    B
    Also i have a button that append  an empty line to the ALV
    I want that the kunnr retrieved in the search be non-editable
    But i want that the kunnr cell in the appended line be editable
    How can i do this?
    THANKS!
    Edited by: Mariano Gallicchio on Jun 26, 2009 3:45 PM

    when (sy-ucomm for New row)
    LOOP AT <fcat> into <workarea>
       CASE <workarea>-fieldname.
          WHEN 'KUNNR'.
    * Making a column as Editable
            <workarea>-edit = 'X'.
        ENDCASE.
      ENDLOOP.
    Kanagaraja L
    Edited by: Kanagaraja  Lokanathan on Jun 26, 2009 4:01 PM
    Edited by: Kanagaraja  Lokanathan on Jun 26, 2009 4:02 PM

Maybe you are looking for

  • Reinstalling OS X on a mid 07 iMac, do i go back to original install disk or should i use Snow Leopard disk?

    I have an mid 07 iMac, running on Mountain lion OS. It has been not working smoothly, constant freezing. I'm guessing its dying, however when I run a hardware test on DU is passes with no errors. I would like to wipe it clean and re-install my most r

  • Sent mail has not the default font

    Hi, Users complain that Groupwise changes the font when they use the "sent to" option in Microsoft Word. Has this behaviour changed since Groupwise 8? How can I set the font so that it is the same in every situation? We use Groupwise 2012, version 12

  • Making a datagrid display properly

    I am looking for an easy solution to make the datagrid display correctly. I would assume there is a way to display the data in the order of the xml document that is being loaded. Why would the component disregard the file it is sent, doing extra work

  • Is it possible to turn off FlashPlayer error pop-up?!

    Hi, Is it possible to bypass or turn off the FlashPlayer 10 error pop-up in browser? I tried the "omit trace actions" and "permit debugging" in Publish Settings but the pop-up still appears in browser testing. The error is well known and I dont need

  • ITunes U Setting: Episodes to Keep

    I was expecting this setting (Episodes to Keep: All Unplayed Episodes) to purge all watched episodes. I was expecting this to occur at the same time the program checks for new episodes but that is not the case. Perhaps I am a bit impatient but does a