OO-Alv Container Edit Columns ?

I am using salv container and i wanna activeted  edit mode for some columns .
How Can i do this ?
Thanks..

CL_SALV_TABLE is not editable
here a nice workaround
SALV Table 10 - Editable SALV Model (Overcome the restriction of SALV Model) | ABAP Help Blog

Similar Messages

  • ALV -------- editable column

    Hi expert,
    Have any idea  'how do i make any column of an ALV report editable?
    I donot have any idea.tell me possible  or not.
    Thanks in advance
    Debjani Lahiri

    Hi Debjani,
      kindly dont use those old function modules any more -- they've all been "deprecated" or in other words made obsolete by the new OO class cl_gui_alv_grid.
    Using classes you can easily define dynamic tables, dynamic fcats, have editable grids for data entry etc etc.
    Here's a program using OO which gives you all the functionality.
    PROGRAM zdynfieldcat.
    class zcltest definition deferred. "For field symbol reference.
    * The ultimate ALV program
    * this program demos the following
    * 1) Build Dynamic ITAB with fields NOT defined in DDIC
    * 2) Build Dynamic FieldCat. Table structure is obtained *via
    * the new RTTI functionality
    * 3) Add the CELL colour table as a deep structure to our dynamic table
    * so we can colour individual cells.
    * 4) Inherit a class so protected attributes
    * of class cl_gui_alv_grid
    * can be accessed
    * 5) Add events so we can can program functionality when * the user presses
    * the ENTER key,
    * or selects an action from the toolbar.
    * 6) Display one line of a grid from our dynamic table with some cells coloured.
    * 6) Set the Grid editable.
    * 7) if user enters data then colou
    * cells of entered data.
    * 8) show contents of new table
    * after all data has been entered.
    * To use program copy the source and
    * Create a blank screen 100 with a
    * custom container called CCONTAINER1.
    * with the screen logic shown below
    * As we are using EVENTS we actually
    * don't need a PAI module so it
    * doesn't contain any code.
    *PROCESS BEFORE OUTPUT.
    * MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    * MODULE USER_COMMAND_0100
    * James Hawthorne
    * Define field symbols as these can't be defined in classes
    field-symbols: <dyn_table> type standard table,
    <g2> type ref to zcltest,
    <g1> type ref to cl_gui_custom_container,
    <data_changed> type ref to cl_alv_changed_data_protocol,
    <actual_tab> type standard table,
    <outtab> type table,
    <fs1> type ANY,
    <FS2> TYPE TABLE,
    <fs3> type table,
    <fs4> type table,
    <fs5> type table,
    <wa_dyn_table> TYPE ANY,
    <w_field1> type any,
    <w_field2> type any,
    <w_field3> type any,
    <w_field4> type any,
    <w_field5> type any,
    <t_colours> type any,
    <t_clrs> type line of lvc_t_scol,
    <t_cellcolors> TYPE lvc_t_scol,
    <t_cellcolors1> type lvc_t_scol.
    class zcltest definition inheriting from cl_gui_alv_grid.
    public section.
    types: g4 type ref to cl_gui_custom_container.
    types: g3 type ref to cl_alv_changed_data_protocol.
    data: i_parent type g4,
    lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI
    zog like line of lr_rtti_struc->components. "RTTI
    types: struc like zog.
    types: struc1 type table of struc.
    methods:
    constructor
    importing i_parent type g4,
    disp_tab
    importing p_er_data_changed type g3,
    create_dynamic_fcat
    importing zogt type struc1
    exporting it_fldcat type lvc_t_fcat.
    Protected section.
    private section.
    data: stab type ref to data,
    wa_it_fldcat type lvc_s_fcat,
    c_index type sy-index,
    lt_good_cells type lvc_t_modi,
    ls_good type lvc_s_modi,
    ls_good_cells type lvc_s_modi,
    et_good_cells type LVC_T_MODI,
    e_row type i,
    e_value type c,
    e_col type i,
    es_row_id type lvc_s_row,
    es_col_id type lvc_s_col,
    es_row_no type LVC_S_ROID,
    wa_cellcolors TYPE LINE OF lvc_t_scol,
    wa_modified_cells type line of LVC_T_MODI,
    es_layout type LVC_S_LAYO.
    endclass.
    class zcltest implementation.
    METHOD constructor.
    CALL METHOD super->constructor
    EXPORTING
    i_appl_events = 'X'
    i_parent = i_parent.
    endmethod.
    method disp_tab.
    * mt_outtab is the data table held
    * as a protected attribute
    * in class cl_gui_alv_grid.
    assign me->mt_outtab->* TO <outtab>. "Original data
    assign p_er_data_changed->mp_mod_rows TO <FS1>.
    stab = p_er_data_changed->mp_mod_rows.
    assign p_er_data_changed->mt_inserted_rows to <fs3>.
    assign p_er_data_changed->mt_deleted_rows to <fs4>.
    assign p_er_data_changed->mt_mod_cells to <fs5>.
    assign stab->* TO <fs2>.
    * some functions --chose what you want
    * This method gets the last (or current cell)
    call method me->get_current_cell
    importing e_row = e_row
    e_value = e_value
    e_col = e_col
    es_row_id = es_row_id
    es_col_id = es_col_id
    es_row_no = es_row_no.
    * For an example let's change the colour
    * of any data entered including
    * inserted rows.
    * Proceed as follows
    * read table <fs5> which gives us the
    * row number and field name of
    * the modified cell(s) including inserted rows
    * For deleted rows we don't have to do anything
    * Update the cell's colour characteristic table
    * remember we added a colour table
    * to the dynamic data table we built
    * note that it's a DEEP structure.
    * On REFRESH the alv will look at the
    * updated colour table for the cells.
    * we don't actually have to modify the data table but just the colour
    * table
    * recapping
    * 1) Create your Field catalog WITHOUT
    * the colour table for the ALV grid display
    * 2) Add the colour table to a 2nd field catalog
    * which you use to build the actual data
    * dynamic table
    * 3) add the name of the colour table to the layout
    * (struct_grid_lset-ctab_fname
    * = 'T_CELLCOLORS')
    * Refresh Grid and new cell colours will work
    * now let's change the colour of the selected cells.
    ASSIGN COMPONENT 'T_CELLCOLORS'
    OF STRUCTURE <wa_dyn_table> TO <t_cellcolors1>.
    loop at <fs5> into wa_modified_cells.
    read table <dyn_table> into <wa_dyn_table> index wa_modified_cells-row_id.
    case sy-subrc.
    when 0.
    read table <t_cellcolors1> into wa_cellcolors
    with key fname = wa_modified_cells-fieldname.
    if sy-subrc = 0.
    if not wa_modified_cells-value is initial.
    wa_cellcolors-fname = wa_modified_cells-fieldname.
    wa_cellcolors-color-col = '5'.
    MODIFY <t_cellcolors1> from wa_cellcolors .
    endif.
    else.
    if not wa_modified_cells-value is initial.
    wa_cellcolors-fname = wa_modified_cells-fieldname.
    wa_cellcolors-color-col = '5'.
    append wa_cellcolors to <t_cellcolors1>.
    endif.
    endif.
    when others.
    loop at <fs2> into <wa_dyn_table>.
    append <wa_dyn_table> to <dyn_table>.
    endloop.
    read table <dyn_table> into <wa_dyn_table> index wa_modified_cells-row_id.
    clear wa_cellcolors.
    if not wa_modified_cells-value is initial.
    wa_cellcolors-fname = wa_modified_cells-fieldname.
    wa_cellcolors-color-col = 5.
    append wa_cellcolors to <t_cellcolors1>.
    endif.
    endcase.
    MODIFY <dyn_table> FROM <wa_dyn_table> index wa_modified_cells-row_id.
    endloop.
    endmethod.
    method create_dynamic_fcat.
    loop at zogt into zog.
    c_index = c_index + 1.
    clear wa_it_fldcat.
    wa_it_fldcat-fieldname = zog-name .
    wa_it_fldcat-datatype = zog-type_kind.
    wa_it_fldcat-inttype = zog-type_kind.
    wa_it_fldcat-intlen = zog-length.
    wa_it_fldcat-decimals = zog-decimals.
    wa_it_fldcat-coltext = zog-name.
    wa_it_fldcat-lowercase = 'X'.
    append wa_it_fldcat to it_fldcat .
    endloop.
    endmethod. "create_dynamic_fcat
    endclass. "zcltest IMPLEMENTATION
    class lcl_grid_event_receiver definition.
    public section.
    data: data_c type ref to cl_alv_changed_data_protocol.
    methods:
    handle_data_changed
    for event data_changed of zcltest
    importing er_data_changed,
    handle_data_changed_finished
    for event data_changed_finished of zcltest
    importing E_MODIFIED
    ET_GOOD_CELLS,
    toolbar
    for event toolbar of zcltest
    importing e_object
    e_interactive,
    user_command
    for event user_command of zcltest
    importing e_ucomm.
    endclass.
    class lcl_grid_event_receiver implementation.
    method handle_data_changed.
    call method <g2>->disp_tab
    EXPORTING
    p_er_data_changed = er_data_changed.
    endmethod. "handle_data_changed
    method handle_data_changed_finished.
    * at this point our data dynamic table
    * <dyn_table> now contains the actual updated values from
    * the grid including the cell color info create in the on data changed
    * event method call AND IN THE CORRECT ORDER.
    * use this method to update say SAP data bases or other
    * data from the GRID entered data.
    * Data entry validation can be done here as well.
    * Enter your own code here.
    endmethod.
    method toolbar.
    data : ls_toolbar type stb_button.
    clear ls_toolbar.
    <b>move 0 to ls_toolbar-butn_type.
    <b>move 'EDIT' to ls_toolbar-function.
    move space to ls_toolbar-disabled.
    move 'Edit' to ls_toolbar-text.</b>
    move icon_change_text to ls_toolbar-icon.
    move 'Click2Edit' to ls_toolbar-quickinfo.
    append ls_toolbar to e_object->mt_toolbar.</b>
    clear ls_toolbar.
    move 0 to ls_toolbar-butn_type.
    move 'UPDA' to ls_toolbar-function.
    move space to ls_toolbar-disabled.
    move 'Update' to ls_toolbar-text.
    move icon_system_save to ls_toolbar-icon.
    move 'Click2Update' to ls_toolbar-quickinfo.
    append ls_toolbar to e_object->mt_toolbar.
    clear ls_toolbar.
    move 0 to ls_toolbar-butn_type.
    move 'EXIT' to ls_toolbar-function.
    move space to ls_toolbar-disabled.
    move 'Exit' to ls_toolbar-text.
    move icon_system_end to ls_toolbar-icon.
    move 'Click2Exit' to ls_toolbar-quickinfo.
    append ls_toolbar to e_object->mt_toolbar.
    endmethod. "toolbar
    method user_command.
    case e_ucomm .
    when 'EDIT'. "From Tool bar
    perform set_input.
    perform refresh_disp.
    when 'UPDA'. "From Tool bar
    perform refresh_disp.
    when 'EXIT'. "From Tool bar
    leave program.
    endcase.
    endmethod. "user_command
    endclass. "lcl_grid_event_receiver IMPLEMENTATION
    * program data
    include <icon>.
    * define any old internal structure NOT in DDIC
    types: begin of s_elements,
    anyfield1(20) type c,
    anyfield2(20) type c,
    anyfield3(20) type c,
    anyfield4(20) type c,
    anyfield5(11) type n,
    end of s_elements.
    data: wa_element type s_elements,
    wa_cellcolors TYPE LINE OF lvc_t_scol,
    wa_data type s_elements,
    wa_dyn_table TYPE REF TO data.
    * Note new RTTI functionality allows field detail retrieval
    * at runtime for dynamic tables.
    data:
    grid1 type ref to zcltest,
    grid_handler type ref to lcl_grid_event_receiver,
    c_dec2 type s_elements-anyfield5,
    wa_it_fldcat type lvc_s_fcat,
    it_fldcat type lvc_t_fcat,
    it_fldcat1 type lvc_t_fcat,
    lr_rtti_struc TYPE REF TO cl_abap_structdescr, "RTTI
    lt_comp TYPE cl_abap_structdescr=>component_table,"RTTI
    ls_comp LIKE LINE OF lt_comp, "RTTI
    zog like line of lr_rtti_struc->components, "RTTI
    struct_grid_lset type lvc_s_layo,
    l_valid type c,
    new_table type ref to data.
    types: struc like zog,
    col_tab type lvc_t_scol.
    data: zogt type table of struc,
    grid_container1 type ref to cl_gui_custom_container,
    g_event_receiver type ref to lcl_grid_event_receiver,
    ok_code like sy-ucomm,
    t_colours type table of col_tab,
    i4 type int4.
    start-of-selection.
    call screen 100.
    module status_0100 output.
    if grid_container1 is initial.
    create object grid_container1
    exporting
    container_name = 'CCONTAINER1'.
    assign grid_container1 to <g1>.
    create object grid1
    exporting i_parent = grid_container1.
    * we need reference to this instance so we can use
    * Methods etc of zcltest class and alv (superclass)
    * in our event receiver class.
    assign grid1 to <g2>.
    create object grid_handler.
    * set handler for events
    set handler:
    grid_handler->user_command for grid1,
    grid_handler->toolbar for grid1,
    grid_handler->handle_data_changed_finished for grid1.
    perform register_enter_event. "For ENTER key press
    * Get the Internal table structure
    lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( wa_data ).
    * Build field catalog just use basic data here
    * colour specific columns as well
    zogt[] = lr_rtti_struc->components.
    call method grid1->create_dynamic_fcat
    EXPORTING
    zogt = zogt
    IMPORTING
    it_fldcat = it_fldcat.
    * Save field cat without cell info deep structure for Grid
    it_fldcat1[] = it_fldcat.
    * now add deep structure for cell colour to field catalog
    * for dynamic table creation
    assign t_colours to <t_colours>.
    wa_it_fldcat-fieldname = 'T_CELLCOLORS'.
    wa_it_fldcat-ref_field = 'COLTAB'.
    wa_it_fldcat-ref_table = 'CALENDAR_TYPE'.
    * use this table as it has a DDIC built in ref structure for cell colour info
    APPEND wa_it_fldcat TO it_fldcat1.
    * Create dynamic internal table and assign to field symbol.
    * Use dynamic field catalog just built.
    call method cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = it_fldcat1
    IMPORTING
    ep_table = new_table.
    perform populate_dynamic_itab.
    perform init_grid.
    i4 = 0.
    call method grid1->set_ready_for_input
    EXPORTING
    i_ready_for_input = i4.
    endif.
    perform refresh_disp.
    endmodule. "status_0100 OUTPUT
    module user_command_0100 input.
    *PAI not needed in OO ALV anymore as User Commands are handled as events
    *in method user_command.
    *we can also get control if the Data entered and the ENTER is pressed by
    *raising an event.
    * Control then returns to method handle_data_changed.
    endmodule. "user_command_0100 INPUT
    form populate_dynamic_itab.
    * load up a line of the dynamic table
    c_dec2 = c_dec2 + 11.
    assign new_table->* to <dyn_table>.
    create data wa_dyn_table like line of <dyn_table>.
    assign wa_dyn_table->* to <wa_dyn_table>.
    assign component 'ANYFIELD1' of structure <wa_dyn_table> to <w_field1>
    <w_field1> = 'Tabbies'.
    assign component 'ANYFIELD2' of structure <wa_dyn_table> to
    <w_field2>.
    <w_field2> = 'Ger Shepards'.
    assign component 'ANYFIELD3' of structure <wa_dyn_table> to <w_field3>.
    <w_field3> = 'White Mice'.
    assign component 'ANYFIELD4' of structure <wa_dyn_table> to <w_field4>.
    <w_field4> = 'Any old Text'.
    assign component 'ANYFIELD5' of structure <wa_dyn_table> to <w_field5>.
    <w_field5> = c_dec2..
    APPEND <wa_dyn_table> TO <dyn_table>.
    loop at <dyn_table> into <wa_dyn_table>.
    clear wa_cellcolors.
    ASSIGN COMPONENT 'T_CELLCOLORS'
    OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
    wa_cellcolors-fname = 'ANYFIELD2'.
    wa_cellcolors-color-col = '1'.
    APPEND wa_cellcolors TO <t_cellcolors>.
    clear wa_cellcolors.
    wa_cellcolors-fname = 'ANYFIELD3'.
    wa_cellcolors-color-col = '2'.
    APPEND wa_cellcolors TO <t_cellcolors>.
    clear wa_cellcolors.
    wa_cellcolors-fname = 'ANYFIELD4'.
    wa_cellcolors-color-col = '6'.
    APPEND wa_cellcolors TO <t_cellcolors>.
    MODIFY <dyn_table> FROM <wa_dyn_table>.
    endloop.
    endform. "populate_dynamic_itab
    form exit_program.
    call method grid_container1->free.
    call method cl_gui_cfw=>flush.
    leave program.
    endform. "exit_program
    form refresh_disp.
    call method grid1->refresh_table_display.
    endform. "refresh_disp
    form set_input.
    i4 = 1.
    call method grid1->set_ready_for_input
    EXPORTING
    i_ready_for_input = i4.
    endform. "set_input
    form switch_input.
    if i4 = 1.
    i4 = 0.
    else.
    i4 = 1.
    endif.
    call method grid1->set_ready_for_input
    EXPORTING
    i_ready_for_input = i4.
    endform. "switch_input
    form init_grid.
    * Enabling the grid to edit mode,
    * Set ALV controls for cell coloring table.
    struct_grid_lset-edit = 'X'. "To enable editing in ALV
    struct_grid_lset-grid_title = 'Jimbos Test'.
    struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.
    * struct_grid_lset-sel_mode = 'D'.
    call method grid1->set_table_for_first_display
    EXPORTING
    is_layout = struct_grid_lset
    CHANGING
    it_outtab = <dyn_table>
    it_fieldcatalog = it_fldcat.
    endform. "init_grid
    form register_enter_event.
    call method grid1->register_edit_event
    EXPORTING
    i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    * Instantiate the event or it won't work.
    create object g_event_receiver.
    set handler g_event_receiver->handle_data_changed for grid1.
    endform. "register_enter_event
    Reward pts if found usefull
    Regards
    Sathish

  • ALV grid disply with edit columns in output

    Hi all,
      i am using   CALL METHOD MY_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    to display the output in alv format.there is  3 edit columns in output display.
       if i fill one field & then put 'ENTER' then other two fields of that row should be filled with the appropriate data from the program.still control should be in output display.
    which method i should use to go inside the program when i put 'ENTER' on any field of ALV output disply & how to use those methods inside the program.
    i need some materials regarding OOPS (class, method ) . now i want to put OOPS concept in alv display.
    correct answers will be rewarded.
    Thanks & regards

    Hi,
    Check,
    OOPS
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ABAP Objects
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b0f9ed7ccb#section7 [original link is broken]
    check the below links lot of info and examples r there for OOPS
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    <b>Reward if helpful.</b>

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

  • Group feature at ALV grid with editable columns

    Am I right ?
    Group function by using a sorted layout is disabled while having one (or more) editable columns, isn't it ?
    ... or is there a possibility to use gouped rows ?
    Greetings
    Markus

    Also...
    *& Report ZDEMO_ALVGRID_EDIT *
    *& Example of a simple ALV Grid Report *
    *& The basic ALV grid, Enhanced to display specific fields as *
    *& editable depending on field value *
    REPORT ZDEMO_ALVGRID_EDIT .
    TABLES: ekko.
    TYPE-POOLS: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    field_style TYPE lvc_t_styl, "FOR DISABLE
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat, "slis_t_fieldcat_alv WITH HEADER LINE,
    wa_fieldcat TYPE lvc_s_fcat,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE lvc_s_layo, "slis_layout_alv,
    gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    PERFORM data_retrieval.
    PERFORM set_specific_field_attributes.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    wa_fieldcat-fieldname = 'EBELN'.
    wa_fieldcat-scrtext_m = 'Purchase Order'.
    wa_fieldcat-col_pos = 0.
    wa_fieldcat-outputlen = 10.
    wa_fieldcat-emphasize = 'X'.
    wa_fieldcat-key = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'EBELP'.
    wa_fieldcat-scrtext_m = 'PO Item'.
    wa_fieldcat-col_pos = 1.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'STATU'.
    wa_fieldcat-scrtext_m = 'Status'.
    wa_fieldcat-col_pos = 2.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'AEDAT'.
    wa_fieldcat-scrtext_m = 'Item change date'.
    wa_fieldcat-col_pos = 3.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-scrtext_m = 'Material Number'.
    wa_fieldcat-col_pos = 4.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'MENGE'.
    wa_fieldcat-scrtext_m = 'PO quantity'.
    wa_fieldcat-col_pos = 5.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'MEINS'.
    wa_fieldcat-scrtext_m = 'Order Unit'.
    wa_fieldcat-col_pos = 6.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'NETPR'.
    wa_fieldcat-scrtext_m = 'Net Price'.
    wa_fieldcat-edit = 'X'. "sets whole column to be editable
    wa_fieldcat-col_pos = 7.
    wa_fieldcat-outputlen = 15.
    wa_fieldcat-datatype = 'CURR'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'PEINH'.
    wa_fieldcat-scrtext_m = 'Price Unit'.
    wa_fieldcat-col_pos = 8.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    FORM build_layout.
    Set layout field for field attributes(i.e. input/output)
    gd_layout-stylefname = 'FIELD_STYLE'.
    gd_layout-zebra = 'X'.
    ENDFORM. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    FORM display_alv_report.
    gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
    i_callback_program = gd_repid
    i_callback_user_command = 'USER_COMMAND'
    is_layout_lvc = gd_layout
    it_fieldcat_lvc = it_fieldcat
    i_save = 'X'
    TABLES
    t_outtab = it_ekko
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
    UP TO 10 ROWS
    FROM ekpo
    INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM. " DATA_RETRIEVAL
    *& Form set_specific_field_attributes
    populate FIELD_STYLE table with specific field attributes
    form set_specific_field_attributes .
    DATA ls_stylerow TYPE lvc_s_styl .
    DATA lt_styletab TYPE lvc_t_styl .
    Populate style variable (FIELD_STYLE) with style properties
    The NETPR field/column has been set to editable in the fieldcatalog...
    The following code sets it to be disabled(display only) if 'NETPR'
    is gt than 10.
    LOOP AT it_ekko INTO wa_ekko.
    IF wa_ekko-netpr GT 10.
    ls_stylerow-fieldname = 'NETPR' .
    ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
    "set field to disabled
    APPEND ls_stylerow TO wa_ekko-field_style.
    MODIFY it_ekko FROM wa_ekko.
    ENDIF.
    ENDLOOP.
    endform. " set_specific_field_attributes
    REWARD POINTS IF usefful !!

  • Saving editable column contents in Std. Table using ALV

    Hi All,
       I developed a ALV report which displays list of sales orders of particular customer, in this report created by name is editable column. Now i want to save the created by name after user changes the contents of this column and click on save button. I am getting all the data to be saved in field "RS_SELFIELD" (RS_SELFIELD TYPE SLIS_SELFIELD)  Kindly help me to get out of this issue.  
    Advance thanks for your response.

    Try this code.
    FORM user_command  USING    r_ucomm LIKE sy-ucomm
                               rs_selfield TYPE slis_selfield.
    * Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.
    * Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.
    * Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.
    * Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.
      CASE r_ucomm.
    *   When a record is selected
        WHEN '&IC1'.
    *     Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.
          IF sy-subrc = 0.
    *       Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.
    *       Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_ALV'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
            IF sy-subrc = 0.
    *         Make all the fields input enabled except key fields
              w_field-input = 'X'.
              MODIFY i_fieldcat FROM w_field TRANSPORTING input
              WHERE key IS INITIAL.
            ENDIF.
    *       Display the record for editing purpose
            CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
              EXPORTING
                i_callback_program    = sy-repid
                i_structure_name      = p_table
                it_fieldcat           = i_fieldcat
                i_screen_start_column = 10
                i_screen_start_line   = 15
                i_screen_end_column   = 200
                i_screen_end_line     = 20
              TABLES
                t_outtab              = <l_tab>
              EXCEPTIONS
                program_error         = 1
                OTHERS                = 2.
            IF sy-subrc = 0.
    *         Read the modified data
              READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
    *         If the record is changed then track its index no.
    *         and populate it in an internal table for future
    *         action
              IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
                <dyn_wa> = <l_wa>.
                i_index = rs_selfield-tabindex.
                APPEND i_index.
              ENDIF.
            ENDIF.
          ENDIF.
    *   When save button is pressed
        WHEN 'SAVE'.
    *     Sort the index table
          SORT i_index.
    *     Delete all duplicate records
          DELETE ADJACENT DUPLICATES FROM i_index.
          LOOP AT i_index.
    *       Find out the changes in the internal table
    *       and populate these changes in another internal table
            READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
            IF sy-subrc = 0.
              APPEND <dyn_wa> TO <dyn_tab_temp>.
            ENDIF.
          ENDLOOP.
    *     Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              mode_rstable   = 'E'
              tabname        = p_table
            EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.
          IF sy-subrc = 0.
    *       Modify the database table with these changes
            MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
            REFRESH <dyn_tab_temp>.
    *       Unlock the table
            CALL FUNCTION 'DEQUEUE_E_TABLE'
              EXPORTING
                mode_rstable = 'E'
                tabname      = p_table.
          ENDIF.
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM.                    "user_command

  • How Format Text in ALV Colum when Column set as TEXTVIEW

    I am displaying ALV with Multiple Column's , One of the Column is TEXTVIEW .
    When ALV is Displayed TEXT Column Comes as Continues TEXT  and is Not Formatted .
    Now when i want to edit this text i am Calling another View which contains UI element Formated textview  . This Formated textview  will display correct Formatted Text . but when i save it and Come back to ALV again i do see continues text .
    I use the cl_salv_wd_uie_text_view to set the ALV Column as text view.
    Is there any way where in i can display the Formatted text in ALV Column ?
    Thanks in Advance
    Badarinarayan patil

    Hi ,
    You cannot use the Formatted TextView as a celleditor in table or ALV , its not provided by SAP .
    Regards
    Yash

  • I can't import a table contains BLOB column  from one user to another user.

    1) I create two user both have connect role,and each has its own tablespace, DDL:
    create user d2zd identified by d2zd default tablespace d2zd quota unlimited on d2zd account unlock;
    grant connect to d2zd;
    create user d3zd identified by d3zd default tablespace d3zd quota unlimited on d3zd account unlock;
    grant connect to d3zd;
    2)Then enter oracle as d2zd and create a table contains BLOB column and insert data to the table.
    3) export d2zd as follow:
    exp d2zd/d2zd file=d2zd.dmp
    4) import to d3zd as follow:
    imp d3zd/d3zd fromuser=d2zd touser=d3zd file=d2zd.dmp
    the question is the table with BOLB colum can't be import,
    it says:have no privilege on tablespace d2zd.
    How can I import a table contains BLOB column from one user to another user?

    Hi - the reason for as our friend already told ist that a blob can be stored outside of the table segment, in another Tablespace, This is for performance reason.
    Sou you would need to have Quota on two tablespaces.
    the one which holds the table segment the other which holds the blob(segment).
    Regards
    Carl
    Message was edited by:
    kreitsch

  • ALV field editable

    Hi,
    Please help me,
    I need to make a ALV report, which is having one field editable.
    I want a code , when i will give input in editable field in ALV report , it should be save in my internal table.
    Please give me a sample program ,
    like take a internal table with two field. whose one field will editable.when user will give input in editable field it should save in internal table in same row like ALV list.
    Thanks,
    Abhishek

    The follow program demonstrates how to make individual fields of an ALV grid editable (NetPR greater than 10).
    Changes required from a basic ALV grid include adding a new field to ALV grid data table(it_ekko), Populating this
    field with style attribute and adding an entry to layout control table.
    *& Report  ZDEMO_ALVGRID_EDIT                                          *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display specific fields as          *
    *& editable depending on field value                                   *
    REPORT  ZDEMO_ALVGRID_EDIT                 .
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      field_style  TYPE lvc_t_styl, "FOR DISABLE
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER LINE,
          wa_fieldcat TYPE lvc_s_fcat,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM set_specific_field_attributes.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      wa_fieldcat-fieldname   = 'EBELN'.
      wa_fieldcat-scrtext_m   = 'Purchase Order'.
      wa_fieldcat-col_pos     = 0.
      wa_fieldcat-outputlen   = 10.
      wa_fieldcat-emphasize   = 'X'.
      wa_fieldcat-key         = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'EBELP'.
      wa_fieldcat-scrtext_m   = 'PO Item'.
      wa_fieldcat-col_pos     = 1.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'STATU'.
      wa_fieldcat-scrtext_m   = 'Status'.
      wa_fieldcat-col_pos     = 2.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'AEDAT'.
      wa_fieldcat-scrtext_m   = 'Item change date'.
      wa_fieldcat-col_pos     = 3.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MATNR'.
      wa_fieldcat-scrtext_m   = 'Material Number'.
      wa_fieldcat-col_pos     = 4.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MENGE'.
      wa_fieldcat-scrtext_m   = 'PO quantity'.
      wa_fieldcat-col_pos     = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MEINS'.
      wa_fieldcat-scrtext_m   = 'Order Unit'.
      wa_fieldcat-col_pos     = 6.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'NETPR'.
      wa_fieldcat-scrtext_m   = 'Net Price'.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      wa_fieldcat-col_pos     = 7.
      wa_fieldcat-outputlen   = 15.
      wa_fieldcat-datatype     = 'CURR'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'PEINH'.
      wa_fieldcat-scrtext_m   = 'Price Unit'.
      wa_fieldcat-col_pos     = 8.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
    Set layout field for field attributes(i.e. input/output)
      gd_layout-stylefname = 'FIELD_STYLE'.
      gd_layout-zebra             = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
           EXPORTING
                i_callback_program      = gd_repid
               i_callback_user_command = 'USER_COMMAND'
                is_layout_lvc               = gd_layout
                it_fieldcat_lvc             = it_fieldcat
                i_save                  = 'X'
           TABLES
                t_outtab                = it_ekko
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  set_specific_field_attributes
          populate FIELD_STYLE table with specific field attributes
    form set_specific_field_attributes .
      DATA ls_stylerow TYPE lvc_s_styl .
      DATA lt_styletab TYPE lvc_t_styl .
    Populate style variable (FIELD_STYLE) with style properties
    The NETPR field/column has been set to editable in the fieldcatalog...
    The following code sets it to be disabled(display only) if 'NETPR'
    is gt than 10.
      LOOP AT it_ekko INTO wa_ekko.
        IF wa_ekko-netpr GT 10.
          ls_stylerow-fieldname = 'NETPR' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                                 "set field to disabled
          APPEND ls_stylerow  TO wa_ekko-field_style.
          MODIFY it_ekko FROM wa_ekko.
        ENDIF.
      ENDLOOP.
    endform.                    " set_specific_field_attributes
    hope this helps
    reward if useful
    Edited by: Richa Khosla on Mar 25, 2008 1:30 PM

  • How to use enter in Editable column of Reuse_alv_gird_display

    Hello gurus,
    I have a requirement , a editable column in alv display, where user enters an amount and hits 'enter' it i will multiply with other column in the report and give display in next column.  Now i can do it easily by using USER Command in Reuse alv grid display but when i use SY-UCOMM  &DATA_SAVE. and user needs to press save button.  Is ther any possibility so that if user hits enter then this requirement can be achieved.
    Thanks.

    Hi,
    Write a code like below..
    WA_FLDCAT-EDIT = 'X'.
    F SY-UCOMM = 'SAVE' .
    *** to reflect the data changed into internal table
         IF REF_GRID IS INITIAL.
           CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
             IMPORTING
               E_GRID = REF_GRID.
         ENDIF.
         IF NOT REF_GRID IS INITIAL.
    ***** To check whether the ALV Grid is Modified
    ***** And also to Modify the internal table based on Modification in ALV
           CALL METHOD REF_GRID->CHECK_CHANGED_DATA
             IMPORTING
               E_VALID = L_VALID.
         ENDIF.
    Arivazhagan S

  • ALV simple edit problem

    Hello all,
    I've have in an ALV list an editable column, the proble is that when the cell values are changed the data table remains the same. Is there a method for cl_gui_alv_grid class or another way to update the data table form ALV list.
    Lots of thanks
    Bogdan

    first check whether data is changed .if data is changed then get the changed value from the cell and modify the internal table accordingly.
    check whether following code works......
    call method w_obj_grid1->check_changed_data
                  importing
                     e_valid = lw_valid.
          if lw_valid = 'X'.
          call method pr_data_changed->get_cell_value
              exporting i_row_id =  row_id
                        i_fieldname = fieldname
              importing e_value     = get value here.
                loop at t_data into fs_data.
                    if sy-tabix = row_id.
                       modify t_data from fs_data.
                   endif.
                endloop.
              call method w_obj_grid1->refresh_table_display.

  • Refreshing alv container

    I have editable alv container in a module pool which runs through transaction code.the problem is each time the editabale alv is displayed the old values remain....How can i refresh my alv container?

    Hi Priya,
    you can try with --
          CALL METHOD grid->refresh_table_display.
              CLEAR:  gh_index.
    Thanks,
    Venkat

  • Hierarchical ALV - enabling row/column input

    Hello,
    I'm going to incoporate the hierarchical ALV in a report.  Let's say I have 5 item rows for a header row, is it possible to make individiual rows input enabled?  Meaning, of the 5 item rows, I wish to make two of them editable, but not the other three. 
    I've done the standard ALV and made columns input enabled when building the fieldcat, but this applied to all rows, which I don't want in my scenario.
    Any help would be appreciated.
    Thanks

    Hello,
    Input enable is a parameter of fieldcat but you have to specify the internal table that you used in header row or item row.
    You create a data ZHEAD and ZITEM that you transfer in fieldcat data "table"
    Don't forget the clear when youo fill this internal table
    Regards
    sebastien

  • Editor using ALV Container

    Hi All,
    Please anyone suggest me, how can I use text-editor in ALV container?
    Means when i execute the program, i want to see editor screen.
    Thanks
    Amit

    see
    Custom Controls
    A custom control is an area on a screen. You create them in the Screen Painter, and, like all other screen objects, they have a unique name. You use custom controls to embed controls. Controls are software components of the presentation server. Depending on the used SAP GUI, these are either ActiveX Controls or JavaBeans. They allow you to perform tasks, such as editing texts, locally on the presentation server. The control is driven by the application logic, which still runs on the application server.
    The SAP Control Framework
    The controls on the presentation server and the ABAP application programs on the application server communicate using the SAP Control Framework. The SAP Control Framework is programmed in ABAP Objects . It contains global classes that can be found in the class library under Basis ® Frontend Services. These classes encapsulate the communication between the application server and presentation server, which is implemented using Remote Function Call.
    All application controls are encapsulated in a global class. You can find the SAP Basis controls in the Class Browser under Basis ® Frontend Services or Basis ® Component Integration. Programs that use controls on a screen work with the methods and events of the global classes that encapsulates them.
    Container Controls
    Before you can work with a custom control on a screen, you must assign a SAP Container Control to it. Container controls are instances of special global classes from the SAP Control Framework. The global class for custom controls is called CL_GUI_CUSTOM_CONTAINER. To link a custom control to a container control, pass the custom control name to the constructor of the container control when you instantiate it using CREATE OBJECT.
    As well as using custom containers, you can link controls to a screen using a SAP Docking Container. This is encapsulated in the global class CL_GUI_DOCKING_CONTAINER. The SAP Docking Container does not place the control within a screen. Instead, it attaches it to one of the four edges. You can nest containers. For example, you can use the SAP Splitter Container (classes CL_GUI_EASY_SPLITTER_CONTAINER or CL_GUI_SPLITTER_CONTAINER) within other containers. This allows you to split a custom control or docking control into more than one area, allowing you to embed more than one control.
    Application Controls
    You must also create instances for the application controls that you want to place within your container - for example, a SAP Textedit Control (class CL_GUI_TEXTEDIT) or a SAP Tree Control (for which there is more than one global class - an example is CL_GUI_SIMPLE_TREE). When you instantiate the control, you pass a reference to the container in which you want to place it to the PARENT parameter of its constructor method. The container may be an instance of the class CL_GUI_CUSTOM_CONTAINER, but can also be an instance of one of the other SAP Container controls.
    Control Methods
    For information about control methods and their documentation, refer to the class definitions in the Class Builder or the SAP Library documentation. To minimize the network load between the application and presentation servers, method calls are buffered in the automation queue before being sent to the presentation server at defined synchronization points. One of the automatic synchronization points is the end of PBO processing. You can force a synchronization point in your program by calling a method that is not buffered, or by calling the static method FLUSH.
    Control Events
    Unlike screens, on which user interaction triggers the PAI event and control returns to the application server, user interaction on controls is not automatically passed back to the application server. If you want an event to be passed back to the application server, you must register it in your program using the special method SET_REGISTERED_EVENTS. For a list of the events that you can register for each control, refer to its wrapper class in the Class Builder. You can register two kinds of event handling using SET_REGISTERED_EVENTS:
    System Events (Default)
    The event is passed to the application server, but does not trigger the PAI. If you have registered an event handler method in your ABAP program for the event (using the SET HANDLER statement), this method is executed on the application server.
    Within the event handler method, you can use the static method SET_NEW_OK_CODE of the global class CL_GUI_CFW to set a function code and trigger the PAI event yourself. After the PAI has been processed, the PBO event of the next screen is triggered.
    The advantage of using this technique is that the event handler method is executed automatically and there are no conflicts with the automatic input checks associated with the screen. The disadvantage is that the contents of the screen fields are not transported to the program, which means that obsolete values could appear on the next screen. You can work around this by using the SET_NEW_OK_CODE method to trigger field transport and the PAI event after the event handler has finished.
    Application Events
    The event is passed to the application server, and triggers the PAI. The function code that you pass contains an internal identifier. You do not have to evaluate this in your ABAP program. Instead, if you want to handle the event, you must include a method call in a PAI dialog module for the static method DISPATCH of the global class CL_GUI_CFW. If you have defined an event handler method in your ABAP program for the event (using the SET HANDLER statement), the DISPATCH method calls it. After the event handler has been processed, control returns to the PAI event after the DISPATCH statement and PAI processing continues.
    The advantage of this is that you can specify yourself the point at which the event is handled, and the contents of the screen fields are transported to the application server beforehand. The disadvantage is that this kind of event handling can lead to conflicts with the automatic input checks on the screen, causing events to be lost.
    Related Information
    For further information about controls, and in particular, help on troubleshooting and optimizing synchronization, refer to BC Controls Tutorial and BC SAP Control Framework.
    Example
    The following example shows the difference between system and application events.
    REPORT demo_custom_control .
    Declarations *****************************************************
    CLASS event_handler DEFINITION.
      PUBLIC SECTION.
        METHODS: handle_f1 FOR EVENT f1 OF cl_gui_textedit
                           IMPORTING sender,
                 handle_f4 FOR EVENT f4 OF cl_gui_textedit
                           IMPORTING sender.
    ENDCLASS.
    DATA: ok_code LIKE sy-ucomm,
          save_ok LIKE sy-ucomm.
    DATA: init,
          container TYPE REF TO cl_gui_custom_container,
          editor    TYPE REF TO cl_gui_textedit.
    DATA: event_tab TYPE cntl_simple_events,
          event     TYPE cntl_simple_event.
    DATA: line(256) TYPE c,
          text_tab LIKE STANDARD TABLE OF line,
          field LIKE line.
    DATA handle TYPE REF TO event_handler.
    Reporting Events ***************************************************
    START-OF-SELECTION.
      line = 'First line in TextEditControl'.
      APPEND line TO text_tab.
      line = '----
      APPEND line TO text_tab.
      line = '...'.
      APPEND line TO text_tab.
      CALL SCREEN 100.
    Dialog Modules *****************************************************
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
      IF init is initial.
        init = 'X'.
        CREATE OBJECT:
               container EXPORTING container_name = 'TEXTEDIT',
               editor    EXPORTING parent = container,
               handle.
        event-eventid = cl_gui_textedit=>event_f1.
        event-appl_event = ' '.                     "system event
        APPEND event TO event_tab.
        event-eventid = cl_gui_textedit=>event_f4.
        event-appl_event = 'X'.                     "application event
        APPEND event TO event_tab.
        CALL METHOD: editor->set_registered_events
                     EXPORTING events = event_tab.
        SET HANDLER handle->handle_f1
                    handle->handle_f4 FOR editor.
      ENDIF.
      CALL METHOD editor->set_text_as_stream
                  EXPORTING text = text_tab.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'INSERT'.
          CALL METHOD editor->get_text_as_stream
                      IMPORTING text = text_tab.
        WHEN 'F1'.
          MESSAGE i888(sabapdocu) WITH text-001.
        WHEN OTHERS.
          MESSAGE i888(sabapdocu) WITH text-002.
          CALL METHOD cl_gui_cfw=>dispatch.
      ENDCASE.
      SET SCREEN 100.
    ENDMODULE.
    Class Implementations **********************************************
    CLASS event_handler IMPLEMENTATION.
      METHOD handle_f1.
        DATA row TYPE i.
        MESSAGE i888(sabapdocu) WITH text-003.
        CALL METHOD sender->get_selection_pos
             IMPORTING from_line = row.
        CALL METHOD sender->get_line_text
             EXPORTING line_number = row
             IMPORTING text = field.
        CALL METHOD cl_gui_cfw=>set_new_ok_code 
             EXPORTING new_code = 'F1'.         
        CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.
      METHOD handle_f4.
        DATA row TYPE i.
        MESSAGE i888(sabapdocu) WITH text-004.
        CALL METHOD sender->get_selection_pos
             IMPORTING from_line = row.
        CALL METHOD sender->get_line_text
             EXPORTING line_number = row
             IMPORTING text = field.
        CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.
    ENDCLASS.
    The layout of screen 100 is:
    The screen contains an output field field and a custom control called textedit.
    The flow logic of screen 100 is:
    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
    PROCESS AFTER INPUT.
      MODULE cancel AT EXIT-COMMAND.
      MODULE user_command_0100.
    The GUI status SCREEN_100 has the functions BACK, EXIT, and CANCEL (all with type E) and the function INSERT (normal function).
    There is a local class event_handler defined in the program. It contains event handler methods for the F1 and F4 events of global class CL_GUI_TEXTEDIT. When you run the program, the classes CL_GUI_CUSTOM_CONTROL, CL_GUI_TEXTEDIT, and event_handler are instantiated in the PBO of screen 100.
    The container control is linked to the custom control on the screen, and the instance of the textedit control is linked to this container. The F1 and F4 events of the textedit control are registered using the SET_REGISTERED_EVENTS method to ensure that they are passed to the application server when they occur. F1 is defined as a system event, F4 as an application event. The event handler methods of the handle instance of the class event_handler are registered as handlers for the events.
    Before screen 100 is displayed, the program fills the textedit control with the contents of table text_tab . The user can edit the text while the screen is displayed. If the user chooses INSERT, the PAI event is triggered and the current text from the textedit control is copied into table text_tab.
    If the user chooses F1 on the textedit control, the handle_f1 method is executed. This assigns the contents of the line to the field field: The method SET_NEW_OK_CODE triggers the PAI event. It is this that ensures that the PBO is processed, and the contents of field are sent to the screen.
    If the user chooses F4 on the textedit control, the PAI event is triggered. The DISPATCH method is called, and this triggers the method handle_f4. This assigns the contents of the line to the field field: Since the PAI processing continues after the event, the PBO event follows, and the field contents are transferred to the screen.
    The contents of the textedit control are not passed to the internal table text_tab either after F1 or after F4. The contents of the textedit control are therefore overwritten in the PBO event with the previous contents of text_tab.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/2a/755b94ca5911d299af5c9604c10e27/content.htm

  • Print from ALV container

    Hi ,
    I am trying to print the contents from the ALV Container,This is a pop-up screen
    displaying details of the line selected in the ALV report.
    Standard tool bar print button is available, and it works, but I also have the print icon in bottom of the screen , which should print the container contents.
    Not sure what custom code shd go in for printing,
    Looked into the std BCALV * programs, but no luck so far.
    Appreciate any help.
    Thank you
    Lalitha

    Hi Joseph,
    in my case these are the settings...
    Just change your spool  settings also ..
    in my case
    SAP Cover Page  System Administrator: Default Settings
    OS Covert Sheet  System Administrator: Default Settings
    ALV statastics     NO
    i think for your case ALV statastics is markes as YES is it true.
    Can you change the settings.
    Regards
    Vijay

