Disabling certain rows in editable oo alv ?

Hello Experts ,
                         I am having internal table of type z table. i am using oo alv to display data using this internal table. I am making my alv editable using field catalog. I want to keep  entire row non editable on the basis of one fields value. so how to do this? i dont want to define seperate 'types' in my program. is it possible?

Hi Bhushan,
there is no other way.
1, Define structure ZTABLE_ALV is SE11 with fields
field           type
.INCLUDE        ZTABLE
STYLES          LVC_T_STYL
2. Define ALV data table and update table in your program with workareas
data: xt_data   type table of ztable_alv.
data: xt_updat  type table of ztable.
data: xs_data   type ztable_alv.
data: xs_updat  type ztable.
3. Data selection directly into  data table
SELECT * FROM ZTABLE
         INTO CORRESPONDING FIELDS OF TABLE xt_data
WHERE...
4. Loop at ALV data table and update STYLES table
5. Show ALV DATA table in editable Grid
6. Update (after button or something else).
* Build update table
loop     at  xt_data
       into  xs_data.
  move-corresponding xs_data to xs_updat.
  append xs_updat            to xt_updat.
endloop.
update ztable from  table xt_updat.
That's alle

Similar Messages

  • 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

  • Making some rows non-editable in ALV grid

    hi
    I am using reuse_alv _grid _display to display the output. I want to make some of the rows non-editable based on some conditions. please help.

    Hi Vijay / Manisha / Murugan
    Is this question answered? The link is presently not working.
    I have a same requirement. I am using reuse_alv _grid _display to display the output. After click on 'Add row'
    button, the alv should add a row in edit mode and remaining all other rows in display mode. Is that possible using reuse_alv _grid _display?
    Any kind of inputs regarding this will be damn damn helpful. Thanks.

  • Not able to get which row is edited in alv grid

    Hi,
    I have created a Editable alv grid .
    My grid does not contain line selection cloumn so How can I get to know which row is to be changed.
    I am using get_selected_rows method but not able to get which row is changed. please help on this.
    Thanks in advance.

    Hi,
      check this ..
      it_ekko1[] = it_ekko[].
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_user_command = 'USER_COMMAND'
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                it_events               = i_events
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    In user command you need to write logic to know which all records have changed.
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
         loop at it_ekko into wa_ekko.
           read table it_ekko1 into wa_ekko1 index sy-tabix.
           if wa_ekko <> wa_ekko1.
    write your logic further
           endif.
         endloop.    
      endcase.
    Regards,
    Srini.

  • How to disable certain rows

    I have table which has 10 rows .
    I want to disable rows from 6 to 8 . It should display only 1 to 5 and 9 to 10. I think table structure is not needed for this query.
    Thanks

    weird question... this?
    SQL> create table t
      2  as
      3  select rownum rn
      4    from all_objects
      5   where rownum <= 10
      6  /
    Table created.
    SQL>
    SQL> select *
      2    from t
      3  /
            RN
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    10 rows selected.
    SQL>
    SQL> select *
      2    from (select rownum r, rn
      3            from t
      4         )
      5   where r not between 6 and 8
      6  /
             R         RN
             1          1
             2          2
             3          3
             4          4
             5          5
             9          9
            10         10

  • Disable certain rows of data to be displayed.....

    I have a program in which the table will display data fed from the server .
    I would have a function in which user have the freedom to select which data he wants to be display on the next refresh page.
    How do i prevent the other data that user does not require to be displayed on the table ??
    by the way all these will affect the rows in the table , so how do i go about manupilating the rows?
    Thank YOu anyone . .

    If you mean that the user will enter a kind of scan, like myitem* or item using as a wildcard, I would create a class called ScanType where you have diiferent return values. In your main code you can use if..else depending on the scantype.
    public final class ScanType
         /** The types are:
         *  -1: source
         *   0: *ource
         *   1: *ourc*
         *   2: sourc*
         *   9: s*urce
         private ScanType()
              super();
         public static final int getScanType(String source)
    // Default is not valid. scan type : 9
              int returnValue = 9;
    // Check scan type -1: source
              if(source.indexOf("*") == -1)
                   returnValue = -1;
    // Check scan type 0
              else if((source.charAt(0) == '*') && (source.charAt(source.length()-1) != '*'))
                   returnValue = 0;
    // Check scan type 1
              else if((source.charAt(0) == '*') && (source.charAt(source.length()-1) == '*'))
                   returnValue = 1;
              else if(source.charAt(source.length()-1) == '*')
                   returnValue = 2;
              return returnValue;
    }You can test this with this code:
    public class ScanTypeTest
         public static void main(String[] args)
              String kalle = "source";
              System.out.println("Scan type: -1 " + kalle + " " + ScanType.getScanType(kalle));
              kalle = "*ource";
              System.out.println("Scan type:  0 " + kalle + " " + ScanType.getScanType(kalle));
              kalle = "*ourc*";
              System.out.println("Scan type:  1 " + kalle + " " + ScanType.getScanType(kalle));
              kalle = "sourc*";
              System.out.println("Scan type:  2 " + kalle + " " + ScanType.getScanType(kalle));
              kalle = "s*urce";
              System.out.println("Scan type:  9 " + kalle + " " + ScanType.getScanType(kalle) + " is invalid");
    }The rest of the code you have to create yourself as I don't know how you will retrieve the data to be displayed.
    Klint

  • ALV: how to disable editable cell and F4 in certain rows only.

    I am building a table maintenance front-end with an ALV grid using OOP concept.  Certain fields are editable and also have customised search helps assigned to them in the ALV structure defined for the grid. What I want is where I have identified an entry in my database table as being locked by another user, I want to grey the line out on the ALV grid so that the entry cannot be edited and not have f4 input whilst this entry is locked by another user.
    I can grey the line out or disable F4 but not both at the same time.  If I disable the cells of the row concerned using MC_STYLE_DISABLED, the F4 is still active and will change the contents of the cell concerned via the data_changed event method in CL_GUI_ALV_GRID.
    I have used MC_STYLE_DISABLED where I have declared  a layout in my table similiar to this:
    DATA: BEGIN OF OUTPUT OCCURS 0,
    FIELD1,
    FIELD2,
    STYLE TYPE LVC_T_STYL,
    LOCK TYPE C.
    END OF OUTPUT.
    DATA: ls_celltab TYPE lvc_s_styl.
    * Where lock identified, field LOCK set to 'X'.
    LOOP AT OUTPUT where lock = 'X'.
    ls_celltab-fieldname = 'FIELD1'.
    ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
    APPEND ls_celltab TO OUTPUT-STYLE.
    ls_celltab-fieldname = 'FIELD2'.
    ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
    APPEND ls_celltab TO OUTPUT-STYLE.
    ENDIF.
    append OUTPUT.
    I have tried adding MC_STYLE_F4_NO to field LS_CELLTAB-STYLE2 but this does not do both actions atthe same time.
    Can anyone suggest what I might be doing wrong or an alternative way around this?
    Many thanks
    Regards
    Larissa

    As I have explained, I have fields that are editable AND are F4 enabled.  What I want is for certain rows of the ALV that I do not want any procesing to occur to make all fields in that row not available for input AND not f4 enabled.  I read a lock using a lock object.  If the entry in my ALV matches the key locked in the lock object, I want that line to be in display mode only in the ALV with no F4 help being able to be called.  It happens on the grid frontend when I press enter and have checked if any of my entries in my ALV are already locked by another user. The code is too long to post here. I can disbale the editable fields using MC_STYLE_DISABLED as described above but then the little drop down to enable F4 input is still visible against the field. 
    I have got round it by calling the f4 in event HANDLE_ON_F4 to not go via the search help and set er_event_data->m_event_handled = c_yes so that the F4 hit list does not appear, but I want to get rid of the drop down marker in that field in that instance.
    Hope this is a little clearer now.
    Larissa

  • Grey out(disable) a row in ALV grid

    Hi,
    I want to know how to grey out(disable) row wise in ALV grid display.
    i..e.. Few rows in ALV grid display shoud be editable and few rows non editable based on certain condition.
    How do we do that....Please help.
    Thanks in advance.

    Hi,
    Since fieldcatalog is used to modify coloum and not the row, the fieldcatalog would not solve the problem.
    Thankyou.

  • Disable row-marking in OO ALV

    Hello,
    I have an OO ALV where I can select all the rows of the list, but I want to disable the row-marking in some lines. For example, in a list with 10 rows, I want that the last 5 rows were not selectable, but the first 5 rows have to be selectable.
    Is it possible?
    Thank you very much!

    Hi,
    Then you could probably do this with the stylefname attribute of the layout catalog.
    For desired rows, set the value cl_gui_alv_grid=>mc_style_disabled to the style cell (added to your output table) for each field in a row... That should work, however, never tried
    I'll try and give an example once I get a system...
    Kr,
    m.
    added: no sorry just realised this won't probably prevent the user to select any row... That's probably not possible without some hacking OO operations,...;)
    Hope you'll have some more info on the subject, I'm also interested now
    Give you feedback anyway if I found something...
    Edited by: Manu D'Haeyer on Sep 29, 2011 7:49 PM

  • Color in certain row to ALV

    How to put color in certain  row to ALV grid report.
    Kindly help.
    Thanks..
    Moderator Message: FAQ.
    Edited by: kishan P on Nov 20, 2010 7:37 PM

    Hi
    A) You need to define a new field for color in your output table: this field has to be a CHAR 3
    B) In layout structure you need to indicate the name of the field for color: IS_LAYOUT-INFO_FIELDNAME = <field for color>
    C) While populating the output table you need to set the color attribute in the field for color:
    ITAB-COLOR = 'Cxy'.
    C is a constant (the value has to start wiht C)
    x is the color number (from 1 to 9, see the SAP help)
    y is Intensified (0 = off 1 = on)
    Max
    Moderator Message: Please do not answer basic and Frequently asked question.
    Edited by: kishan P on Nov 20, 2010 7:38 PM

  • 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

  • How to exclude certain rows in the ALV display from the total?

    Hi,
    May I know is there a way to exclude certain rows that are shown in the ALV control from the calculation of grand total?
    Thanks much.

    See, if
    function module REUSE_ALV_TRANSFER_DATA 's
    IT_EXCLUDING   .... param
    works for you.

  • Is it possible to make certain rows mandatory in ALV custom Grid display?

    Hi experts,
                    Is it possible to make certain columns mandatory in the ALV custom grid control just as we give in a selection screen ?
    Thanks in advance
    regards,
    Ashwin

    fieldcat-key = 'X'.
    Regards,
    Amit

  • Cl_wd_table - enable/disable certain cells

    Hello together,
    I'm looking for a good solution to enable/disable certain cells in a table.
    For example I have the following table (the real table is more complex - with buttons and so on...):
    User
    ToDo
    State
    A
    Todo1
    Done
    B
    Todo2
    In Process
    A
    Todo3
    In Process
    B
    Todo4
    Done
    I have different users which are working on this tabe:
    - Administrator: Can edit whole table (except State column)
    - Employee: Can only edit State Column where he is assigned
    I think it would be difficult to work with context attributs in this case?
    Is it possible to Loop over all table lines an set "enabled" Attribut in the coding?
    Best Regards

    Hi Uwe,
    Check this below links
    How to edit conditionally row of a ALV table in Web Dynpro for ABAP
    ABAP WebDynpro: Can edit a cell in a column?
    Thanks
    KH

Maybe you are looking for