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.

Similar Messages

  • ALV table in edit mode

    hi all,
       have a requirement where I have to create a webdynpro for ABAP table for new row/rows entry, delete row/rows and update row/rows data. This is something like table control in normal ABAP.
    how can I achieve this? Is there any such feature in ALV component?
    Any code sample will be really helpfull.
    Please help!
    Thanks
    Ravi

    Hi Ravi Raju
         In alv you can edit, add and append rows. First you have to initialize the ALV usage in WDDOINIT method of the view in which SALV_WD_TABLE is added as component usage. Then you have to disable the read only attribute of the ALV. If you set the property to abap_false, then append, insert, delete buttons will be added automaticaly. Then you can set the appropriate cell editor for each column.
    initialize ALV Component
    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.
    Get model data
    DATA: l_ref_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
    l_ref_INTERFACECONTROLLER =   wd_This->wd_CpIfc_Alv( ).
      data:
      l_VALUE type ref to Cl_Salv_Wd_Config_Table.
      l_VALUE = l_ref_INTERFACECONTROLLER->Get_Model( ).
    set read only mode to false (and display edit toolbar)
    data: lr_table_settings type ref to
    if_salv_wd_table_settings.
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_false ).
    set cell editor for input fields (~make colum editable)
    DATA: lr_column TYPE REF TO cl_salv_wd_column.
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
    lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'SAMPLE' ).
    CREATE OBJECT lr_input_field EXPORTING value_fieldname =
    'SAMPLE'.
    lr_column->set_cell_editor( lr_input_field ).
    Hope it helps ;>)
    Regards
    Rakesh.

  • Unlock a row in alv - make fields editable

    Hello,
    I have to solve the following problem: I am using ALV FM and I have to display a non-writable alv. When a user selects a line and clicks a button, this line must change to editable mode. I found the example below. At first glance, it seemed to be what I had looked for. But on the second glance I figured out, that it does the opposite of what I need.
    When I set "FIELDCAT-EDIT = space." and "LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED." the whole table rests in locked mode. Could someone please tell me, how to lock all rows and set a single row editable?
    Thanks in advance
    REPORT ZTESTALV.
    TYPE-POOLS: SLIS.
    *- Fieldcatalog
    DATA: IT_FIELDCAT  TYPE LVC_T_FCAT,
          IT_FIELDCAT1  TYPE SLIS_T_FIELDCAT_ALV.
    *- For Events
    DATA:IT_EVENTS TYPE SLIS_T_EVENT.
    DATA:  X_FIELDCAT  TYPE LVC_S_FCAT,
            X_FIELDCAT1  TYPE SLIS_FIELDCAT_ALV.
    DATA:X_LAYOUT TYPE LVC_S_LAYO.
    "{ FOR DISABLE
    DATA: LS_EDIT TYPE LVC_S_STYL,
          LT_EDIT TYPE LVC_T_STYL.
    "} FOR DISABLE
    DATA: BEGIN OF IT_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
         END OF IT_VBAP.
    DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
    SELECT VBELN
           POSNR
           UP TO 10 ROWS
          INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
          FROM VBAP.
    DATA:L_POS TYPE I VALUE 1.
    CLEAR: L_POS.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'VBELN'.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '10'.
    x_fieldcat-ref_field = 'VBELN'.
    x_fieldcat-ref_table = 'VBAK'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'POSNR'.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '5'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    <b>"{FOR DISABLE HERE 6ROW IS DISABLED
    SY-TABIX = 6.
    LS_EDIT-FIELDNAME = 'VBELN'.
    LS_EDIT-STYLE = cl_gui_alv_grid=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 10.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    LS_EDIT-FIELDNAME = 'POSNR'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 6.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
    MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB  TRANSPORTING
                                      HANDLE_STYLE .
    X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
    "} UP TO HERE</b>
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
      EXPORTING
        I_CALLBACK_PROGRAM = SY-REPID
        IS_LAYOUT_LVC      = X_LAYOUT
        IT_FIELDCAT_LVC    = IT_FIELDCAT
      TABLES
        T_OUTTAB           = IT_VBAP[]
      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.
    Message was edited by:
            Achim Beckmann

    The problem is solved.

  • 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

  • ALV grid field editable/non editable at runtime

    Hi All,
    I am working on alv grid using containers. I have to make few cells in grid to editable and few othres to non editable which I did using styles by defining table type lvc_t_styl and updating my main internal table. Now once grid is displayed for first time (using set_table_for_first_display) it has required fields in editable and non editable as required. But now on triggering of data_changed event I have to change the editable cells to non editable and the non editable cells to editable. I tried doing this as same way as I have done before calling set_table_for_first_display method i.e. by  defining table of type lvc_t_styl in data_changed event and modifying my main internal table but this time the editable fields are changed to non editable and again becomes editable. Same problem with non editable cells also. They become editable and again becomes non ediatble of there own. Can anyone suggest any solution.
    <b>Note: Points awarded for helpful answers</b>
    null

    Hi,
    Check this link.I am explaining the steps for this.
    Kindly reward points by clicking the star on the left of reply,if it helps.<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database(OOPS)">Editing OOPS ALV</a>

  • Problem with ALV grid in edit mode

    Hello, gurus!
    I have a problem with ALV-grid. Sometimes when I call F4 help for a cell, data is inserted in a different cell.  And when I call check_changed_data method, my internal table (passed to ALV-control in set_table_for_first_display) does not updates properly. In what can be a problem?
    Thanks,
    Mikhail

    Hi Prabhu,
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      title_of_report = text-010.
      SET TITLEBAR '0100' WITH title_of_report.
      DATA: g_event_receiver TYPE REF TO lcl_event_handler.
      IF z_custom_container IS INITIAL .
        CREATE OBJECT z_custom_container
          EXPORTING
            container_name = 'ALV_ZAC'.
        CREATE OBJECT alv_grid
          EXPORTING
            i_parent = z_custom_container.
        g_repid = sy-repid.
        gs_variant-report = g_repid.
        x_save = 'A'.
        PERFORM check_alv_grid_fields.
        ps_layout-cwidth_opt = 'X'.
        ps_layout-edit = 'X'.
        CALL METHOD alv_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = '1'.
    *    CALL METHOD alv_grid->register_edit_event
    *      EXPORTING
    *        i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        APPEND   s_list_rec   to it_list_rec.
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            is_layout       = ps_layout
            is_variant      = gs_variant
            i_save          = x_save
          CHANGING
            it_fieldcatalog = pt_fieldcat
            it_outtab       = it_list_rec[].
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDIF.
    FORM check_alv_grid_fields .
      DATA: ls_fcat LIKE LINE OF pt_fieldcat.
    REFRESH pt_fieldcat .
    CLEAR: ps_layout, ls_fcat.
      ls_fcat-fieldname = 'VBELN'.
      ls_fcat-ref_field = 'VBELN'. ls_fcat-ref_table =  'LIPS'. " .
      ls_fcat-outputlen = 9.
    *  ls_fcat-datatype   = 'CHAR'.
    *  ls_fcat-inttype    = 'C'.
      APPEND  ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
      ls_fcat-fieldname = 'ERDAT'.
      ls_fcat-ref_field = 'ERDAT'. ls_fcat-ref_table = 'LIPS'.
      ls_fcat-outputlen = 9.
    *  ls_fcat-f4availabl = 'X' .
    *  ls_fcat-datatype   = 'DATS'.
    *  ls_fcat-inttype    = 'D'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
    ENDFORM.                    " check_alv_grid_fields
    FORM save_p .
      CLEAR l_valid.
      CALL METHOD alv_grid->check_changed_data
        IMPORTING
          e_valid = l_valid.
      IF l_valid IS INITIAL.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel = text-i01
            txt1  = text-i02
            txt2  = text-i03
            txt3  = text-i04.
      ELSE.
        i_dat_reg = zrumm_prr-cdprr.
        CLEAR is_temp_otc.
        freshit i_prrpus_fax.
        freshit i_list2_ot.
        LOOP AT it_list_rec INTO s_list_rec.
          MOVE-CORRESPONDING s_list_rec TO i_list2_ot.
          i_list2_ot-fgrup = 'RECE'.
          i_list2_ot-prrnu = i_num_prr.
          APPEND i_list2_ot.
          MOVE-CORRESPONDING s_list_rec TO i_prrpus_fax.
          APPEND i_prrpus_fax.
        ENDLOOP.
      ENDIF.
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:41 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM

  • ALV Grid in Edit mode

    Dear all,
    I would like to do a refresh of the ALV GRID table display in event "handle_data_changed_finished".
    "refresh_table_display" is NOT working.
    I obviously need to go through PAI & PBO to refresh the table display.
    Is there something to syncronize the data?
    There must be an easy solution...
    bye
    Niko
    Niko Prindesis
    Itelligence AG

    Dear Andreas,
    thank you!
    If I call "SAPGUI_SET_FUNCTIONCODE" in "handle_data_changed_finished", I can trigger the PAI/PBO.
    So this solves my problem!
    But ...
    ... isn't there a solution without going through PAI/PBO???
    I want to stay in the ALVGrid control!
    bye
    Niko

  • ALV selection field of displayed table is not populated properly

    Hi,
    I am using OO ALV in my screen. I have two tabs. In one tab I display one ALV output in edit mode with selection option and passing internal table field for box_selection. In the other tab I am displaying another ALV output but in display mode.
    My problem is when I switch from tab in edit mode to tab in display mode and back to tab in edit mode, then select a line on the tab in the edit mode, the method I am calling:
      CALL METHOD grid1->get_selected_rows
        IMPORTING
          et_index_rows = i_sel_alvrows[].
    would return table "i_sel_alvrows" empty.
    If i do not switch between the tabs, the ->get_selected_rows logic works perfectly.
    You reply will be greatly appreciated.
    Thanks.

    Oleg,
    I have doubt ,
    This is example:--> if you have selected a line in edit tab and going to display tab and coming back to edit tab, at the point your selected line is there in edit tab as in selected mode ?
    After freeing the container?
    aRs
    Message was edited by:
            aRs

  • 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

  • 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

  • Making Fields editable in ALV

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

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

  • 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.

  • 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

  • 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

  • In ALV report  list edit a field and insert our own text

    Hi
    In a report when I am in third list using ALV a field which is disabled should be enabled and have to insert the new value in it and save.
    please tell me how to do it using classes and methods and also using ALV's.
    Promise to reward points.
    Regards
    Mac

    See these threads
    Re: Making selected alv rows editable
    Re: selective edit in ALV grid
    Regards,
    Ravi