Maybe you are looking for

  • Monitoring Blocking locks (dba_blockers vs v$lock)

    Hi This question relates to monitoring blocking locks on a 9.2.0.5 database Origionally I have been monitoring bocking locks with every 5 mins using the following query: "select * from dba_blockers" I have recently implemented monitoring via grid con

  • IMac (July 2011) to external monitor (VGA)

    I have a new iMac (July 2011) and I need to hook it up to an external monitor that has a VGA output.  Is this possible?  If so, what adapter do I need? On the back of my iMac I see 1 thunderbolt port, 1 firewire port, 1 ethernet port, 4 usb ports, an

  • How do I combine 2 tunes into one?

    I have down loaded several tunes from my CD collection and wish to combine them into one tune with a new name. I do not want to play them separately again. Can this be done? The tunes are synced onto my ipod but I manipulate them on the pc.

  • Want to add Price components

    Hi All,    I want to add extra price components in material cost estimate pricing structure i.e transaction CK11n. I am trying out this with UE COPCP005 but not sure how to this.   Any pointers how to add extra price components. regards Saurabh.

  • Doubt on IDOC communication

    Hi Experts,                   I have a doubt on IDOC to IDOC communication: Plz clarify  it                     1. what is the need of passing same IDOC from one system to other system    through XI  while communicating between two systems,it can be