Editable OO ALV

Hi,
I'm creating an OO ALV where I have a Modify Button that when triggered has to make editable all the cells of the selected row. Is it possible? I haven't found anything similar in the sdn...
Thanks in advance!!!

Hi carles
Please find the example report for your exact requirement .
as this i developed for my project..
*& Report  ZUS_SDN_ALVGRID_EDITABLE_2
*& Thread: Edit the records in the GRID in change mode
*& Edit the records in the GRID in change mode
REPORT  zus_sdn_alvgrid_editable_2.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knb1 AS knb1.
TYPES: celltab  TYPE lvc_t_styl.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                      WITH DEFAULT KEY.
DATA:
  gd_okcode        TYPE ui_func,
  gt_fcat          TYPE lvc_t_fcat,
  gs_layout        TYPE lvc_s_layo,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_grid1         TYPE REF TO cl_gui_alv_grid.
DATA:
  gt_outtab        TYPE ty_t_outtab.
START-OF-SELECTION.
  SELECT        * FROM  knb1 UP TO 100 ROWS
    INTO CORRESPONDING FIELDS OF TABLE gt_outtab
         WHERE  bukrs  = '1000'.
  PERFORM modify_outtab.
Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent = cl_gui_container=>screen0
      ratio  = 90
    EXCEPTIONS
      OTHERS = 6.
  IF sy-subrc  0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
Create ALV grid
  CREATE OBJECT go_grid1
    EXPORTING
      i_parent = go_docking
    EXCEPTIONS
      OTHERS   = 5.
  IF sy-subrc  0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
Build fieldcatalog and set hotspot for field KUNNR
  PERFORM build_fieldcatalog_knb1.
  PERFORM set_layout_and_variant.
Display data
  CALL METHOD go_grid1->set_table_for_first_display
    EXPORTING
      is_layout       = gs_layout
    CHANGING
      it_outtab       = gt_outtab
      it_fieldcatalog = gt_fcat
    EXCEPTIONS
      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.
Link the docking container to the target dynpro
  CALL METHOD go_docking->link
    EXPORTING
      repid                       = syst-repid
      dynnr                       = '0100'
     CONTAINER                   =
    EXCEPTIONS
      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.
ok-code field = GD_OKCODE
  CALL SCREEN '0100'.
END-OF-SELECTION.
*&      Module  STATUS_0100  OUTPUT
      text
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
SET TITLEBAR 'xxx'.
     CALL METHOD go_grid1->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
       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.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&      Module  USER_COMMAND_0100  INPUT
      text
MODULE user_command_0100 INPUT.
  TRANSLATE gd_okcode TO UPPER CASE.
  CASE gd_okcode.
    WHEN 'BACK' OR
         'EXIT'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.
    WHEN 'CHANGE'.
      PERFORM set_rows_editable.
    WHEN OTHERS.
      CALL METHOD go_grid1->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        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.
  ENDCASE.
  CLEAR: gd_okcode.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&      Form  BUILD_FIELDCATALOG_KNB1
      text
-->  p1        text
<--  p2        text
FORM build_fieldcatalog_knb1 .
define local data
  DATA:
    ls_fcat        TYPE lvc_s_fcat.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    I_BUFFER_ACTIVE              =
      i_structure_name             = 'KNB1'
    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.
Only non-key fields are editable
ls_fcat-edit = 'X'.
MODIFY gt_fcat FROM ls_fcat
   TRANSPORTING edit
   WHERE ( key NE 'X' ).
ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
*&      Form  SET_LAYOUT_AND_VARIANT
      text
-->  p1        text
<--  p2        text
FORM set_layout_and_variant .
  CLEAR: gs_layout.
  gs_layout-cwidth_opt = abap_true.
  gs_layout-zebra      = abap_true.
  gs_layout-sel_mode   = 'D'.
gs_layout-edit       = abap_true. " entire grid editable
  gs_layout-stylefname = 'CELLTAB'.