Maybe you are looking for

  • Erratic battery behaviour on Macbook air since latest update

    My Macbook Air 11.1 is from 2011, and the battery started going bad last year. I ordered and placed a new battery in january. This worked perfectly, no problems whatsoever. This morning, I installed the latest available Apple update (unsure which one

  • Data Not Aggregated properly in the visualization

    Hi Experts, I have created a Simple BO Explorer report with a few facets and the automatic measure 'Occurrences'. The Facets Panel shows proper data. But when I have the Visualize Panel open it shows a different result. I am not sure why this happens

  • Networking with a iMac and PC

    I'm not all that familiar with networking when using Apple computers. With Microsoft I can set up a network as either a Workgroup or a domain. What are the first steps I need to do with an iMac. It wn't be a domain. Thank you iMac and iBookG4   Mac O

  • Host name, port number and service name

    Hi! I have a question that will sound easy and stupid, but not for me. during the instal of 9iAS.There is a screen ask to provide the host name,port number and service name. Did host anme is only the name of my PC? and what is the port number?(window

  • Asha 501- keyboard apps or multiple keyboards

    I'm an Asha 501 user, my fingers are very much large/fat so when ever I try to touch on the screen somtimes it goes to other keywords. my sister also used the same keyboard and her fingers are tiny, she has no issues in accessing the keyboard. but I'