O/P ALV in edit mode

Hi All,
Can any on tell me how to get the coloumns of the O/P ALV table in eit mode. I have an alv table ready its working fine.
All I know is I need to use some codes like
call method l_value->if_salv_wd_table_settings~SET_READ_ONLY
  EXPORTING
    VALUE  = ABAP_FALSE
along with method SET_CELL_EDITOR. But I am not able to implement it. Can anyone give me the details.  The only thing ready is an alv table which takes i/p from select parameter and gies the data in the display.
I get a lot of syntax error and am not able to understand clearly .
Thanks in advance.
Rgds,
Anu.

I'm afraid you might have to clarify your question a little bit.  What exactly are you needing help with? Are you just wanting to know how to interact with the ALV Table model.  If so, you can do that via the component usage and the component interface.  Here is a small example. The thing to keep mind is that the code must be adjust for what you named your alv component usage.  For example in this code I named my component usage alv. Therefore the method names are wd_this->wd_cpuse_alv and  wd_this->wd_cpifc_alv.  If I had instead named the component usage XYX, the generated method names would change to wd_this->wd_cpuse_xyz and wd_this->wd_cpifc_xyz.
data: l_ref_cmp_usage type ref to if_wd_component_usage.
  l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
  if l_ref_cmp_usage->has_active_component( ) is initial.
    l_ref_cmp_usage->create_component( ).
  endif.
  data l_salv_wd_table type ref to iwci_salv_wd_table.
  l_salv_wd_table = wd_this->wd_cpifc_alv( ).
  data l_table type ref to cl_salv_wd_config_table.
  l_table = l_salv_wd_table->get_model( ).
  l_table->if_salv_wd_table_settings~set_scrollable_col_count( 8 ).
  data l_column type ref to cl_salv_wd_column.
  l_column = l_table->if_salv_wd_column_settings~get_column( 'CLIENT' ).
  l_column->set_visible( cl_wd_uielement=>e_visible-none ).
  data textview type ref to cl_salv_wd_uie_text_view.
  l_column = l_table->if_salv_wd_column_settings~get_column( 'ADD_PARTICIPANTS' ).
  create object textview.
  textview->set_text_fieldname( 'ADD_PARTICIPANTS' ).
  textview->set_wrapping( abap_true ).
  l_column->set_cell_editor( textview ).
l_column = l_table->if_salv_wd_column_settings~get_column( 'STATUS' ).
  data ddlb type ref to cl_salv_wd_uie_dropdown_by_key.
  create object ddlb
    exporting
      selected_key_fieldname = 'STATUS'.
  ddlb->set_read_only( abap_true ).
  l_column->set_cell_editor( ddlb ).
  l_column = l_table->if_salv_wd_column_settings~get_column( 'CHANGED_BY' ).
  l_header = l_column->get_header( ).
  l_header->set_text( `Changed By` ).
  l_column = l_table->if_salv_wd_column_settings~get_column( 'LIFE_CYCLE_STAT' ).
  l_column->set_visible( cl_wd_uielement=>e_visible-none ).