ENDFORM.                    " SET_LAYOUT_AND_VARIANT
*&      Form  SET_ROWS_EDITABLE
      text
-->  p1        text
<--  p2        text
FORM set_rows_editable .
define local data
  DATA: ls_outtab   TYPE ty_s_outtab,
        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 go_grid1->get_selected_rows
    IMPORTING
      et_index_rows = lt_rows
     et_row_no     =
  CHECK ( lt_rows IS NOT INITIAL ).
  LOOP AT gt_fcat INTO ls_fcat.
    ls_cell-fieldname = ls_fcat-fieldname.
    IF ( ls_fcat-key = abap_true ).
      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.
  LOOP AT lt_rows INTO ls_row.
    READ TABLE gt_outtab INTO ls_outtab INDEX ls_row-index.
    ls_outtab-celltab = lt_celltab.
    MODIFY gt_outtab FROM ls_outtab INDEX ls_row-index.
  ENDLOOP.
set edit enabled cells ready for input
    CALL METHOD go_grid1->set_ready_for_input
                     EXPORTING i_ready_for_input = 1.
ENDFORM.                    " SET_ROWS_EDITABLE
*&      Form  MODIFY_OUTTAB
      text
-->  p1        text
<--  p2        text
FORM modify_outtab .
define local data
  DATA: ls_outtab   TYPE ty_s_outtab,
        ls_fcat     TYPE lvc_s_fcat,
        ls_cell     TYPE lvc_s_styl.
  " Set all cells of grid non-editable
  LOOP AT gt_fcat INTO ls_fcat.
    ls_cell-fieldname = ls_fcat-fieldname.
    ls_cell-style = cl_gui_alv_grid=>mc_style_disabled.
    INSERT ls_cell INTO TABLE ls_outtab-celltab.  " sorted itab !!!
  ENDLOOP.
  MODIFY gt_outtab FROM ls_outtab
    TRANSPORTING celltab
    WHERE ( bukrs IS NOT INITIAL ).
ENDFORM.                    " MODIFY_OUTTAB
regards,
Madhavi

