How to make ALV cell editable

Hi ,
I am using cl_gui_alv_grid .
please let me know how to make a particular cell is editable
eg:  cell corresponding to first row second column should be editabel but remaining all are non editable

Hi,
Loop at your internal table.
Eg: i have total 5 fields in my internal table itab_zqmeinz. in that 3 fields are editable as below.
declare DATA: lt_celltab TYPE lvc_t_styl.
internal table with celltab as one of the column
DATA: BEGIN OF itab_zqmeinz OCCURS 0. "TYPE STANDARD TABLE OF zqmseqkopf
        INCLUDE STRUCTURE zqmseqeinz.
DATA: celltab TYPE lvc_t_styl.
DATA: END OF itab_zqmeinz.
LOOP AT itab_zqmeinz INTO wa_zqmeinz.
      l_index = sy-tabix.
      REFRESH lt_celltab.
      CLEAR wa_zqmeinz-celltab.
      PERFORM fill_celltab1 USING 'RW'
                              CHANGING lt_celltab.
      INSERT LINES OF lt_celltab INTO TABLE wa_zqmeinz-celltab.
      MODIFY  itab_zqmeinz FROM wa_zqmeinz INDEX l_index.
    ENDLOOP.
FORM fill_celltab1 USING value(p_mode)
                  CHANGING pt_celltab TYPE lvc_t_styl.
Refresh pt_celltab.
  clear ls_celltab.
  IF p_mode EQ 'RW'.
    l_mode = cl_gui_alv_grid=>mc_style_enabled.    "to enable the required fields
  ELSE.                                "p_mode eq 'RO'
    l_mode = cl_gui_alv_grid=>mc_style_disabled.
  ENDIF.
  ls_celltab-fieldname = 'NEBENSEQUEN'.   " field1
  ls_celltab-style = l_mode.
  INSERT ls_celltab INTO TABLE pt_celltab.
  ls_celltab-fieldname = 'BEZEICHNUNG'.     "field2
  ls_celltab-style = l_mode.
  INSERT ls_celltab INTO TABLE pt_celltab.
  ls_celltab-fieldname = 'SORTIERUNG'.         "field3
  ls_celltab-style = l_mode.
  INSERT ls_celltab INTO TABLE pt_celltab.
Endform.
It works. I have done it in my program.
Thanks,