Similar Messages

  • ALV GRID edit mode keyboard issue

    Hi,
    I have created a program that displays an ALV GRID.
    From the Layout I said to edit in edit mode the ALV Grid.
    In the menu toolbar I exclude the button 'cut - copy -paste and delete line'.
    When I run the program I see that these buttons are not displayed --> OK.
    BUT my problem is: if I use the keyboard then the ALV Grid manages these actions.
    For instance. I select some lines and press the key DELETE on the keyboard --> the lines are removed and that is not that I expect because I removed this action from the toolbar.
    For the cut - copy and paste it's the same.
    Do you have  a solution for me --> intercept an event or change the function keys or ....
    I would like that the ALV Grid does not manage the keys delete, CRTL-C, CRTL-V in edit mode.
    Thanks,
    Stevie,

    Hi Steve
    I was not aware of this. So, I recommend you to try this:
    At the event <b>"before_user_command"</b> you can terminate the process by resetting the ALV user command.
    <u><b>e.g.</b></u>
        CASE e_ucomm .
          WHEN '&INFO' .
            CALL METHOD gr_alvgrid->set_user_command
                          EXPORTING i_ucomm = space.
        ENDCASE .
    This code within the event overrides the '&INFO' function and terminates its process. For cut and copy, you can find out ucomm values by putting a break point inside the event and tracing the value of <b>"i_ucomm"</b>.
    For some relevant issues, you can inspect the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference For ALV Grid Control"</a>.
    <i>As another thing, since you are a new SDN member, you are welcome and let me introduce you the SDN forums pointing system: You can assign points to posts you find helpful while solving your question. You can reward points by clicking the yellow star icon at header of each reply post. You can reward;
    - one 10 points (solved)
    - two 6 points (very helpful answer)
    - many 2 points (helpful answer)</i>
    Kind regards...
    *--Serdar

  • Class ALV in Edit mode and F4 Value help

    I am displaying Customer Information in ALV Grid with class method. Customer Number is editable mode and having search help. When user F4 on Customer Number and select any value from search help. This selected new value is not passing to ALV grid in Customer number column. I tried with on_f4 method, but it is not working or something i doing incorrect.
    Can any one help to solve this problem ?
    Many thanks

    Hi.
    try with method check_changed_data in after event.
    CALL METHOD go_grid->check_changed_data
          IMPORTING
    or implement a local_event_class to handle F4 event and Change event.
    The demo program "BCALV_TEST_GRID_F4_HELP" can help you tu find the correct code.

  • ALV in EDIT-Mode: can't hide the toolbar in edit-mode

    Hi,
    I have supressed in my ALV all standard-buttons with the help of an it_toolbar_excluding. I have built my own toolbar (p_object->mt_toolbar). Until know everything is fine, the ALV shows only my own generated toolbar.
    In that moment, when I change a property of a column in the fieldcatalog ( wa_catalog-edit  = 'X' ), both toolbars are shown, the standard toolbar and my own generated buttons.
    What's wrong, how can I hide the standard toolbar when I am in the edit mode?
    Kind regards
    Andreas
    Edited by: Andreas Waldt on Sep 3, 2008 5:19 PM

    Thank you very much,
    during testing I have recognized, that the buttons in the toolbar are new functions, because of the edit mode.
    So I have put all the new button into the excluding list. It worked!
    Thanks again!
    Andreas

  • ALV Tree Edit mode

    Hi,
    I have wrote a program using CL_GUI_ALV_TREE.
    I want to make some of the columns editable.
    Alternatively, is it possible to include a tree structure in normal CL_GUI_ALV_GRID?
    Thanks.
    Michael Pang

    Hi Leif,
    I have not achieved that myself. Maybe you could use a different approach: display the fields into the tree, then use another subscree to show the field contents and allow the user to chage it.
    You could find useful these demo programs: SAPSIMPLE_TREE_CONTROL_DEMO, SAPCOLUMN_TREE_CONTROL_DEMO, SAPTLIST_TREE_CONTROL_DEMO, SAPTLIST_TREE_CONTROL_DEMO_HDR, because they show a tree and then, in another subscreen, they show some properties of the selected fields and so.
    I hope it helps. Best regards,
    Alvaro

  • ALV grid EDIT updation

    hi Experts!!
    I am working on a ALV Grids which are on a Tabstrip Sub screen area.I have done the ALV  in Edit mode and :
    > <b>when we enter the values in the editing colums i want it to be updateted in the DB table.
    >But when we enter values it is not comming in the internal table also and not updateing in DB table.
    >Plz suggest waht needs to be done to catch the edited valuse and update the same into DB table</b>.

    hi,
    Check this might help you...
    Regard points if helpful....
    DATA: G_CONTROL TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
    G_ALV TYPE REF TO CL_GUI_ALV_GRID.
    DATA: T_FCAT TYPE LVC_T_FCAT,
    WA_FCAT TYPE LVC_S_FCAT.
    DATA: I_ZAMIT TYPE TABLE OF ZAMIT_SHIP_TAB WITH HEADER LINE.
    DATA: I_INDEX TYPE I.
    DATA: G_OK_CODE TYPE SY-UCOMM.
    DATA: G_OK_CODE1 TYPE SY-UCOMM.
    SELECT * FROM ZAMIT_SHIP_TAB INTO TABLE I_ZAMIT.
    CALL SCREEN 9000.
    SCREEN FORMS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    *& Module STATUS_9000 OUTPUT
    text
    MODULE STATUS_9000 OUTPUT.
    SET PF-STATUS 'PF9001'.
    SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_9000 OUTPUT
    *& Module CREATE_CONTROL OUTPUT
    text
    MODULE CREATE_CONTROL OUTPUT.
    CREATE OBJECT G_CONTROL
    EXPORTING
    PARENT =
    CONTAINER_NAME = 'G_CUSTOM_CONTROL'
    STYLE =
    LIFETIME = lifetime_default
    REPID =
    DYNNR =
    NO_AUTODEF_PROGID_DYNNR =
    EXCEPTIONS
    CNTL_ERROR = 1
    CNTL_SYSTEM_ERROR = 2
    CREATE_ERROR = 3
    LIFETIME_ERROR = 4
    LIFETIME_DYNPRO_DYNPRO_LINK = 5
    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.
    ENDMODULE. " CREATE_CONTROL OUTPUT
    *& Module CREATE_ALV OUTPUT
    text
    MODULE CREATE_ALV OUTPUT.
    CREATE OBJECT G_ALV
    EXPORTING
    I_SHELLSTYLE = 0
    I_LIFETIME =
    I_PARENT = G_CONTROL
    I_APPL_EVENTS = space
    I_PARENTDBG =
    I_APPLOGPARENT =
    I_GRAPHICSPARENT =
    I_NAME =
    I_FCAT_COMPLETE = SPACE
    EXCEPTIONS
    ERROR_CNTL_CREATE = 1
    ERROR_CNTL_INIT = 2
    ERROR_CNTL_LINK = 3
    ERROR_DP_CREATE = 4
    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.
    ENDMODULE. " CREATE_ALV OUTPUT
    *& Module DISPLAY_ALV OUTPUT
    text
    MODULE DISPLAY_ALV OUTPUT.
    PERFORM PREPARE_FIELD_CATALOG.
    CALL METHOD G_ALV->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME = 'SFLIGHT'
    IS_VARIANT =
    I_SAVE = 'X'
    I_DEFAULT = 'X'
    IS_LAYOUT =
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING = T_TOOLBAR[]
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    IR_SALV_ADAPTER =
    CHANGING
    IT_OUTTAB = I_ZAMIT[]
    IT_FIELDCATALOG = T_FCAT
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 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.
    ENDMODULE. " DISPLAY_ALV OUTPUT
    *& Form PREPARE_FIELD_CATALOG
    text
    --> p1 text
    <-- p2 text
    FORM PREPARE_FIELD_CATALOG .
    REFRESH T_FCAT.
    CLEAR WA_FCAT.
    WA_FCAT-COL_POS = 1.
    WA_FCAT-COLTEXT = 'SHIPMENT NO.'.
    WA_FCAT-FIELDNAME = 'ZSHIP_NO'.
    WA_FCAT-REF_TABLE = 'I_ZAMIT'.
    WA_FCAT-edit = 'X'.
    APPEND WA_FCAT TO T_FCAT.
    CLEAR WA_FCAT.
    WA_FCAT-COL_POS = 2.
    WA_FCAT-COLTEXT = 'DOC TYPE'.
    WA_FCAT-FIELDNAME = 'ZDOC_TYP'.
    WA_FCAT-REF_TABLE = 'I_ZAMIT'.
    WA_FCAT-KEY = 'X'.
    APPEND WA_FCAT TO T_FCAT.
    CLEAR WA_FCAT.
    WA_FCAT-COL_POS = 3.
    WA_FCAT-COLTEXT = 'NAME_CR'.
    WA_FCAT-FIELDNAME = 'ZNAME_CR'.
    WA_FCAT-REF_TABLE = 'I_ZAMIT'.
    WA_FCAT-KEY = 'X'.
    APPEND WA_FCAT TO T_FCAT.
    CLEAR WA_FCAT.
    WA_FCAT-COL_POS = 4.
    WA_FCAT-COLTEXT = 'SHIP_TYP'.
    WA_FCAT-FIELDNAME = 'ZSHIP_TYP'.
    WA_FCAT-REF_TABLE = 'I_ZAMIT'.
    WA_FCAT-KEY = 'X'.
    APPEND WA_FCAT TO T_FCAT.
    CLEAR WA_FCAT.
    WA_FCAT-COL_POS = 5.
    WA_FCAT-COLTEXT = 'LEG_IND'.
    WA_FCAT-FIELDNAME = 'ZLEG_IND'.
    WA_FCAT-REF_TABLE = 'I_ZAMIT'.
    WA_FCAT-KEY = 'X'.
    APPEND WA_FCAT TO T_FCAT.
    CLEAR WA_FCAT.
    ENDFORM. " PREPARE_FIELD_CATALOG
    *& Module LEAVE INPUT
    text
    MODULE LEAVE INPUT.
    LEAVE PROGRAM.
    ENDMODULE. " LEAVE INPUT
    *& Module USER_COMMAND_9000 INPUT
    text
    MODULE USER_COMMAND_9000 INPUT.
    IF G_OK_CODE = 'CHANGE'.
    DATA: VALUE TYPE C,
    COL TYPE I ,
    ROW TYPE LVC_S_ROW,
    COLNO TYPE LVC_S_COL,
    ROWNO TYPE LVC_S_ROID.
    CALL METHOD G_ALV->GET_CURRENT_CELL
    IMPORTING
    E_ROW = I_INDEX
    CALL METHOD G_ALV->GET_CURRENT_CELL
    IMPORTING
    E_ROW =
    E_VALUE = VALUE
    E_COL = COL
    ES_ROW_ID = ROW
    ES_COL_ID = COLNO
    ES_ROW_NO = ROWNO.
    READ TABLE I_ZAMIT INDEX I_INDEX.
    CALL SCREEN 9001 STARTING AT 10 10 .
    ENDIF.
    ENDMODULE. " USER_COMMAND_9000 INPUT
    *& Module STATUS_9001 OUTPUT
    text
    MODULE STATUS_9001 OUTPUT.
    SET PF-STATUS 'PF9002'.
    SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_9001 OUTPUT
    *& Module USER_COMMAND_9001 INPUT
    text
    MODULE USER_COMMAND_9001 INPUT.
    IF G_OK_CODE1 = 'SAVE'.
    MODIFY ZAMIT_SHIP_TAB FROM I_ZAMIT.
    SELECT * FROM ZAMIT_SHIP_TAB INTO TABLE I_ZAMIT.
    CALL METHOD G_ALV->REFRESH_TABLE_DISPLAY.
    CALL SCREEN 9000.
    ENDIF.
    ENDMODULE. " USER_COMMAND_9001 INPUT

  • ALV: columns in read-only mode look like editable columns in edit mode

    Hi,
    My application contains an ALV table which should be toggled between display and edit mode like the rest of the fields.
    The evident solution was to use
    if_salv_wd_table_settings~set_read_only( abap_true or abap_false)
    However, unlike the rest of the fields, when the application changes into display mode and the fields get grey like in any SAP application, the columns in the table which were editable remain white, and those which were not editable and thus grey, get now white, too, instead of the other way round. So it will look to the normal user, as if now all columns would be editable!
    Of course, he would realize that they are not when he tries to edit them, but this is irritating.
    See following link with screenshots (only active for 3 weeks from now on):
    [Link to my webmail space/SDN: .|https://businesswebmail.telekom.at/filestorage/MzYxMTk1OTMx/]
    I have looked
    through my books ("Einstieg in Web Dynpro for ABAP", "Praxisbuch Webdynpro for ABAP", ...)
    through the wiki for Webdynpro for ABAP here in SDN as well as through this forum (by searching with "ALV edit")
    through the notes in BC-WD-CMP-ALV
    but could not find any solution. Most tables in those PDF articles found here in the WD4A wiki also show white cells although they are probabliy in read-only mode (e.g. the imitation of the SE16N browser article).
    The attributes to the LO_CELL_EDITOR for both Inputfields and textview columns contain exactly the same values when toggling between display and edit mode (read-only in table settings), so also no chance to change here anything.
    Also changing the cell design is not a solution as there is no design that looks like grey for not editable according to WDUI_TABLE_CELL_DESIGN  ([SAP Help - WDUI_TABLE_CELL_DESIGN|http://help.sap.com/saphelp_nw2004s/helpdata/en/56/5e9041d3c72e7be10000000a1550b0/frameset.htm].
    I do not know if I have made an error, as this is my 3rd Web Dynpro (after the first 2 of the introduction book), or SAP is really inconsistent in User interface between "normal" fields and ALV table fields.
    Can you please help me?
    Thanks in advance,
    Erlend

    Hi,
    In my application aslo, i have 30 columns out of which 10 are input fields. But, i'm showing the table as ABAP_TRUE incase of Non-editable otherwise to abap_false. Now i'm getting everything as in WHITE cells.
    Do you want to show it is Grey mode with Non-editable feature. Is that so.
    How many columns are there which has Input fields.
    Get the column references.
    Now, based on the mode of display create the object as Input or Textview field.
    For that column -
    If mode eq 'D'.
    Create an object for Textview(cl_salv_wd_uie_text_view)
    else.
    Create an Object for Inputfield(cl_salv_wd_uie_input_field)
    endif.
    The Append row is a standard button or custom one on ALV toolbar.
    Do you want to hide the toolbar or just disable these buttons.
    If you want to hide the toolbar then refer my wiki -
    http://wiki.sdn.sap.com/wiki/display/WDABAP/NullreferenceforUPDATETOOLBARerrorsofALVinthewebdynpro+ABAP
    Regards,
    Lekha.
    Edited by: Lekha on Sep 30, 2009 8:06 PM

  • In Alv table, a column is editable mode, but want few cells in read only

    Hi All,
    I have a ALV table which column A and B.
    Both are in editable mode. I want to make fews in column B, to be read only.
    How to make it. Please help me.
    Thanks
    Vimalraj

    hi,
    refer this program,
    *& Report  ZALV_COLOR_DISPLAY_EDIT
    REPORT  zalv_color_display_edit.
    TYPE-POOLS: slis.
    TABLES : zcust_master2.
    INTERNAL TABLE DECLARATION
    TYPES : BEGIN OF wi_zcust_master2,
            zcustid LIKE zcust_master2-zcustid,
            zcustname LIKE zcust_master2-zcustname,
            zaddr LIKE zcust_master2-zaddr,
            zcity LIKE zcust_master2-zcity,
            zstate LIKE zcust_master2-zstate,
            zcountry LIKE zcust_master2-zcountry,
            zphone LIKE zcust_master2-zphone,
            zemail LIKE zcust_master2-zemail,
            zfax LIKE zcust_master2-zfax,
            zstat LIKE zcust_master2-zstat,
            field_style  TYPE lvc_t_styl,
    END OF wi_zcust_master2.
    DATA: it_wi_zcust_master2 TYPE STANDARD TABLE OF wi_zcust_master2
                                                     INITIAL SIZE 0,
          wa_zcust_master2 TYPE wi_zcust_master2.
    *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.
      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   = 'ZCUSTID'.
      wa_fieldcat-scrtext_m   = 'CUSTOMER ID'.
      wa_fieldcat-col_pos     = 0.
      wa_fieldcat-outputlen   = 10.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZCUSTNAME'.
      wa_fieldcat-scrtext_m   = 'CUSTOMER NAME'.
      wa_fieldcat-col_pos     = 1.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZADDR'.
      wa_fieldcat-scrtext_m   = 'ADDRESS'.
      wa_fieldcat-col_pos     = 2.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZCITY'.
      wa_fieldcat-scrtext_m   = 'CITY'.
      wa_fieldcat-col_pos     = 3.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZSTATE'.
      wa_fieldcat-scrtext_m   = 'STATE'.
      wa_fieldcat-col_pos     = 4.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZCOUNTRY'.
      wa_fieldcat-scrtext_m   = 'COUNTRY'.
      wa_fieldcat-col_pos     = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZPHONE'.
      wa_fieldcat-scrtext_m   = 'PHONE NUMBER'.
      wa_fieldcat-col_pos     = 6.
    wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZEMAIL'.
      wa_fieldcat-scrtext_m   = 'EMAIL'.
      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   = 'ZFAX'.
      wa_fieldcat-scrtext_m   = 'FAX'.
      wa_fieldcat-col_pos     = 8.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZSTAT'.
      wa_fieldcat-scrtext_m   = 'STATUS'.
      wa_fieldcat-col_pos     = 9.
      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
          is_layout_lvc      = gd_layout
          it_fieldcat_lvc    = it_fieldcat
          i_save             = 'X'
        TABLES
          t_outtab           = it_wi_zcust_master2
        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
          text
    -->  p1        text
    <--  p2        text
    FORM data_retrieval .
      DATA: ld_color(1) TYPE c.
      SELECT zcustid zcustname zaddr zcity zstate zcountry zphone zemail
    zfax zstat UP TO 10 ROWS FROM zcust_master2 INTO CORRESPONDING FIELDS OF
    TABLE it_wi_zcust_master2.
    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 following code sets it to be disabled(display only) if 'ZFAX'
    is NOT INITIAL.
      LOOP AT it_wi_zcust_master2 INTO  wa_zcust_master2.
        IF  wa_zcust_master2-zfax IS NOT INITIAL.
          ls_stylerow-fieldname = 'ZFAX' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                          "set field to disabled
          APPEND ls_stylerow  TO  wa_zcust_master2-field_style.
          MODIFY it_wi_zcust_master2  FROM  wa_zcust_master2.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "set_specific_field_attributes
    Regards,
    K.Tharani.

  • ALV colors in edit mode

    Hello,
    I have an ALV grid with an editable checkbox column.
    Now I have two problems regarding the colors:
    1. as you know, when in edit mode, the colors change. I overrode them with custom colors, but the editable column's cells have still a white margin which I cannot get rid of
    2. Zebra layout does not work anymore. If I color the rows with a zebra pattern manually, I would have to re-do it everytime the table is resorted.
    Can anyone think of a better way to handle coloring in edit mode?
    Thanks a lot.

    hi,
    Chk this link.
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm
    Regards
    Reshma

  • F4 Help value in Edit mode in Reuse ALV FM

    I did an extensive search in this forum, but i cudnt find the answer i am looking for.
    I am using Normal Dialog screen in which user validate the screen and hit the save button.
    I need to show this values in Pop-up ( I have called the FM reusee alv_grid_display).
    In the display one of field is editable and i am showing F4 help for the editable field.
    User clicks any value from F4help, i need to store the value selected in my custom table .
    User command does not register that event.
    How to register that event when user clicks the f4 help, i am getting F4 help already and able to select the value too.I
    need to store that selected value.
    Please dont recomment using OO already i have used the classed for display and again calling nornal diaglog screen and for validation i need to call pop-up in same screen ( Used alv FM screen ).
    Please let me know your answer ASAP.

    Thank you very much,
    during testing I have recognized, that the buttons in the toolbar are new functions, because of the edit mode.
    So I have put all the new button into the excluding list. It worked!
    Thanks again!
    Andreas

  • ALV Grid- GET_SELECTED_ROWS returns empty table in edit mode

    Hi all,
    I saw similar threads on this forum, but didn't find the answer. Do you know if that is possible to force grid to return selected rows when is in edit mode? When I switch to display mode everything works just fine.
    regards,
    Marcin

    It is necessary to enforce the ALV to transport data from the frontend to the backend. Therefore register the event
    Register 'Enter' event
      CALL METHOD go_alv->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    After then clicking 'ENTER', the data should be available in the ABAP program. Without any user interaction it is not possible (as far as I know).
    Best regards,
    Thomas

  • Alv quanitty field edit mode

    Hi
    I am displaying one quanity field in alv. which is in Editable mode. while running and editing it is behaving strangly. if I enter the value 7,00 it is becoming 0,07 in the internal table .
    Please guide me in this regard.
    jaffer vali shaik

    Jaffer Please check the Below.
    Case#1.
    REPORT  ztest_alv_oo22.
    TYPE-POOLS: slis.
    DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
         wa_cat TYPE slis_fieldcat_alv.
    DATA: BEGIN OF it_data OCCURS 0,
            vbeln TYPE vbeln,
            matnr TYPE matnr,
            menge TYPE p DECIMALS 2,
          END OF it_data.
    DO 10 TIMES.
      it_data-menge = '10.00'.
      APPEND it_data.
    ENDDO.
    wa_cat-fieldname = 'VBELN'.
    wa_cat-tabname = 'IT_DATA'.
    wa_cat-seltext_l = 'Test'.
    APPEND wa_cat TO it_fieldcat.
    CLEAR wa_cat.
    wa_cat-fieldname = 'POSNR'.
    wa_cat-tabname = 'IT_DATA'.
    wa_cat-seltext_l = 'Test'.
    APPEND wa_cat TO it_fieldcat.
    CLEAR wa_cat.
    wa_cat-fieldname = 'MENGE'.
    wa_cat-tabname = 'IT_DATA'.
    wa_cat-seltext_l = 'Qty'.
    wa_cat-edit = 'X'.
    wa_cat-decimals_out = 2.
    APPEND wa_cat TO it_fieldcat.
    CLEAR wa_cat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program      = sy-repid
        i_callback_user_command = 'USER_COMMAND'
        it_fieldcat             = it_fieldcat
      TABLES
        t_outtab                = it_data
      EXCEPTIONS
        program_error           = 1.
    *&      Form  user_command
    *       text
    *      -->UCOMM      text
    *      -->SELFIELD   text
    FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
      BREAK-POINT.
    ENDFORM.                    "user_command
    Case#2. with out Decimals_out option.
    REPORT  ztest_alv_oo22.
    TYPE-POOLS: slis.
    DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
         wa_cat TYPE slis_fieldcat_alv.
    DATA: BEGIN OF it_data OCCURS 0,
            vbeln TYPE vbeln,
            matnr TYPE matnr,
            menge TYPE p DECIMALS 2,
          END OF it_data.
    DO 10 TIMES.
      it_data-menge = '10.00'.
      APPEND it_data.
    ENDDO.
    wa_cat-fieldname = 'VBELN'.
    wa_cat-tabname = 'IT_DATA'.
    wa_cat-seltext_l = 'Test'.
    APPEND wa_cat TO it_fieldcat.
    CLEAR wa_cat.
    wa_cat-fieldname = 'POSNR'.
    wa_cat-tabname = 'IT_DATA'.
    wa_cat-seltext_l = 'Test'.
    APPEND wa_cat TO it_fieldcat.
    CLEAR wa_cat.
    wa_cat-fieldname = 'MENGE'.
    wa_cat-tabname = 'IT_DATA'.
    wa_cat-seltext_l = 'Qty'.
    wa_cat-edit = 'X'.
    APPEND wa_cat TO it_fieldcat.
    CLEAR wa_cat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program      = sy-repid
        i_callback_user_command = 'USER_COMMAND'
        it_fieldcat             = it_fieldcat
      TABLES
        t_outtab                = it_data
      EXCEPTIONS
        program_error           = 1.
    *&      Form  user_command
    *       text
    *      -->UCOMM      text
    *      -->SELFIELD   text
    FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
      BREAK-POINT.
    ENDFORM.                    "user_command
    Change the Qty in the output and use refresh .
    and see.

  • ALV edit mode

    Hi All,
    I am displaying an ALV List.There is a column called Final invoice indicator which is a check box.When the user checks this check box that record in the ALV output has to be changed to non-editable mode.I am using classes for ALV display.How can i achieve this?
    Thanks,
    Rakesh.

    Hi,
    U can check the value of the checkbox and if it is 'X' u can set it to no editable as
        CALL METHOD g_grid->set_ready_for_input
                         EXPORTING i_ready_for_input = 0.
    where g_grid is the alv object.
    Hope it helps.
    Anju

  • Cannot use edit mode with zebra layout in alv

    Hi,
    I am using 'REUSE_ALV_GRID_DISPLAY' for the ALV genration,
    I found that I cannot use
              it_layout-edit_mode = 'X'.
              it_layout-zebra = 'X'.
    simultaneously..
    Only zebra layout come up and not the edit mode...
    Is there a wrk around to solve this
    Thank you,
    Arjun.G

    try removing
    it_layout-edit_mode = 'X'.
    from ur code..
    and add
    is_fieldcat-edit = 'X'   " for all columns...

  • ALV Grid fields from editable to non-editable mode

    Hi,
    I am displaying my data through ALV Grid. In my grid the non-key fields are in editable mode.
    When I edit any of the editable fields and place the cursor on other field the field which I have edited should become disable(non-editable). Again if I want to edit the same field which is now in non-editable mode should again change to editable mode when the cursor is placed on it.
    Thanks & Regards,
    Adithya M.

    Hi Adithya,
    I am confused by your statement "place the cursor on other field the field which I have edited should become disable" -- are you stating that this is the requirement or what is currently happening with your program.  The way the edit fields should work by default is they are editable at all times unless you tell it otherwise. 
    If you are saying your requirement is to change the field to disabled once the field is edited (runtime change), first you want to handle the event on data changed then within your method of handling on data changed, you can disable the field from being edited by using cell styles and changing the value to disabled. 
    If you look at program BCALV_GRID_EDIT,
    You will find code where it disables the field for edit using Cell Style -- this will give you an idea how Cell Style controls editable fields and display fields:
            ls_cell-style  = cl_gui_alv_grid=>mc_style_enabled.
            ls_cell-maxlen = 4.
            ls_cell-fieldname = 'CARRNAME'.
            append ls_cell to gt_sflight-cell.
    This specific code will set the field disabled when the program is first exectued, in your case if you need to do this at run time, after someone edits the field, you need to implement handling the event on data changed, in the same program you will find:
    method handle_data_changed.                 
       perform data_changed using er_data_changed.
    endmethod.                     
    It is within this method that you can disable a field for editing.
    However, once it is disabled you will not get back into the handle_data_changed method.  I'm not sure I understand your statement "Again if I want to edit the same field which is now in non-editable mode should again change to editable mode when the cursor is placed on it."  Why would you want the user to be able to edit something, then show it disabled, then let them click on it and edit it again?  Why not just leave it in edit mode?  Maybe if I understand the requirement better, I can answer this portion of the question. 
    If this is based on security or changing from edit to display for the entire grid, you can run the same program mentioned above and click on the Change/Display button in the top left to see how it enables and disables the entire grid for editing.
    Cheers,
    Bonnie

Maybe you are looking for