Similar Messages

  • How to save data in ztable after editing in alv report

    how to save data in ztable after editing in alv report?

    Hi,
        Please find the attachment below.This may be usefull to you.
         [http://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database%28OOPS%29]
    Regards,
    Ramakrishna Yella.

  • Make rows as non editable in ALV

    Hi Experts,
    I have a standard ALV table where records are fetched from backend table. Here I have a field Approved as check box.
    My requirement is I need to make all the rows as non editable, if the Approved checkbox is checked. How can I achieve this.
    I went through the below discussion, but still am not clear of how to achieve it.
    How to set some rows in ALV to be editable or some non editable.
    I know to set a field as non editable in WD, but don't know how to set some specific rows as non editable in alv.
    Please help me.
    With Regards,
    Ramakrishnan M

    Hi,
    Create an Attribute in the Context say READ_ONLY of type wdy_boolean and bind the read only of cell editor to that attribute using set_read_only_fieldname( ) method. Then set the value of attribute READ_ONLY to abap_true/abap_false based on check box value.
    check this wiki for reference: How to edit conditionally row of a ALV table in Web Dynpro for ABAP - Web Dynpro ABAP - SCN Wiki
    Hope this helps u,
    Regards,
    Kiran

  • 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

  • Editable WD ALV - Cell Read Only

    Hi,
    Is there any way for making an individual cell read only for a column-row combination.
    My scenario is :
    I have an editable WD ALV with data. Now , in row(e.g Index 4) entry of the table, I want to make column2 and Column3 read only for that particular entry(row no.- Index) !! Please guide me through if there is any way to do the same.
    Best Regards
    Sid

    You will have to create an extra attribute for each of your column, of type boolean under the same node. Now bind  these attributes to the read only property of your column's cell editors.
    Then pass abap_true/abap_false to make the field editable/reaonly.
    Check this wiki for your reference,
    check this Wiki [https://wiki.sdn.sap.com/wiki/display/WDABAP/How%20to%20edit%20conditionally%20row%20of%20a%20ALV%20table%20in%20Web%20Dynpro%20for%20ABAP]
    Regards,
    Radhika.

  • How to Edit in ALV?

    Hi Experts,
    I am working on a BAPI for creating Requsition where i am taking one ref PR and then modifying required details and then creating a new PR.
    Everything is working fine but before creating the new PR i want to display that data in the form of alv grid and where i can edit the values and save then a new PR will be created as per modification on alv.
    check the sample code wht i hv done....
    SELECT * FROM EBAN INTO CORRESPONDING FIELDS OF TABLE IT_EBAN WHERE
    BANFN EQ S_BANFN.
    LOOP AT IT_EBAN.
    ENDLOOP.
    LOOP AT IT_EBAN.
    T_REQUISITION_ITEMS-DOC_TYPE = 'ZSD'.
    MOVE IT_EBAN-BNFPO TO T_REQUISITION_ITEMS-PREQ_ITEM.
    MOVE IT_EBAN-ERNAM TO T_REQUISITION_ITEMS-CREATED_BY.
    MOVE IT_EBAN-AFNAM TO T_REQUISITION_ITEMS-PREQ_NAME.
    MOVE IT_EBAN-BADAT TO T_REQUISITION_ITEMS-PREQ_DATE.
    MOVE IT_EBAN-TXZ01 TO T_REQUISITION_ITEMS-SHORT_TEXT.
    MOVE IT_EBAN-MATNR TO T_REQUISITION_ITEMS-MATERIAL.
    MOVE IT_EBAN-EMATN TO T_REQUISITION_ITEMS-PUR_MAT.
    T_REQUISITION_ITEMS-PLANT = '4000'.
    T_REQUISITION_ITEMS-STORE_LOC = 'YRD1'.
    T_REQUISITION_ITEMS-PUR_GROUP = 'JSD'.
    MOVE IT_EBAN-MATKL TO T_REQUISITION_ITEMS-MAT_GRP.
    MOVE IT_EBAN-MENGE TO T_REQUISITION_ITEMS-QUANTITY.
    MOVE IT_EBAN-MEINS TO T_REQUISITION_ITEMS-UNIT.
    T_REQUISITION_ITEMS-DELIV_DATE = '20080618'.
    APPEND T_REQUISITION_ITEMS.
    CALL FUNCTION 'BAPI_REQUISITION_CREATE'
    EXPORTING
    SKIP_ITEMS_WITH_ERROR =
    IMPORTING
    NUMBER = E_NUMBER
    TABLES
    REQUISITION_ITEMS = T_REQUISITION_ITEMS
    *REQUISITION_ACCOUNT_ASSIGNMENT = T_REQ_ACCOUNT_ASSIGNMENT
    REQUISITION_ITEM_TEXT =
    REQUISITION_LIMITS =
    REQUISITION_CONTRACT_LIMITS =
    REQUISITION_SERVICES =
    REQUISITION_SRV_ACCASS_VALUES =
    RETURN = T_RETURN
    REQUISITION_SERVICES_TEXT =
    EXTENSIONIN =
    REQUISITION_ADDRDELIVERY =
    ENDLOOP.
    IF NOT E_NUMBER IS INITIAL .
    WRITE:/ 'REQ NO:' , E_NUMBER , 'CREATED'.
    ELSE.
    LOOP AT T_RETURN.
    WRITE T_RETURN-MESSAGE.
    ENDLOOP.
    ENDIF.
    what i want is before calling BAPI_REQUISITION_CREATE  i need to display it_eban as alv and then where i can edit the values and save and that values will move to T_REQUISITION_ITEMS table. no need of hard cording Plant and purch. grop and storage location details. I know how to display the ALV grid just tell me how to edit in ALV and when i cllick save it shold move to BAPI_REQUISITION_CREATE.
    its an urgent...
    <b>points will be rewarded for useful answers</b>
    Regards,
    sunil kairam.

    Check this editable alv report...
    REPORT zjay_edit_alv.
    * TYPE-POOLS *
    TYPE-POOLS: slis.
    * INTERNAL TABLES/WORK AREAS/VARIABLES
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
    i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
    w_field TYPE slis_fieldcat_alv,
    p_table LIKE dd02l-tabname,
    dy_table TYPE REF TO data,
    dy_tab TYPE REF TO data,
    dy_line TYPE REF TO data.
    * FIELD-SYMBOLS *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
    <dyn_wa> TYPE ANY,
    <dyn_field> TYPE ANY,
    <dyn_tab_temp> TYPE STANDARD TABLE.
    * SELECTION SCREEN *
    PARAMETERS: tabname(30) TYPE c DEFAULT 'MARA',
    lines(5) TYPE n DEFAULT 7.
    * START-OF-SELECTION *
    START-OF-SELECTION.
    * Storing table name
    p_table = tabname.
    * Create internal table dynamically with the stucture of table name
    * entered in the selection screen
    CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
    ASSIGN dy_table->* TO <dyn_table>.
    IF sy-subrc <> 0.
    MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
    LEAVE TO LIST-PROCESSING.
    ENDIF.
    * Create workarea for the table
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    ASSIGN dy_line->* TO <dyn_wa>.
    * Create another temp. table
    CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
    ASSIGN dy_tab->* TO <dyn_tab_temp>.
    SORT i_fieldcat BY col_pos.
    * Select data from table
    SELECT * FROM (p_table)
    INTO TABLE <dyn_table>
    UP TO lines ROWS.
    REFRESH <dyn_tab_temp>.
    * Display report
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_structure_name = p_table
    i_callback_user_command = 'USER_COMMAND'
    i_callback_pf_status_set = 'SET_PF_STATUS'
    TABLES
    t_outtab = <dyn_table>
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    ENDIF.
    *& Form SET_PF_STATUS
    * Setting custom PF-Status
    * -->RT_EXTAB Excluding table
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
    SET PF-STATUS 'ZSTANDARD'. "copy it from SALV func group standard
    ENDFORM. "SET_PF_STATUS
    *& Form user_command
    * Handling custom function codes
    * -->R_UCOMM Function code value
    * -->RS_SELFIELD Info. of cursor position in ALV
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    * Local data declaration
    DATA: li_tab TYPE REF TO data,
    l_line TYPE REF TO data.
    * Local field-symbols
    FIELD-SYMBOLS:<l_tab> TYPE table,
    <l_wa> TYPE ANY.
    * Create table
    CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
    ASSIGN li_tab->* TO <l_tab>.
    * Create workarea
    CREATE DATA l_line LIKE LINE OF <l_tab>.
    ASSIGN l_line->* TO <l_wa>.
    CASE r_ucomm.
    * When a record is selected
    WHEN '&IC1'.
    * Read the selected record
    READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
    rs_selfield-tabindex.
    IF sy-subrc = 0.
    * Store the record in an internal table
    APPEND <dyn_wa> TO <l_tab>.
    * Fetch the field catalog info
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_structure_name = p_table
    CHANGING
    ct_fieldcat = i_fieldcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    IF sy-subrc = 0.
    * Make all the fields input enabled except key fields
    w_field-input = 'X'.
    MODIFY i_fieldcat FROM w_field TRANSPORTING input
    WHERE key IS INITIAL.
    ENDIF.
    * Display the record for editing purpose
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_structure_name = p_table
    it_fieldcat = i_fieldcat
    i_screen_start_column = 10
    i_screen_start_line = 15
    i_screen_end_column = 200
    i_screen_end_line = 20
    TABLES
    t_outtab = <l_tab>
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc = 0.
    * Read the modified data
    READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
    * If the record is changed then track its index no.
    * and populate it in an internal table for future
    * action
    IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
    <dyn_wa> = <l_wa>.
    i_index = rs_selfield-tabindex.
    APPEND i_index.
    ENDIF.
    ENDIF.
    ENDIF.
    * When save button is pressed
    WHEN 'SAVE'.
    * Sort the index table
    SORT i_index.
    * Delete all duplicate records
    DELETE ADJACENT DUPLICATES FROM i_index.
    LOOP AT i_index.
    * Find out the changes in the internal table
    * and populate these changes in another internal table
    READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
    IF sy-subrc = 0.
    APPEND <dyn_wa> TO <dyn_tab_temp>.
    ENDIF.
    ENDLOOP.
    * Lock the table
    CALL FUNCTION 'ENQUEUE_E_TABLE'
    EXPORTING
    mode_rstable = 'E'
    tabname = p_table
    EXCEPTIONS
    foreign_lock = 1
    system_failure = 2
    OTHERS = 3.
    IF sy-subrc = 0.
    * Modify the database table with these changes
    MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
    REFRESH <dyn_tab_temp>.
    * Unlock the table
    CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
    mode_rstable = 'E'
    tabname = p_table.
    ENDIF.
    ENDCASE.
    rs_selfield-refresh = 'X'.
    ENDFORM. "user_command

  • How to make field is editable in ALV  CL_SALV_TABLE only)

    Hi,
    How to make field is editable in ALV  CL_SALV_TABLE only)
    Any one has tried to make field si editable by using CL_SALV_TABLE class.
    *I know how to do it in REUSEALV function module and CL_GUI_ALV class.*_
    Please reply only if you riedin CL_SALV_TABLE class method.
    Regards
    Rajesh V
    Moderator message: not supported, please read class documentation and search for previous discussions.
    Edited by: Thomas Zloch on Mar 17, 2011 2:07 PM

    Hi Chad,
    Please refer the link,
    Edit field in alv
    Regards,
    Hema.
    Reward points if it is useful.

  • How to make fields/columns un-editable in ALV

    Hi,
    How can I make a field/column un-editable in ALV.
    I tried writing: ls_fc_po-edit = ' '.     (inside loop for the selected column/field), but it doesnot work for me.
    Any suggestions please.
    Thanks,
    Ravish

    The code for the field catalogue is below:
    LOOP AT lt_fc_po INTO ls_fc_po.
        IF ls_fc_po-fieldname EQ 'PO_ID'.
          ls_fc_po-no_out = 'X'.
        ELSEIF ls_fc_po-fieldname EQ 'UNIT_OF_MEASURE'.
          ls_fc_po-outputlen = '10'.
          ls_fc_po-tooltip = 'Unit of Measure'.
        ELSEIF ls_fc_po-fieldname EQ 'ITEM_ID'.
          ls_fc_po-outputlen = '10'.
          ls_fc_po-tooltip = 'Purchase Order Items'.
        ELSEIF ls_fc_po-fieldname EQ 'QUANTITY'.
          ls_fc_po-outputlen = '10'.
        ELSEIF ls_fc_po-fieldname EQ 'CURRENCY'.
          ls_fc_po-edit = ' '.
          ls_fc_po-outputlen = '10'.
          ls_fc_po-tooltip = 'Currency'.
        ELSEIF ls_fc_po-fieldname EQ 'DATE_OF_DELIVERY'.
          ls_fc_po-outputlen = '18'.
          ls_fc_po-coltext = 'Delivery Date'.
          ls_fc_po-tooltip = 'Requested Delivery date'.
        ELSEIF ls_fc_po-fieldname EQ 'PLANT_ID'.
          ls_fc_po-outputlen = '15'.
          ls_fc_po-coltext = 'Plant'.
          ls_fc_po-tooltip = 'Plant Identifier'.
        ELSEIF ls_fc_po-fieldname EQ 'MATERIAL_DESC'.
          ls_fc_po-outputlen = '18'.
        ELSEIF ls_fc_po-fieldname EQ 'MATERIAL_ID'.
          ls_fc_po-outputlen = '15'.
          ls_fc_po-coltext = 'Material'.
          ls_fc_po-tooltip = 'Material Identifier'.
          IF GL_PO_EVENT_ALV = 0.
            GL_PO_EVENT_ALV = 1.
            data: l_field type lvc_fname.
            data: lt_f4 type  lvc_t_f4.
            data: ls_f4 type lvc_s_f4.
            l_field = ls_fc_po-fieldname.
            ls_f4-fieldname  = l_field.
            ls_f4-register   = 'X'.
            ls_f4-getbefore  = 'X'.
            ls_f4-chngeafter = 'X'.
            append ls_f4 to lt_f4.
            CALL METHOD po_itm_trn_alvgrid->register_f4_for_fields
              EXPORTING
                it_f4 = lt_f4.
          ENDIF.
        ENDIF.
        MODIFY lt_fc_po FROM ls_fc_po.
      ENDLOOP.

  • Unable to capture data in an editable dynamic ALV.

    Hi ,
    I have created a dynamic editable ALV whose displayed structure can be changed at runtime based on the selection in a drop down list value selector.
    Im trying to capture the values entered in the ALV into an internal table before the user changes the structure of the ALV to a different structure.
    In the ON_SELECT event handler of the drop down list box , im rasing a data_check event to capture the ALV data.
    The problem is that the control is not entering the event handler for the data_check event.
    If i raise the data_check event in my save event handler or any other event handler , it works fine.
    Can someone please suggest a solution.
    Regards,
    Newton.

    Hi ,
    I have figured out that the problem is local to my machine , because the code works fine on other machines.
    I guess my internet explorer has some bug.
    Regards,
    Newton.

  • Field Editing in ALV Report

    hello everyone,
    I have created an alv report using MARA table. but i am unable to edit any field and save the changes back to the table in the database.
    I

    Hi Ravi,
    Check out the below demo program for editable ALV .
    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

  • Regarding column editing in alv grid

    hi experts,
    i m using alv grid display for my report layout what i want that after the output dispaly when the user will select my customized button "change the amount column" then after pressing this my amount column will become editable and user can put there new aount for this i have used this codes but it is not working plz help me to sort out this,
    for u here is my code.
    FORM DISPLAY_LIST .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-cprog
          is_layout                = i_layout
          it_fieldcat              = i_fieldtab
          i_grid_title             = 'Production Incentive Details'
          I_CALLBACK_PF_STATUS_SET = 'SET_PFSTATUS'
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          it_events                = global_events
        TABLES
          t_outtab                 = itab_final
        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_LIST
    *&      Form  SET_PFSTATUS
          text
         -->RT_EXTAB   text
    FORM SET_PFSTATUS USING rt_extab TYPE slis_t_extab..
      SET PF-STATUS 'ZPINCENTIVE' .
    EXCLUDING rt_extab..
    ENDFORM.                    " CREATE_PFSTATUS
    *&      Form  user_command
          text
         -->R_UCOMM      text
         -->RS_SELFIELD  text
    form user_command using r_ucomm like sy-ucomm
                                         rs_selfield type slis_selfield.
      case r_ucomm.
    *BREAK-POINT.
        when  '&CHANGED'.        "for change the amount button.
          read table i_fieldtab into s_fieldtab with key FIELDNAME = 'AMOUNT'.
          if sy-subrc = 0.
            move:sy-tabix to index,
                 'X' to s_fieldtab-edit.
            modify:i_fieldtab index index from s_fieldtab.
            clear:s_fieldtab.
          endif.

    solved by own

  • How can i choose row to edit in alv report

    hello ,
    i done alv report with one coloumne that can be edit  ,
    in this coloumne i want to choose which rows can be edit
    and which will be close according to event  .
    i saw example program "BCALV_EDIT_02" that show this case
    but stile , i don't understand what is the action that
    do it .
    this is the  part
    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.
    so what is the part that will close the row for edit ?
    when i add this part in my report all the row is deleted.
    thanks.

    Dakota,
    You can change the settings at runtime.
    What you need to do is to have another column as part of the internal table, that has the data. This column, say, STYLE will refer to LVC_T_STYL. So, this becomes a nested internal table.
    Set the editable flga switched off at Fieldcat and layout level.
    Now, while filling the data in the table, or looping it separately, fill the Styles table for each row accordingly depending on the conditions. So, if you want the entire row to be enabled for editing, there will so many rows as the no. of columns in the inner internal table which is a column of that row.
    col1  col2   Col3  Style
    1     1      2     Col1 -- Style_Disabled
    ___________________Col2 -- Style_Disabled
    ___________________Col3 -- Style_Disabled
    This should solve your problem.
    Regards,
    Ravi
    note : Please reward the posts that help you.
    Message was edited by: Ravikumar Allampallam

  • 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 set a single cell editable in alv Webdynpro Abap

    I am trying to edit a single cell on lead selection. here the steps i did to achive this.
    1. I added a Attribute READ_ONLY  inside my node of type WDY_BOOLEAN.
    2. i am conditionally making this Attribute - READ_ONLY = 'X'.
    3. i am binding my node with new values.
    4. for ALV here is the code i have added.
    DATA :lo_cmp_usage TYPE REF TO if_wd_component_usage,
            lr_column    TYPE REF TO cl_salv_wd_column,
            lr_table_settings TYPE REF TO if_salv_wd_table_settings,
            lt_columns TYPE salv_wd_t_column_ref,
            ls_columns TYPE salv_wd_s_column_ref,
            lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
            lo_interfacecontroller TYPE REF TO iwci_salv_wd_table ,
            lv_value TYPE REF TO cl_salv_wd_config_table.
    *Taking reference of the Component Usage
      lo_cmp_usage =   wd_this->wd_cpuse_cu_alv( ).
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
      lo_interfacecontroller =   wd_this->wd_cpifc_cu_alv( ).
      lv_value = lo_interfacecontroller->get_model( ).
      CALL METHOD lv_value->if_salv_wd_column_settings~get_columns
        RECEIVING
          value = lt_columns.
      LOOP AT lt_columns INTO ls_columns.
        lr_column = ls_columns-r_column.
        CASE ls_columns-id.
          WHEN 'USR_ACT_RT'.
            CREATE OBJECT lr_input_field
              EXPORTING
                value_fieldname = ls_columns-id.
            lr_column->set_cell_editor( value = lr_input_field ).
            lr_input_field->set_read_only_fieldname( value = 'READ_ONLY' ).
        ENDCASE.
      ENDLOOP.
      lr_table_settings ?= lv_value.
      lr_table_settings->set_read_only( abap_false ).
      lv_value->if_salv_wd_column_settings~delete_column( id = 'READ_ONLY' ).
    but instead of changing the particular cell where i have marked READ_ONLY = 'X' it is changing whole column 'USR_ACT_RT'  data as editable .
    If anybody can  please help ASAP

    Hi Tashi,
    Thanks for your reply,i have did the same way u are doing here for setting the READ_ONLY Attribute conditionally.
    here is my code for setting the read only attribute .
    IF NOT lo_nd_nd_cost_rate IS INITIAL.
        lo_nd_nd_cost_rate->get_static_attributes_table( IMPORTING table = lt_nd_cost_rate ).
      ENDIF.
      IF NOT lo_el_nd_cost_rate IS INITIAL.
    * get all declared attributes
        lo_el_nd_cost_rate->get_static_attributes(
          IMPORTING
            static_attributes = ls_nd_cost_rate_sel ).
      ENDIF.
      lv_datum = sy-datum.
      lv_month = lv_datum+4(2).
    ** @TODO handle non existant child
      LOOP AT lt_nd_cost_rate INTO ls_nd_cost_rate WHERE quarter = ls_nd_cost_rate_sel-quarter.
        IF ls_nd_cost_rate-quarter = 'Q1'.
          IF ( lv_month  EQ '01' OR lv_month  EQ '02' OR lv_month  EQ '03' ).
            ls_nd_cost_rate-read_only = 'X'.
          ELSE.
            ls_nd_cost_rate-read_only = ''.
    *   report message
            CALL METHOD lo_message_manager->report_warning
              EXPORTING
                message_text = lv_text.
          ENDIF.
        ELSEIF ls_nd_cost_rate-quarter = 'Q2'.
          IF ( lv_month  EQ '04' OR lv_month  EQ '05' OR lv_month  EQ '06' ).
            ls_nd_cost_rate-read_only = 'X'.
          ELSE.
            ls_nd_cost_rate-read_only = ''.
    *   report message
            CALL METHOD lo_message_manager->report_warning
              EXPORTING
                message_text = lv_text.
          ENDIF.
        ELSEIF ls_nd_cost_rate-quarter = 'Q3'.
          IF ( lv_month  EQ '07' OR lv_month  EQ '08' OR lv_month  EQ '09' ).
            ls_nd_cost_rate-read_only = 'X'.
          ELSE.
            ls_nd_cost_rate-read_only = ''.
    *   report message
            CALL METHOD lo_message_manager->report_warning
              EXPORTING
                message_text = lv_text.
          ENDIF.
        ELSEIF ls_nd_cost_rate-quarter = 'Q4'.
          IF ( lv_month  EQ '10' OR lv_month  EQ '11' OR lv_month  EQ '12' ).
            ls_nd_cost_rate-read_only = 'X'.
          ELSE.
            ls_nd_cost_rate-read_only = ''.
    *   report message
            CALL METHOD lo_message_manager->report_warning
              EXPORTING
                message_text = lv_text.
          ENDIF.
        ENDIF.
        MODIFY lt_nd_cost_rate FROM ls_nd_cost_rate INDEX sy-tabix TRANSPORTING read_only .
        CLEAR ls_nd_cost_rate.
      ENDLOOP.
      lo_nd_nd_cost_rate->bind_table( lt_nd_cost_rate ).
    please see in the below sceen shot the last two cells are editable in the User Actual Rate Column whlie the selected rows cell is not editable. Please revert if u have any input for same.

  • 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

  • Editing An ALV Grid and saving finally.

    Hİ !
    former Abap programmer I have modified CN47N as ZCN47N and made the some of the fields of the grid Editable.
    The user changes some of the fields and then press Enter occasionally. When he wants to save he clicks a Save button.
    If I use 
    call method g_d_grid->set_ready_for_input
        exporting
          i_ready_for_input = 1.
      call method g_d_grid->register_edit_event
        exporting
          i_event_id = cl_gui_alv_grid=>mc_evt_enter
        exceptions
          error      = 1
          others     = 2.
    the "data_changed " event of the ALV grid is fired every time the user press Enter BUT CAPTURES ONLY THE LAST EDITS.
    But I can update the neighboring cells of the editable cells immediately by this way.
    If I disable the mc_evt_enter event , The user can save ALL of the changes with the firing of gr_grid->checked_changed_data which fires the data_changed event.
    But by this way I can not update the neighboring cells of the editable cells with the explanation of the editable cells.
    My Question:
    1) Will data_changed_finished event suit better than data_changed_?
    2) Is there a moderate way in which I can use the enter key and capture all the changes that have been made in the grid ?
    thanks.
    erkan.

    DATA_CHANGED triggers as soon as you enter the value and move away to different cell. Parameter ER_DATA_CHANGED of the handler method of DATA_CHANGED would have MT_GOOD_CELLS and MT_BED_CELLS. Based on this you can validate the values and update the Protocol table using the method ADD_PROTOCOL_ENTRY.
    If you have to modify other cells based on the entered cells, you need to use this DATA_CHANGED method, because here you can get / change the data of the cell using the method GET_CELL_VALUE & MODIFY_CELL. in this method, the entered data is not yet visible in your ALV data table.
    DATA_CHANGED_FINISHED triggers after the data has been updated in the ALV data table. So, if you wish to change the other cells it too late. You need to modify the table and call the refresh method to actually refresh the data.
    Regards,
    Naimesh Patel

Maybe you are looking for