Similar Messages

  • : How to make a cell editable and uneditable in a JTable

    i have created a table and want to make some modifications in the cells and also make it uneditable...i hace used abstract table model . kindly guide me

    You have got to implement the 'isCellEditable' method within your abstract table model. If you want to allow the user to only edit cells in the first column you would add the following:
    public boolean isCellEditable (int row, int col) {
      if ( col == 0 ) {
        return true
      } else {
        return false;
    }That should be sufficent to base your own needs off.
    Jon

  • Alv cell editing

    Hi ,
    can anybody tell me how to make a cell editable in alvgrid .

    In the field catalogue, change the attributes of that field as editable
    fcat-edit = 'X'.
    After creating the grid, register event entered and modified
    Create alv grid
        CREATE OBJECT w_grid_vend
          EXPORTING
            i_parent          = w_vend_contnr
          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.
    Register edit event
        CALL METHOD w_grid_vend->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter
          EXCEPTIONS
            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.
    Edit event for modified
        CALL METHOD w_grid_vend->register_edit_event
          EXPORTING
            i_event_id =  cl_gui_alv_grid=>mc_evt_modified
          EXCEPTIONS
          error      = 1
          OTHERS     = 2.
    Handle the changed data in the methods
    Handle data changed
        METHODS handle_data_changed FOR EVENT data_changed
                               OF cl_gui_alv_grid
                               IMPORTING er_data_changed.

  • How to make an checkbox editable and uneditable within a single alv output.

    Hi,
    How to make an checkbox editable and uneditable within a single alv output depending on condition.
    I have used Reuse_alv_grid_display.
    In my output every checkbox is editable. i have used edit = 'X'.
    I want editable checkbox for correct value and uneditable checkbox for incorrect value in a single alv

    >
    Mukilansap wrote:
    > I want editable checkbox for correct value and uneditable checkbox for incorrect value in a single alv
    Use alv styles to achieve this, set the style for each record before displaying the ALV. Structure LVC_S_STYL.
    Take a look at the example BCALV_EDIT_02, it is OOPS based, but check how the style table is filled.
    regards,
    Advait

  • 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 ALV output Colorless

    Hi All,
    How to make ALV output Colorless at all....
    I have Sum field which after all the rows it iwll do sum and it is showing in ALV .it is showing in Yellow color. Client dont want that.
    Currently I am using ALV_LIST_DISPLAY Fm to see this report output via Mss.
    So the client want a plane paper color which 2 things are strukcing me up.
    1) How to make Sum row(Final Sum up row) as colorless
    2) How to make header as colorless.(Header column like emp no , emp name ,e.t.c)
    Regards
    sas
    Can any body any Idea is this possible or not..
    Edited by: saslove sap on Apr 13, 2011 11:26 AM

    Hi sap.,
    I don't think decolor header is possible.,  but u can show totals color less by calculating manually.,
    as., in field catalog  donot use do_sum = 'X'.  so it will not calculate totals and yellow color will not appear., now u calculate total and append at last row., 
    ex: loop at itab into wa.
    wa_alv-f1  = wa-f1.
    wa_alv-f2 = wa-f2.
    temp_total = temp_total + wa-f2.
    append wa_alv to itab_alv.
    endloop.
    wa_alv-f1 = 'Total'.
    wa_alv-f2 = temp_total.
    append wa_alv to itab_alv.
    now itab_alv contains all records along with total..
    hope this helps u.,
    reply if u need some more clarifications.,
    Thanks & Regards
    Kiran

  • How to make table as "editable false"

    Dear Forum,
    i am user of jDeveloper jClient/Swing .jpr.
    cutomer table having following attributes-
    1.cust_id (primary key)
    2.cust_name
    3.cust_add
    Suppose customerview bind with jTable1.
    Using ViewObjectEditor, i set "updateable never" for all fields.
    This show error, when data insert into table " cust_id as
    read only".
    Help me, Using jClient Binding how to make Table as "editable false".

    Overriding method prepareEditor() for new table:
    private JTable tableList = new JTable(){
    public Component prepareEditor(TableCellEditor editor, int row, int column) {
    // 1 and 2 column is not editable
    if(column == 0 || column == 1){ return null; }
    return super.prepareEditor(editor, row, column);

  • How to make table cell have certain width

    Hi
    i have 3 cells when i write text in any cell it effects the
    width of other cells !!!
    how to make every cell have certain? i mean i want to wrap
    the text not to effect the cell width
    thanks in advance.

    Hi Mac,
    Try this
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
    Transitional//EN">
    <HTML><HEAD><TITLE>Home</TITLE>
    <META http-equiv=Content-Type content="text/html;
    charset=iso-8859-1">
    <style>
    .text-content-green {
    FONT-SIZE: 11px;
    COLOR: #a5a834;
    LINE-HEIGHT: 20px;
    FONT-STYLE: normal;
    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
    TEXT-DECORATION: none;
    .text-content-green:hover {
    FONT-SIZE: 11px;
    COLOR: #AE0B0B;
    LINE-HEIGHT: 20px;
    FONT-STYLE: normal;
    FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
    TEXT-DECORATION:underline;
    .margin {
    margin: 1px 1px 1px 1px;
    border-style: solid;
    border-top-width: 1px;
    border-left-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-color: gainsboro;
    </style
    </HEAD>
    <BODY topmargin="10px" leftmargin="0" rightmargin="0"
    class="body-style">
    <TABLE width="729" border="0" cellpadding="0"
    cellspacing="0" cellsadding="0" align="center" class="margin">
    <TBODY>
    <TR>
    <TD width="125" valign="top" bgcolor="#f0f0c1">
    <table width="125" border="0" cellspacing="0"
    cellpadding="0">
    <tr>
    <td width="25" height="25" align="middle"></td>
    <td width="108" class="text-content-green"><A
    class="text-content-green" href="default.html">LEFT
    NAV</A></td>
    </tr>
    <tr>
    <td colspan="2" align="middle"></td>
    </tr>
    <tr>
    <td width="25" height="25" align="middle"></td>
    <td width="108" class="text-content-green"></td>
    </tr>
    <tr>
    <td colspan="2"></td>
    </tr>
    </table>
    </TD>
    <TD vAlign=top width=539 bgColor="white" height=471>
    <P class="text-content-green" align=left
    style="padding-left:5px">Lorem ipsum dolor sit amet, consectetur
    adipisicing elit.Duis aute irure dolor in reprehenderit in
    voluptate velit esse cillum .
    </P>
    </TD>
    </TR>
    </TBODY>
    </TABLE>
    </TD>
    </TR>
    </TBODY>
    </TABLE>
    </BODY>
    </HTML>
    HTH
    Shanthi

  • How to make Date fields Editable or Non-Editable based on Call Staus

    Hi,
    We are using CRM2007 Web GUI for Service call creation. We are using date profile to populate the dates. Here my requirement is if call status is 'Call created' then some set of date fields to be appeared in display mode(Non Editable) and some set of date fields to be appeared in change mode(Editable). How to achieve this. Kindly suggest me.
    Regards,
    Steve

    Hello,
    Kindly check the following thread which is giving many solutions for your requirement:
    Re: how to make field non-editable (display mode)
    Kind regards,
    Nicolas Busson.

  • How to make ALV editable?

    Hi all,
    i wonder if there is a way to make cells of the new ALV CL_SALV_TABLE editable. I know that there is a way for the older version CL_GUI_ALV_GRID as you can see in SAP Demos BCALV_EDIT_*.
    Do i have to use the older one for editing fields or is there a way to achieve that with CL_SALV_TABLE ?
    Regards
    Mark-André

    Hi Mark,
              if you are using cl_gui_alv_grid class you can make fields of the grid editable by setting field catalog of structure type lvc_s_fcat field edit as 'X'.
    Regards
    Naveen

  • How to make a column editable

    Hi all,
             I want a column to have checkboxes in my table where user can select at runtime.
    I added one colum to my table with Checkboxes.But the checkboxes are comming in non Editable mode.
    How to make them editable???
    My context structure is already binded to my table..now i added one ValueNode with One attribute and i binded that texts property of checkbox to the Valueattribute
    The cardinality of my ValueNode is 1..1 and selection is 0..1
    Regards
    Chandrashekar.

    Hi,
    when you added the checkbox as cell editor, then go to it's property:
    set "enable"  as true.
    set "readonly" as false.
    and create a boolean attribute "checked" in the table bode and bind it to the check box value property.
    And in the onAction of checkbox wirte the code to select or deselect the checkbox.
    and set the value as follows:
    wdcontext.nodeTable().getcurrentElement().setAttribuiteValue("checked", true);
    Regards,
    Praveen

  • How to set a cell editable at runtime for jtable

    Hi evry body
    i need to set a cell as editable during runtime and set some value for the cell and make it non editable after setting value
    how can i do it? urgent help appreciated
    regards
    anil

    You could override the methods isCellEditable(...) and setValueAt(...) in your JTable's TableModel to get the effect desired
    // Assuming that each element of the array will be false initially
    boolean[][] valueSet = new boolean[noRows][noCols];
    public boolean isCellEditable(int row, int col) {
      return !valueSet[row][col];
    public void setValueAt(Object obj, int row, int col) {
      super.setValueAt(obj, row, col);
      valueSet[row][col] = true;
    }

  • JTree: How to make few nodes editable

    I have a JTree which displays some complex expression.
    I want to make few nodes of the JTree editable and specify JCombobox as an editor. How can I do this?
    Any help or pointer?
    Thanks in advance
    Sachin

    I want to make few nodes of the JTree editablei'm not sure how you can do this - there is JTree.setPathEditable(boolean) but this means you'd have to subclass JTree ?
    you might be able to make a cell editor that returns some value to indicate a particular cell isn't editable, or failing that return a read-only component but I've not tried this..
    and specify JCombobox as an editor.this may help:
    http://www.cs.cf.ac.uk/Dave/HCI/HCI_Handout_CALLER/node156.html
    asjf

  • How to set JTable cell editable/non-editable dynamically using NetBean?

    I am using NetBean 6.5, create a database desktop application, I using the persistence entity manager to bind my JTable with database.
    Now, I want to set practicular cells which are enable and disable, I tried to create my own table model and override the isEditable() method, which it seems didn't work. I guessed the problem is the persistence connection between my Table and database.
    How can I solve it? Any example? I just googled the web and can't find example which use netbean combined with database. I know that a single JTable would work when creating your own model.
    thx.

    I know what coding i did, Yes u r right but im new to GUI programming only,
    That's why i posted it to forums, I gone through the Control Flow Statements link what u have given.
    U didnt get my question at all.
    Again the problem im facing is the table is already displayed with 2nd column uneditable.
    When some Action done on table, i need to make 2nd column editable at run time.
    Thanks if u provide me the solution instead of deciding what type of programmer im.

  • How to make a cell in a JTable to be uneditable and handle events

    I tried many things but failed,How do you make a cell in a JTable to be uneditable and also be able to handle events>Anyone who knows this please help.Thanx

    Hello Klaas2001
    You can add KeyListener ,MouseListener
    Suppose you have set the value of cell using setValueAt()
    table.addKeyListener(this);
    public void keyTyped(KeyEvent src)
    String val="";
    int r= table.getEditingRow();
    int c= table.getEditingColumn();
    val=table.getValueAt(r,c).toString();
    if (r!=-1 && c!=-1)
    TableCellEditor tableCellEditor = table.getCellEditor(r, c);
    tableCellEditor.stopCellEditing();
    table.clearSelection();
    table.setValueAt(val,r,c);
    public void keyReleased(KeyEvent src)
    public void keyPressed(KeyEvent src)
    table.addMouseListener(this);
    public void mouseClicked(MouseEvent e)
    public void mouseEntered(MouseEvent e)
    public void mouseExited(MouseEvent e)
    public void mousePressed(MouseEvent e)
    public void mouseReleased(MouseEvent e)
    if(e.getClickCount()>=2)//Double Click
    table.clearSelection();
    int r= table.getEditingRow();
    int c= table.getEditingColumn();
    if (r!=-1 && c!=-1)
    TableCellEditor tableCellEditor = table.getCellEditor (
    r,c);
    tableCellEditor.stopCellEditing();
    table.clearSelection();
    table.setValueAt("",r,c);
    }//Mouse Released
    You can remove keyListener and Mouse Listener whenever You want to edit
    then add it later.
    Regarding handling events implement javax.swing.event.TableModelListener
    table.getModel().addTableModelListener(this);
    public void tableChanged(javax.swing.event.TableModelEvent source)
    TableModel tabMod = (TableModel)source.getSource();
         switch (source.getType())
    case TableModelEvent.UPDATE:
         break;
         }//Table Changed Method
    //This method gets fired after table cell value is changed.

Maybe you are looking for

  • My imported swf files have lost their streaming sound. What can I do?

    I am trying to import a swf I made that contains streaming sound. When I place it on the time line and press cntr enter my animation plays but with no audio. I see the symbols from the swf and the swf inside my library. When I open the swf file insid

  • "invalid destination address" sending mms

    Whenever I try to send a picture message (or any sort of MMS really), it says "pending" for a few seconds then says "sending" and after a few more seconds it finally says the message failed and a note pops up that says "invalid destination address" N

  • Import from Elements is not on my file menu

    I'm using a trial version of Lightroom 3.2 and I would like to be able to convert my actual catalog under Photoshop Elements 6 to Lightroom. The instructions are clear but this option is not available under my menu of Lightroom?!? Is it because I'm u

  • Premiere Pro CC and AVCHD spanning or Multicam problem

    I'm not exactly sure where to pin the current problem I'm having.  To my best guess it's either an AVCHD spanning issue, or it's just just a Multi-cam bug.  Yesterday I cut a 40 minute multicam sequence.  It looked and played great when I was finishe

  • E1200 randomly stopped working

    I just bought this thing last week and it was workingg earlier today, but now the lights wont even turn on ad when i plug it into my computer and try change the settings with the linksys connect app it doesnt even register the router.