ALV field editable

Hi,
Please help me,
I need to make a ALV report, which is having one field editable.
I want a code , when i will give input in editable field in ALV report , it should be save in my internal table.
Please give me a sample program ,
like take a internal table with two field. whose one field will editable.when user will give input in editable field it should save in internal table in same row like ALV list.
Thanks,
Abhishek

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.
*& 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
hope this helps
reward if useful
Edited by: Richa Khosla on Mar 25, 2008 1:30 PM

Similar Messages

  • Problem with OOPS ALv-field editable

    hi experts,
             I am displaying one report using OOPS ALV. Now i am inserting a line in the output, so some mandatory fields are automatically filled up in the new line, and i am trying to fill  new values for the remaining empty fields, So initially they are non-editable in the fieldcatalog.if i click on the 'INSERT LINE' button then only the fields shud be input enabled, how to do this.
                           Thanks in advance,

    maybe sample report BCALV_EDIT_04 might help you there.

  • Field editable in alv

    Hi,
    I'm using REUSE_ALV function module for the ALV display. I want to make a particular field editable in my display. How do I do it, and if I do it will the edited value get updated in my internal table as well.
    Thanks for the help in advance.
    Regards,
    Vijay

    Hi,
    there is sample code for it...
    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.
    *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.
    *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
    and also check this thread in which i gave the solution....
    REUSE_ALV_GRID EDITABLE
    Regards
    vijay

  • How to make field editable in ALV tree in OOPs?

    Hi Gems,
    Again I need help from you all.
    I am writing a program using OOPs and the uotput will be in ALV tree. I need to make a field editable in a perticular row.
    I am doing it using layout but the program is giving error during
    CALL METHOD CL_GUI_CFW=>FLUSH
          EXCEPTIONS
            CNTL_SYSTEM_ERROR = 1
            CNTL_ERROR        = 2.
    This method is returning sy-subrc = 2 and I am unable to get the output.
    I am using below code to make the field editable:
    DATA: LT_LAYOUT_ITEM TYPE LVC_T_LAYI,
                LS_LAYOUT_ITEM TYPE LVC_S_LAYI.
      LS_LAYOUT_ITEM-FIELDNAME = 'ACPCKTWRT'.     "ACPCKTWRT is the field name in the Internal table
      LS_LAYOUT_ITEM-EDITABLE = 'X'.
      APPEND LS_LAYOUT_ITEM TO LT_LAYOUT_ITEM.
    CALL METHOD G_ALV_TREE->ADD_NODE
        EXPORTING
          I_RELAT_NODE_KEY     = FP_RELAT_KEY
          I_RELATIONSHIP       = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
          IS_OUTTAB_LINE       = LS_TMP_FINFCNO                                                "structure of the internal table
         IS_NODE_LAYOUT       =
          IT_ITEM_LAYOUT       = LT_LAYOUT_ITEM                                                "Added layout to make the field editable
          I_NODE_TEXT          = LV_NODE_TEXT                                                      "Node text
        IMPORTING
          E_NEW_NODE_KEY       = FP_NODE_KEY
        EXCEPTIONS
          RELAT_NODE_NOT_FOUND = 1
          NODE_NOT_FOUND       = 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.
    Please help me and let me know how to get the solution.

    Hello
    The ALV tree control is not intended for making values editable (e.g. see
    [How to make ALV tree columns editable|http://sap.ittoolbox.com/groups/technical-functional/sap-abap/how-to-make-alv-tree-columns-editable-2052414])
    However, if you need an editable tree control then you have to use a different class (e.g. CL_ITEM_TREE_MODEL or CL_COLUMN_TREE_MODEL) but you will not have the ALV functionality of the ALV tree control.
    Regards
      Uwe

  • Making Fields editable in ALV

    I am displaying the custom table entries in an ALV. i am trying to make the fields in the ALV as editable. All the fields got enabled but only first field is in disabled mode. its type is NUMC. Can i know the reason behind this ?
    Here is the code that i am using to make the fields editable.
      IF v_flag = 'X'.
        lr_table_settings ?= l_value.
        lr_table_settings->set_read_only( abap_false ).
        lr_column_settings ?= l_value.
        lr_column = lr_column_settings->get_column( 'PROJ_ID' ).
        CREATE OBJECT lr_input_field
          EXPORTING
            value_fieldname = 'PROJ_ID'.
        lr_column->set_cell_editor( lr_input_field ).
        lr_column_settings ?= l_value.
        lr_column = lr_column_settings->get_column( 'ACCOUNT_NAME' ).
        CREATE OBJECT lr_input_field
          EXPORTING
            value_fieldname = 'ACCOUNT_NAME'.
        lr_column->set_cell_editor( lr_input_field ).
        lr_column_settings ?= l_value.
        lr_column = lr_column_settings->get_column( 'ZTASK' ).
        CREATE OBJECT lr_input_field
          EXPORTING
            value_fieldname = 'ZTASK'.
        lr_column->set_cell_editor( lr_input_field ).
      ELSE.
        lr_table_settings ?= l_value.
        lr_table_settings->set_read_only( abap_true ).
        lr_column_settings ?= l_value.
        lr_column = lr_column_settings->get_column( 'PROJ_ID' ).
        CREATE OBJECT lr_input_field
          EXPORTING
            value_fieldname = 'PROJ_ID'.
        lr_column->set_cell_editor( lr_input_field ).
        lr_column_settings ?= l_value.
        lr_column = lr_column_settings->get_column( 'ACCOUNT_NAME' ).
        CREATE OBJECT lr_input_field
          EXPORTING
            value_fieldname = 'ACCOUNT_NAME'.
        lr_column->set_cell_editor( lr_input_field ).
        lr_table_settings ?= l_value.
        lr_table_settings->set_read_only( abap_true ).
        lr_column_settings ?= l_value.
        lr_column = lr_column_settings->get_column( 'ZTASK' ).
        CREATE OBJECT lr_input_field
          EXPORTING
            value_fieldname = 'ZTASK'.
        lr_column->set_cell_editor( lr_input_field ).
      ENDIF.

    Hi Manjunath,
    I dont undersatnd what you are trying to write.Because you write same logic in the if and else part.What is purpose of it.
    Try to take different variables for columns.
    IF v_flag = 'X'.
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_false ).
    lr_column_settings ?= l_value.
    lr_column1= lr_column_settings->get_column( 'PROJ_ID' ).
    CREATE OBJECT lr_input_field
    EXPORTING
    value_fieldname = 'PROJ_ID'.
    lr_column1->set_cell_editor( lr_input_field ).
    lr_column_settings ?= l_value.
    lr_column2 = lr_column_settings->get_column( 'ACCOUNT_NAME' ).
    CREATE OBJECT lr_input_field
    EXPORTING
    value_fieldname = 'ACCOUNT_NAME'.
    lr_column2->set_cell_editor( lr_input_field ).
    lr_column_settings ?= l_value.
    lr_column3 = lr_column_settings->get_column( 'ZTASK' ).
    CREATE OBJECT lr_input_field
    EXPORTING
    value_fieldname = 'ZTASK'.
    lr_column3->set_cell_editor( lr_input_field ).
    endif.

  • Create a ALV report with fields editable and  entry to be saved in ztable

    Hello Experts,
    I have created the ALV report which has two of the fields editable. Now whenever user puts an entry in the ALV it has to be saved in the ZTABLE.
    The report is displayed with editable fields but i'm not sure what has to be written in the 'USER COMMAND' subroutine to save the entries in ztable.
    Please see my code belwo:-
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'ALV_USER_COMM'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               it_events               = gt_events
               is_print                = gd_prntparams
                 i_save                  = 'X'
               is_variant              = z_template
           TABLES
                t_outtab                = it_bg2
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    Thanks,
    Naveen
    Edited by: jaikrishna on Sep 4, 2010 8:13 AM

    Hi,
    I have worked on similar requirement. You can do that on sy-ucomm value only and you have to call a FM and a method. For that end user has to click on a button which you need to create in the application toolbar. Say that button function code is 'SAVE'. Write the following code in your user command :
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
            RS_SELFIELD TYPE SLIS_SELFIELD.
    *Code to reflect the changes done in the internal table
      DATA : REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
      DATA: L_VALID TYPE C.
      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
          IMPORTING
            E_VALID = L_VALID.
      ENDIF.
      CASE SY-UCOMM.
        WHEN 'SAVE'.
    *Data will come with the edited values from ALV
    *Here you write your code to save entries into Z table
    ENDCASE.
    ENDFORM. "USER_COMMAND
    Thanks & Regards,
    Rock.

  • How to make a particular row and column field editable in ALV

    Hi Experts,
    I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
    Kindly help me out to solve this.
    Any help would be appreciated.
    Thanks,
    Ashutosh

    Hi Ashutosh,
    please check below, explained by some experts.
    In the below link  editing two columns MOD_RANK and TECH_RANK.
    These two columns will be in edit mode once after selecting the required record
    Editing single cell in a row of ALV table
    And also look for more info
    http://scn.sap.com/thread/884976

  • Match code for an editable ALV field

    Hi everyone,
    I have an ALV with an editable field. I want to add matchcode with predefined 2 values to it.
    I used EDIT option for field catalog to make this field editable.
    I defined this field as a custom field in one of the DB table.
    The possible values of the field are in the declaration of the DOMAIN. But I still can't see the matchcode with those values when I want to enter a value into this field in ALV.
    What should I do?
    Thank you in advance,
    Diana

    Hi Diana,
    Welcome to SDN
    When you set the field catalog you have to set option F4AVAILABL to 'X'.
    If w_fcat is the field catalog structure then set as
    w_fact-F4AVAILABL = 'X'
    w_fact-CHECKTABLE = 'SCARR'
    w_fact-REF_TABLE = 'SPFLI'
    w_fact-REF_FIELD = 'CARRID'.
    Refer the standard program BCALV_TEST_GRID_F4_HELP and BCALV_GRID_EDIT_DELTA
    Please go through this thread for sample code
    Re: F4 for fields in ALV Grid
    Hope this would help you.
    Good luck
    Narin

  • ALV grid Editable based on a Field value

    Hi,
    I need to make a ALV Grid Row editable based on a particular field of that row.
    For example
    if fields are   A   B   C  D
    and if there are three rows of data
    I must make the Field B editable in all the rows which have D value as X else it must be non Editable.
    I searched in SDN but could not find a suitable answer.
    Hope I am clear with my issue.
    Regards

    this sample code makes the NETPR field editable based on a desired condition.
    this is the solution to your problem.
    * TABLES:     ekko.
    * TYPE-POOLS: slis.
    * TYPES: BEGIN OF t_ekko,
    *  ebeln TYPE ekpo-ebeln,
    *  ebelp TYPE ekpo-ebelp,
    *  netpr TYPE ekpo-netpr,
    *  field_style  TYPE lvc_t_styl,
    * END OF t_ekko.
    *DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    *      wa_ekko TYPE t_ekko.
    *DATA: it_fieldcat TYPE lvc_t_fcat,    
    *      wa_fieldcat TYPE lvc_s_fcat,
    *      gd_tab_group TYPE slis_t_sp_group_alv,
    *      gd_layout    TYPE lvc_s_layo,  
    *      gd_repid     LIKE sy-repid.
    *START-OF-SELECTION.
    *SELECT ebeln ebelp netpr
    *   UP TO 10 ROWS
    *    FROM ekpo
    *    INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    *  DATA ls_stylerow TYPE lvc_s_styl .
    *  DATA lt_styletab TYPE lvc_t_styl .
    ** 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.
    *      APPEND ls_stylerow  TO wa_ekko-field_style.
    *      MODIFY it_ekko FROM wa_ekko.
    *    ENDIF.
    *  ENDLOOP.
    *  wa_fieldcat-fieldname   = 'EBELN'.
    *  wa_fieldcat-scrtext_m   = 'Purchase Order'.
    *  wa_fieldcat-col_pos     = 1.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  wa_fieldcat-fieldname   = 'EBELP'.
    *  wa_fieldcat-scrtext_m   = 'PO Item'.
    *  wa_fieldcat-col_pos     = 2.
    *  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     = 3.
    *  wa_fieldcat-datatype     = 'CURR'.
    *  APPEND wa_fieldcat TO it_fieldcat.
    *  CLEAR  wa_fieldcat.
    *  gd_layout-stylefname = 'FIELD_STYLE'.
    *  gd_layout-zebra             = 'X'.
    *  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    *       EXPORTING
    *            i_callback_program       = sy-repid
    *            is_layout_lvc            = gd_layout
    *            it_fieldcat_lvc          = it_fieldcat
    *            i_save                   = 'X'
    *       TABLES
    *            t_outtab                = it_ekko

  • How to make some fields in ALV tree editable

    Hello All,
    Can any one tell me how to make some fields in ALV tree editable.
    If possible please post some code.
    Regards,
    Lisa.

    Hi Lisa,
    I want to make 3 fields in the ALV tree editable and update the saved values in ztable.
    I tried making the wa_fieldcat-edit = 'X' But in vain.
    Also i made the layout fields  wa_layout-edit = 'X'  and wa_layout-edit_mode = 'X'.
    But still the alv tree field appears as display.
    As you have mentioned in the post as answered, So please guide me to make the field editable.
    I am using oops method.
    Please provide me code if any.
    Thanks & Regards,
    Mozila

  • How to make the field in the output ALV report editable ?

    Hi,
       I have a requirement to make fields like MATNR,WERKS in the output ALV report editable . Could any of you help me with this ?.
    Thank you.
    Moderator Message: Search.
    Edited by: kishan P on Sep 6, 2010 6:35 PM

    Hi
    Please for available information on SCN. There are a lot of information on SCN about ALV wit hEDIT functionality.
    Regards
    Abhii

  • Exception while creating f4 help for editable alv field

         hi experts
    i have created search help for editable alv field by following link
    http://scn.sap.com/docs/DOC-39832
    But i m getting an exception :  Field symbol has not yet been assigned.
    exception area code
       read table <tab1> into <ls_wa> index i_row_id.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    first read statement is giving sy-subrc =4.
    PS: exception from method..:IS_READY_FOR_INPUT
    kindly help

    Hello Ankush,
    read table <tab1>  ASSIGNING <ls_wa> index i_row_id.
    IF  <ls_wa> IS ASSIGNED.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    ENDIF.
    Regards,
    TP

  • ALV Tree with field editable

    Hi All,
    We used the class CL_GUI_ALV_TREE for display.
    We need to do the field editable, is it possible? How?
    Thank you.

    This question has been asked and answered many times - please search.
    matt

  • ALV tree editable

    Hi all,
      I have a requirement to display the Data in ALV tree format with some fields as editable.I have to display data in 3 levels,which are of differents structures.
    To achieve editable in ALV tree display,I have used ALV GRID along with Tree display but here in GRID the 3 levels data is of same structure,but my requirement is of different structures.
    Inputs regarding this will be highly appreciated.
    Thanks,
    Sravanthi .V

    Hi Simone,
      Thanks for your quick reply,I have used this Class also but iam not able to get the Fields editable  even though it has the method for EDITABLE feature.
    Thanks,
    Sravanthi.V

  • Making the ALV Non Editable on the Fly

    Dear All ,
    I have a one requirement inwhich i want to make the ALV grid Editable or non editable depending on a value of a perticular field in the Internal table.
    Eg. I have one internal table as IT_DATA with fields Customer number , Order NUmber Comments and Status.
    There are 10 records in this internal table out of which 5 has a status as 1 and 5 has a status as 0.
    Now i want to make the field Comments non editable if the value in the status is 1. If it is 0, i want to keep it as Editable.
    Please Suggest ,
    Regards,
    Nikhil Joshi

    Hi
    Try like this
    DATA : it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
              wa_fieldcat TYPE slis_fieldcat_alv.
    if status = 0.
    CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'FLD1'.
      wa_fieldcat-coltext = 'Field1.
      wa_fieldcat-edit = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
    elseif status = 1.
    CLEAR wa_fieldcat.
       wa_fieldcat-fieldname = 'FLD2'.
      wa_fieldcat-coltext = 'Field2.
       APPEND wa_fieldcat TO it_fieldcat.
    then call function module 'REUSE_ALV_GRID_DISPLAY;.
    Thanks & Regards,
    Anagha Deshmukh

Maybe you are looking for