Making cells editable in a dynamic ALV

Hi all
I have a dynamic table which I am displaying as an ALV.
  call method ref_grid->set_table_for_first_display
    exporting
      is_layout            = lwa_layout
      it_toolbar_excluding = t_toolbarexclude[]
    changing
      it_fieldcatalog      = t_fldcat
      it_outtab            = <t_itab>.
In the table <t_itab>, there is a checkbox, one fixed column and the others dynamic. Along with the normal columns, there is also a table of type lvc_s_styl.
My requirement is that, after my ALV grid is displayed, when I click on the Edit button(toolbar), for the rows where the checkbox is checked, the dynamic columns should become editable.
    loop at <t_itab> assigning <wa_itab>.
      assign component 'STYLE' of structure <wa_itab> to <fs_table>.
      lt_style = <fs_table>.
         Here I have made changes to the STYLE table for the necessary fields for the required rows and then called the methods:
    call method ref_grid->set_ready_for_input
      exporting
        i_ready_for_input = c_1.
    call method ref_grid->refresh_table_display.
But, it does not work.
I have checked the forum and there are a number of posts on this issue. I have followed all the steps which are mentioned there.
Please help! Any suggestions are welcome
Regards
Debolina

hi,
try using :
    ls_layo-stylefname = 'CELLTAB'. for layput
and then fill the cellstyle before calling the Fm for table display.
  l_mode = cl_gui_alv_grid=>mc_style_enabled.
  ls_celltab-fieldname = 'BUKRS'.
  ls_celltab-style     = l_mode.
  INSERT ls_celltab INTO TABLE pt_celltab.

Similar Messages

  • Edit and save dynamic alv.

    Hi Experts
    I have created a dynamic table then filled this dynamic table with the help of field symbols and then passed this dynamic table to grid1->set_table_for_first_display and hence the dynamic alv is shown on the screen. Now, can I do something to make this alv editable and store these values in z table. I have tried the method get_changed_cell method, but no help.
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = LT_LVC_CAT
        IMPORTING
          EP_TABLE        = LP_TABLE.
      ASSIGN LP_TABLE->* TO <LT_DATA>.
    *Create structure = structure of the internal table
      CREATE DATA LP_STRUCT LIKE LINE OF <LT_DATA>.
      ASSIGN LP_STRUCT->* TO <HEADER>.
    *  SORT gt_data BY erdat.
    *sort IT_VEWAO by MATNR.
      LOOP AT IT_VEWZO INTO WA_VEWZO.
        AT NEW VKBUR.
          CLEAR <HEADER>.
          ASSIGN COMPONENT 'VKBUR' OF STRUCTURE <HEADER> TO <FIELD>.
          IF SY-SUBRC NE 0.
            EXIT .
          ENDIF.
          <FIELD> = WA_VEWZO-VKBUR.
        ENDAT.
        MOVE WA_VEWZO-PD_HIER  TO L_COL.
        ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
        IF SY-SUBRC NE 0.
          EXIT .
        ENDIF.
        <FIELD> = WA_VEWZO-PLAN_QTY.
        CONCATENATE WA_VEWZO-PD_HIER '_AP' INTO WA_VEWZO-PD_HIER .
        MOVE WA_VEWZO-PD_HIER  TO L_COL.
        ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
        IF SY-SUBRC NE 0.
          EXIT .
        ENDIF.
        <FIELD> = WA_VEWZO-APROV_QTY.
        AT END OF VKBUR.
          APPEND <HEADER> TO <LT_DATA>.
        ENDAT .
      ENDLOOP.
    CREATE OBJECT CUSTOM_CONTAINER1
             EXPORTING
                  CONTAINER_NAME = 'CUST_CONT'.
      CREATE OBJECT GRID1
              EXPORTING
                  I_PARENT = CUSTOM_CONTAINER1.
      CALL METHOD grid1->REGISTER_EDIT_EVENT
              EXPORTING
                  i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
    *      I_STRUCTURE_NAME = lv_lp_struct
          IS_LAYOUT        = LS_LAYOUT
        CHANGING
    *      IT_SORT          = LT_SORT1
          IT_FIELDCATALOG  = LT_FIELDCAT
          IT_OUTTAB        = <LT_DATA>.

    Hi,
    What help u need?
    to activate the editable field u need to pass the field catalog parameter
    EDIT = 'X'
    Then Edit values in your alv
    and press enter or define any icons in ur alv list useing user command
    check the changed values using the method
    CALL METHOD g_alvgrid1->check_changed_data( ).
    It will help you i think.
    Regards,
    Nandha

  • Editing values within Dynamic ALV

    Hello All,
    I am currently working on dynamic ALV and want the columns to be editible.
    I have gone through the tutorial
    Link : [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4c70444a-0801-0010-7688-9e4bd844b783]
    and have created a dynamic Context and a corresponding ALV LIST display. Everything is fine except that i want to be able to edit values within the list and i want this to get populated back into the context.
    I have gone through the tutorial.
    Link : [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1]
    But i couldn't relate that with the tutorial for dynamic ALV.
    Please help.
    Best Regards,
    Mz

    Hello Lekha,
    I am sorry to say that  the code which you have provided is not working.
    Maybe i am doing something wrong.
    This is the entire code below.
    data lo_interfacecontroller type ref to iwci_salv_wd_table .
    data lo_cmp_usage type ref to if_wd_component_usage.
    data : L_VIEW_CONTROLLER_API type ref to IF_WD_VIEW_CONTROLLER.
    lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
    if lo_cmp_usage->has_active_component( ) is initial.
      lo_cmp_usage->create_component( ).
    endif.
    lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).
      lo_interfacecontroller->set_data(
    *   only_if_new_descr =                 " wdy_boolean
        "r_node_data =
        dyn_node                    " ref to if_wd_context_node
    DATA:
       lo_value type ref to cl_salv_wd_config_table,
         lr_column      TYPE REF TO cl_salv_wd_column,            " Table fo rcolumn ref
         ls_columns     TYPE salv_wd_s_column_ref,                " Structure for column ref
        lt_columns     TYPE salv_wd_t_column_ref,                " Structure for column ref
       lr_input       TYPE REF TO cl_salv_wd_uie_input_field.
    lo_value = lo_interfacecontroller->get_model( ).
    * Get the column ref
      CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
        RECEIVING
          value = lt_columns.
      LOOP AT lt_columns INTO ls_columns.
        lr_column = ls_columns-r_column.
    case ls_columns-id.
    when 'JAN2007'.
            CREATE OBJECT lr_input
              EXPORTING
                value_fieldname = ls_columns-id.
            CALL METHOD lr_column->set_cell_editor
              EXPORTING
                value = lr_input.
    *     Set the read only attribute
            lr_input->set_read_only_fieldname( value = 'FALSE' ).
    endcase.
    endloop.
    L_VIEW_CONTROLLER_API = WD_THIS->WD_GET_API( ).
    L_VIEW_CONTROLLER_API->PREPARE_DYNAMIC_NAVIGATION(
    source_window_name = 'WINDOW1'
    source_vusage_name = 'MAIN_USAGE_0'
    source_plug_name = 'TO_V1'
    target_component_name = 'SALV_WD_TABLE'
    target_component_usage = 'ALV'
    target_view_name = 'TABLE'
    target_plug_name = 'DEFAULT'
    target_embedding_position = 'MAIN/VIEW_CONTAINER'
    WD_THIS->FIRE_TO_V1_PLG( ).
    The part which is entered as per your instructions are given between the asterisk lines.
    Sorry if there are any silly mistakes on my part.
    I have one small doubt regarding the value to be passed for the method lr_input->set_read_only_fieldname. This is a string value. I think that this could be the cause of the error. When i checked the class interface, CL_SALV_WD_UIE_INPUT_FIELD i found that the method set_read_only_fieldname is calling another attribute if_salv_wd_c_table_evt_editor=>set_read_only_fieldname.
    Hope this was useful
    Best Regards,
    Mz

  • Making cell non editabale (of dynamic table) in alv

    Hi,
    I am working on a editable alv with a dynamic table <itab> .This table gets populated during runtime.Now I want to make few cell of this table not editabale (only few cell not the full columns) I knwo that the procedure is to
    declare my outtab like
    TYPES: BEGIN OF gs_outtab.
    TYPES: celltab TYPE lvc_t_styl.        "field to switch editability
            INCLUDE TYPE /npu/edmt_aa_eac.
    TYPES: END OF gs_outtab.
    and in the celltab i pass the information of cells which will be non editable...But the problem is as my outtab is a dynamic table I cannot INCLUDE IT IN ANOTHER types.
    Please help me how to do it???? Or is there any other way of doing it???

    Hi Priya
    Add the field of type lvc_t_styl while creating the field catalog.
    Now
    DATA lo_table TYPE REF TO data.
      cl_alv_table_create=>create_dynamic_table(
        EXPORTING
          it_fieldcatalog = lt_fieldcat  "the field catalog table
        IMPORTING
          ep_table = lo_table ). "the reference to the table gt_outtab with the style tab
    FIELD-SYMBOLS <tab> TYPE ANY TABLE.
    ASSIGN lo_table->* TO <tab> .
    Now you can fill your <tab>.
    Pushpraj

  • How to make rows editable of a dynamic ALV

    Hi All,
       I'm displaying a dynamic internal table on an ALV.
    The probelm is that some of the rows of that ALV should be editable.
    I checked some of the forums, where I got a clue that I have to update this LVC_S_STYL structure for this requirement.
    I populated this structure also. But still that ALV is coming as non-editable.
    Kindly help me out in resolving this issue.
    Thanks and Regards,
              Abhijeet

    Check this article [Easy Reference to ALV |http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]. I am sure, you will find the solution here.

  • Create dynamic internal table with deep structure;cell coloring dynamic ALV

    Hi,
    My requirement is to do cell colouring for a dynamic ALV.
    So I am creating a dynamic internal table using the following method.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = i_fieldcatalog[]
        IMPORTING
          ep_table        = i_output.
    But how do I define field COLORS which should be again an internal table ?
    Is there any other way for cell colouring?
    Putting my problem in another way:
    How do I create a dynamic internal table with one field as another internal table.
    Quick replies are highly appreciated.
    Thanks,
    Nisha Vengal.

    halo Nisha
    Before building the display table . you can add the field in the feild catalog right . This display table gets generated from the field catalog right
    1 Create a global structute say ZEXTEND_FIELDCAT
    2 Have fields like STYLE type lvc_t_styl
                             COLOR type LVC_T_SCOL.
    3 Now you have to extend ur fieldcatalog
      l_fieldcat-fieldname = COLOR'.
      l_fieldcat-ref_field = 'COLOR'.
      l_fieldcat-ref_table = 'ZEXTEND_FIELDCAT'.
      APPEND l_fieldcat TO lt_field_catalog.
      CLEAR l_fieldcat.

  • Create structure in Dynamic ALV for color and editing cells

    Hi experts,
    I created dynamic ALV . in this i want coloring and editing of cells.
    this can be done by strucutture lvc_t_scol, lvc_t_styl.
    My problem is how to create structure in field catalogue of Dynamic ALV.
    Thanks

    Hello
    I am not sure if you have missed the following part of the coding:
    " Add table type (LVC_T_STYL) as field to structure ==> complex structure
      CLEAR: gs_comp.
      gs_comp-type ?= cl_abap_typedescr=>describe_by_data( celltab ).
      gs_comp-name  = 'CELLTAB'.
      APPEND gs_comp TO gt_components.
      go_sdescr  = cl_abap_structdescr=>create( gt_components ).
      go_tdescr  = cl_abap_tabledescr=>create( go_sdescr ).
      CREATE DATA gdo_handle TYPE HANDLE go_tdescr.
      ASSIGN gdo_handle->* TO <gt_itab>.
    This is exactly your requirement.
    Regards
      Uwe

  • Making an editable cell as a obligatory in alv

    Dear all,
    Please give me a solution for getting a editable cell as a obligatory in alv . what method/ field in the fieldcat need to be used.

    Go through this..
    REPORT z_demo_alv_jg.*******************************************************************
    TYPE-POOLS *
    TYPE-POOLS: slis. *******************************************************************
    INTERNAL TABLES/WORK AREAS/VARIABLES *
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
    i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
    w_field TYPE slis_fieldcat_alv,
    p_table LIKE dd02l-tabname,
    dy_table TYPE REF TO data,
    dy_tab TYPE REF TO data,
    dy_line TYPE REF TO data.*******************************************************************
    FIELD-SYMBOLS *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
    <dyn_wa> TYPE ANY,
    <dyn_field> TYPE ANY,
    <dyn_tab_temp> TYPE STANDARD TABLE.*******************************************************************
    SELECTION SCREEN *
    PARAMETERS: tabname(30) TYPE c,
    lines(5) TYPE n.*******************************************************************
    START-OF-SELECTION *
    START-OF-SELECTION.* Storing table name
    p_table = tabname.* Create internal table dynamically with the stucture of table name
    entered in the selection screen
    CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
    ASSIGN dy_table->* TO <dyn_table>.
    IF sy-subrc 0.
    MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'. LEAVE TO LIST-PROCESSING.
    ENDIF.
    Create workarea for the table
    CREATE DATA dy_line LIKE LINE OF <dyn_table>.
    ASSIGN dy_line->* TO <dyn_wa>.* Create another temp. table
    CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
    ASSIGN dy_tab->* TO <dyn_tab_temp>. SORT i_fieldcat BY col_pos.* Select data from table
    SELECT * FROM (p_table)
    INTO TABLE <dyn_table>
    UP TO lines ROWS. REFRESH <dyn_tab_temp>.* Display report
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_structure_name = p_table
    i_callback_user_command = 'USER_COMMAND'
    i_callback_pf_status_set = 'SET_PF_STATUS'
    TABLES
    t_outtab = <dyn_table>
    EXCEPTIONS
    program_error = 1
    OTHERS = 2. IF sy-subrc 0. ENDIF.&----
    *& Form SET_PF_STATUS
    Setting custom PF-Status
    -->RT_EXTAB Excluding table
    FORM set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'Z_STANDARD'.ENDFORM. "SET_PF_STATUS&----
    *& Form user_command
    Handling custom function codes
    -->R_UCOMM Function code value
    -->RS_SELFIELD Info. of cursor position in ALV
    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_PDF_JG'
    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 to make cell editable alv in WebDynpro for ABAP?

    I make Column editable ALV.(See under source code)
    But I can't make Cell editable ALV.
    How to make Cell editable ALV in WebDynpro for ABAP?
    and..how to get changed data?
    DATA: l_value TYPE REF TO cl_salv_wd_config_table.
      l_value = l_ref_interfacecontroller->get_model( ).
    * { EDITABLE
      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          TYPE REF TO cl_salv_wd_column.
      lr_column_settings ?= l_value.
      lr_column = lr_column_settings->get_column( 'TOTAL_COUNT' ).
      CREATE OBJECT lr_input_field
        EXPORTING
          value_fieldname = 'TOTAL_COUNT'.
      lr_column->set_cell_editor( lr_input_field ).
      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 ).

    the code seems to be correct....but where are you writing it?
    put the code in the wddoinit method and it should work.
    have a look at this article..
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1

  • Create deep structure to disable some cells in Dynamic ALV GRID

    Hi,
    I want to disable some cells in a Dynamic ALV Grid before calling "SET_tABLE_Display" Method.
    I check the BCALV_EDIT_02, where some cells are grayed out by assign the  CL_GUI_ALV_GRID-MC_STYLE_DISABLED  to the field name.
    But I want the same using Field symbol.
    I'm creating Dynamic table and dynamic structure based on the Dynamic field catalog.
    Example: <FT_TAB> TYPE STANDARD TABLE,
                    <FS_TAB> TYPE ANY,            
    DATA: INT_TAB  is my dynamic table values.
    For the INT_TAB internal table, I created dynamic Structure and dynamic field symbol table.
    LOOP AT INT_TAB.
    ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    <F_VALUE> = INT_TAB-MATNR.
    APPEND <FS_TAB> TO <FT_TAB>
    "Here is the problem occurs, I want to grayed out the MATNR value based on some condition.
    ENDLOOP.
    I would like to set the 'MATNR' value to be grayed out by passing the CL_GUI_ALV_GRID-MC_STYLE_DISABLED.
    and update into <FT_TAB>(       <FT_TAB> structure will have 2 structures)
    Finally the fieldsymbol should have two structure ( <F_TAB> = DYNAMIC STRUCTURE + LVC_S_STYLE )
    Display alv grid by passing <FT_TAB> to set_table_display method.
    Thanks in advance,
    Kumar.

    Hi,
    I am  not sure whether I really understand your request. Let me try to help.
    > Example: <FT_TAB> TYPE STANDARD TABLE,
    >                 <FS_TAB> TYPE ANY,            
    >
    > DATA: INT_TAB  is my dynamic table values.
    >
    >
    > LOOP AT INT_TAB.
    >  ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    > <F_VALUE> = INT_TAB-MATNR.
    >  APPEND <FS_TAB> TO <FT_TAB>
    Here <FT_TAB> must already be assigned to some internal table with a given (dynamic) structure. Did this happen before this piece of code?
    What I would do is to create a dynamic table (see documentation to CREATE DATA) with MATNR and the STYLE field (LVC_T_STYL). See the documentation for CREATE DATA - creation of internal tables. When collection the field descriptions for that internal table I would also build the field catalogue for the ALV.
    Then assign <FT_TAB> to that newly created internal table, <FS_TAB> to a newly created structure (same as a table line).
    Move the MATNR to component 1 (or component 'MATNR') of the table and fill the style table according to your needs. Then insert the <FS_TAB> into <FT_TAB>.
    Finally call the ALV SET_TABLE... method with your dynamic table and your field catalogue.
    Regards,
    Gerd Rother

  • Cell colour in Dynamic ALV

    How to make cell coloring in dynamic ALV,I did it in normal internal tables.Any body can help me here?
    Or can anybody tell me how to convert a field symbol to an internal table? as I have created a dynamic IT.
    Thanks in advance.

    Thanks for u r quick replies,Now Iam not getting any error,the program getting executed without any error.But Iam not getting any colors,what might be the problem? Do I need to pass IS_layot to ALV_GRID FM ? I have not created any Layout though,here is my complete code :
    TABLES : vbbe.
    TYPE-POOLS : slis.
    *&                       Data Declarations                             *
    DATA : diff TYPE i VALUE 0,
           maktx LIKE makt-maktx,
           labst LIKE mard-labst.
    DATA : BEGIN OF it_data OCCURS 0,
           matnr LIKE vbbe-matnr,
           mbdat LIKE vbbe-mbdat,
           omeng LIKE vbbe-omeng,
           END OF it_data,
           wa_data LIKE LINE OF it_data.
    DATA : g_tdref TYPE REF TO data,
           g_wdref TYPE REF TO data.
    DATA : dats LIKE vbbe-mbdat,
           lvc_t_fieldcat TYPE lvc_t_fcat,
           lvc_s_fieldcat TYPE lvc_s_fcat,
           it_fldcat TYPE slis_t_fieldcat_alv,
           wa_fldcat TYPE slis_fieldcat_alv.
    FIELD-SYMBOLS : <it_dyn> TYPE STANDARD TABLE,
                    <wa_dyn>,
                    <dyn_field>.
    *&                          Selection-Screen                           *
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_mbdat FOR vbbe-mbdat OBLIGATORY.
    PARAMETER p_werks LIKE mard-werks OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    *&                          INITIALIZATION                             *
    INITIALIZATION.
      p_werks = '1200'.
    *&                       Start-Of-Selection                            *
    START-OF-SELECTION.
      PERFORM f_build_lvc_and_slis.
      PERFORM f_build_dynamic_it.
      PERFORM f_get_data.
      PERFORM f_get_fata_into_it.
      PERFORM f_display_alv.
    *&      Form  f_build_lvc
    FORM f_build_lvc_and_slis.
    *.................Build LVC Fieldcatalog...............................*
      lvc_s_fieldcat-tabname = 'MSKA'.
      lvc_s_fieldcat-col_pos = 1.
      lvc_s_fieldcat-fieldname = 'WERKS'.
      lvc_s_fieldcat-datatype = 'CHAR'.
      lvc_s_fieldcat-intlen = '10'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
      lvc_s_fieldcat-tabname = 'MSKA'.
      lvc_s_fieldcat-col_pos = 2.
      lvc_s_fieldcat-fieldname = 'MATNR'.
      lvc_s_fieldcat-datatype = 'CHAR'.
      lvc_s_fieldcat-intlen = '18'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
      lvc_s_fieldcat-tabname = 'MAKT'.
      lvc_s_fieldcat-col_pos = 3.
      lvc_s_fieldcat-fieldname = 'MAKTX'.
      lvc_s_fieldcat-datatype = 'CHAR'.
      lvc_s_fieldcat-intlen = '10'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
      lvc_s_fieldcat-tabname = 'MARD'.
      lvc_s_fieldcat-col_pos = 4.
      lvc_s_fieldcat-fieldname = 'LABST'.
      lvc_s_fieldcat-datatype = 'QUAN'.
      lvc_s_fieldcat-intlen = '13'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
      lvc_s_fieldcat-tech = 'X'.
      lvc_s_fieldcat-col_pos = 5.
      lvc_s_fieldcat-fieldname = 'TCOLOR'.
      lvc_s_fieldcat-ref_field = 'COLOR'.
      lvc_s_fieldcat-ref_table = 'ZLVC_COL'.
      lvc_s_fieldcat-scrtext_l = 'COLOR'.
      APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
      CLEAR : lvc_s_fieldcat.
    *.................Build SLIS Fieldcatalog..............................*
      wa_fldcat-tabname = 'MSKA'.
      wa_fldcat-col_pos = 1.
      wa_fldcat-fieldname = 'WERKS'.
      wa_fldcat-datatype = 'CHAR'.
      wa_fldcat-seltext_m = wa_fldcat-seltext_l = wa_fldcat-seltext_s =
      'Plant'.
      wa_fldcat-intlen = '6'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
      wa_fldcat-tabname = 'MSKA'.
      wa_fldcat-outputlen = 15.
      wa_fldcat-col_pos = 2.
      wa_fldcat-fieldname = 'MATNR'.
      wa_fldcat-datatype = 'CHAR'.
      wa_fldcat-seltext_l = 'Material Number'.
      wa_fldcat-intlen = '16'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
      wa_fldcat-tabname = 'MAKT'.
      wa_fldcat-outputlen = 23.
      wa_fldcat-col_pos = 3.
      wa_fldcat-fieldname = 'MAKTX'.
      wa_fldcat-datatype = 'CHAR'.
      wa_fldcat-seltext_l = 'Material Description'.
      wa_fldcat-intlen = '20'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
      wa_fldcat-tabname = 'MARD'.
      wa_fldcat-col_pos = 4.
      wa_fldcat-fieldname = 'LABST'.
      wa_fldcat-datatype = 'QUAN'.
      wa_fldcat-intlen = '13'.
      wa_fldcat-seltext_m = wa_fldcat-seltext_l = wa_fldcat-seltext_s =
      'x Stock'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
      wa_fldcat-tech = 'X'.
      wa_fldcat-col_pos = 5.
      wa_fldcat-fieldname = 'TCOLOR'.
      wa_fldcat-ref_fieldname = 'COLOR'.
      wa_fldcat-ref_tabname = 'ZLVC_COL'.
      wa_fldcat-seltext_l = 'COLOR'.
      APPEND wa_fldcat TO it_fldcat.
      CLEAR : wa_fldcat.
    *.................Build Dynamic Fields for LVC and SLIS................*
      DATA : d TYPE i,
             col(6) TYPE n VALUE '0',
             date TYPE dats,
             day(8) TYPE c,
             number(2) TYPE n VALUE '0'.
      d = s_mbdat-high - s_mbdat-low + 1.
      date = s_mbdat-low - 1.
      DO d TIMES.
        number = number + 1.
        date = date + 1.
        col = col + 1.
        CONCATENATE 'x Day' number INTO day.
        lvc_s_fieldcat-tabname = 'VBBE'.
        lvc_s_fieldcat-col_pos = col + 5.
        lvc_s_fieldcat-fieldname = date.
        lvc_s_fieldcat-datatype = 'QUAN'.
        lvc_s_fieldcat-intlen = '15'.
        APPEND lvc_s_fieldcat TO lvc_t_fieldcat.
        CLEAR : lvc_s_fieldcat.
        wa_fldcat-tabname = 'VBBE'.
        wa_fldcat-col_pos = col + 5.
        wa_fldcat-fieldname = date.
        wa_fldcat-datatype = 'QUAN'.
        wa_fldcat-intlen = '15'.
        wa_fldcat-seltext_l = day.
        APPEND wa_fldcat TO it_fldcat.
        CLEAR : wa_fldcat.
      ENDDO.
    ENDFORM.                    " f_build_lvc
    *&      Form  f_build_dynamic_it
    FORM f_build_dynamic_it .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = lvc_t_fieldcat
        IMPORTING
          ep_table        = g_tdref.
      ASSIGN g_tdref->* TO <it_dyn>.
      CREATE DATA g_wdref LIKE LINE OF <it_dyn>.
      ASSIGN g_wdref->* TO <wa_dyn>.
    ENDFORM.                    " f_build_dynamic_it
    *&      Form  f_get_data
    FORM f_get_data .
      SELECT matnr mbdat omeng FROM vbbe INTO CORRESPONDING FIELDS OF TABLE
      it_data WHERE mbdat IN s_mbdat AND
                              werks = p_werks.
      DELETE it_data WHERE omeng = 0 .
      SORT it_data BY matnr ASCENDING.
    ENDFORM.                    " f_get_data
    *&      Form  f_get_fata_into_it
    FORM f_get_fata_into_it .
      FIELD-SYMBOLS : <fs>,
      <ta_color> TYPE table.
      DATA : field(15) TYPE c,
             col TYPE lvc_s_scol.
      LOOP AT it_data INTO wa_data.
        SELECT SINGLE maktx FROM makt INTO maktx WHERE matnr =
        wa_data-matnr.
        SELECT SINGLE labst FROM mard INTO labst WHERE matnr =
        wa_data-matnr AND werks = p_werks.
        diff = wa_data-mbdat - s_mbdat-low + 6.
        ASSIGN COMPONENT 1 OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = p_werks.
        ASSIGN COMPONENT 2 OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = wa_data-matnr.
        ASSIGN COMPONENT 3 OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = maktx.
        ASSIGN COMPONENT 4 OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = labst.
        ASSIGN COMPONENT diff OF STRUCTURE <wa_dyn> TO <fs>.
        <fs> = wa_data-omeng.
        IF labst < wa_data-omeng.
          col-fname = wa_data-mbdat.
          col-color-col = '5' .
          col-color-int =  '1'.
        ELSE.
          col-fname = wa_data-mbdat.
          col-color-col = '5' .
          col-color-int = '0' .
        ENDIF.
        ASSIGN COMPONENT 'TCOLOR' OF STRUCTURE <wa_dyn> TO <ta_color>.
        APPEND col TO <ta_color> .
        APPEND <wa_dyn> TO <it_dyn>.
        CLEAR <wa_dyn>.
      ENDLOOP.
    ENDFORM.                    " f_get_fata_into_it
    *&      Form  f_display_alv
    FORM f_display_alv .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = sy-repid
    *   I_CALLBACK_PF_STATUS_SET          = ' '
    *   I_CALLBACK_USER_COMMAND           = ' '
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
    *   I_GRID_TITLE                      =
    *   I_GRID_SETTINGS                   =
    *   IS_LAYOUT                         =
         it_fieldcat                       = it_fldcat
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
    *   IS_VARIANT                        =
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   I_HTML_HEIGHT_TOP                 =
    *   I_HTML_HEIGHT_END                 =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = <it_dyn>
       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.                    " f_display_alv

  • Making a Table cell editable. Please Help

    Hello there,
    I have written an Inner class called CallHeaderRenderer
    which is used to select to highlight a row from a table.
    But i am unable to edit the column data I click on.
    Please can any one tell me how to edit the column value when you double click on it??
    Attached is my Inner class used to select the concerned row.
    I am unable to edit the concerned column.....
    Please help.!!!
    What is the statement to make the cell editable!!!
    class CallHeaderRenderer extends DefaultTableCellRenderer{
    public CallHeaderRenderer(){
    super();
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column){
    // Set the highlight for record chosen.
    super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column);
    return this;
    }

    A renderer has nothing to do with editing the cell. I suggest you read this section from the Swing tutorial on "Using Tables" for an explanation of how tables work. The tutorial will give one method for making a cell editable:
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    Here is an alternate way to make a cell editable:
    table = new JTable( ... )
        public boolean isCellEditable(int row, int column)
            //  All columns, except the first, are editable
            if (column == 0)
                return false;
            else
                return true;
    };

  • Alv cell editing

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

    In the field catalogue, change the attributes of that field as editable
    fcat-edit = 'X'.
    After creating the grid, register event entered and modified
    Create alv grid
        CREATE OBJECT w_grid_vend
          EXPORTING
            i_parent          = w_vend_contnr
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            others            = 5.
        IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Register edit event
        CALL METHOD w_grid_vend->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter
          EXCEPTIONS
            error      = 1
            OTHERS     = 2.
        IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Edit event for modified
        CALL METHOD w_grid_vend->register_edit_event
          EXPORTING
            i_event_id =  cl_gui_alv_grid=>mc_evt_modified
          EXCEPTIONS
          error      = 1
          OTHERS     = 2.
    Handle the changed data in the methods
    Handle data changed
        METHODS handle_data_changed FOR EVENT data_changed
                               OF cl_gui_alv_grid
                               IMPORTING er_data_changed.

  • Color Cell in Dynamic ALV

    Hi all
    i try to put color in the dynamic alv, but i become a dump message
    Runtime Errors         OBJECTS_MOVE_NOT_SUPPORTED
    Date and Time          28.10.2010 08:46:49
    Short text
         Conversion of type "h" to type "g" not supported.
    What happened?
         Error in the ABAP Application Program
         The current ABAP program "SAPLSLVC" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    Error analysis
         You attempted to move one data object to another.
         This is not possible here because the conversion of a data object
         of type "h" to type "g" is not supported.
    my code implementation looks like
      method validate_order_deli.
        data ls_scol        type lvc_s_scol.
        data ls_colo        type lvc_s_colo.
        data ls_aoc_percent type zsd_aoc_percent.
        data lf_deliv       type lifmg.
        data lf_db_percent  type f.
        data lf_calc_perc   type f.
        refresh et_color.
        select single *
          from zsd_aoc_percent
          into corresponding fields of ls_aoc_percent
          where acin = 'X'.
        if sy-subrc <> 0.
          exit.
        endif.
        lf_db_percent = ls_aoc_percent-percent.
    *    ls_scol-fname = if_fieldname.
        ls_scol-fname = 'MATNR'.
        if if_deliv <> 0.
          me->calc_amour_unit(
            exporting
              if_matnr  = if_matnr
              if_amount = if_deliv
              if_input  = if_deliv_unit
              if_output = if_order_unit
            importing
              ef_amount = lf_deliv
          lf_calc_perc = ( lf_deliv * 100 ) / if_order.
          if lf_calc_perc < lf_db_percent.
            ls_colo-col = cl_gui_resources=>list_col_positive.
          else.
            ls_colo-col = cl_gui_resources=>list_col_negative.
          endif.
          ls_scol-color = ls_colo.
          append ls_scol to et_color.
        else.
          exit.
        endif.
      endmethod.                    "validate_order_deli
      method add_color_field.
        data ls_fcat type lvc_s_fcat.
        ls_fcat-fieldname = 'COLOR'.
        ls_fcat-ref_field = 'COLTAB'.
        ls_fcat-ref_table = 'CALENDAR_TYPE'.
        append ls_fcat to ct_fcat.
      endmethod.                    "add_color_field
          ls_lvc_s_layo-cwidth_opt = 'X'.
          ls_lvc_s_layo-ctab_fname  = 'COLOR'.
    i don't no, what's wrong...
    thx for help

    *&      Form  generate_alv
    *       text
    form generate_alv.
      field-symbols <lt_any_table> type any table.
      if lrf_gui_custom_container is initial.
        create object lrf_gui_custom_container
          exporting
            container_name = lf_container.
        create object lrf_gui_alvgrid
          exporting
            i_parent = lrf_gui_custom_container.
        ls_lvc_s_layo-cwidth_opt = 'X'.
        ls_lvc_s_layo-ctab_fname  = 'COLOR'.
        check sy-subrc = 0.
        call method lrf_gui_alvgrid->set_table_for_first_display
             exporting
    *             i_buffer_active               =
    *             i_bypassing_buffer            =
    *             i_consistency_check           =
    *             i_structure_name              = 'ZAM_CELL_COLOR'
    *             is_variant                    = ls_disvariant
    *             i_save                        = 'A'
    *             i_default                     = 'X'
               is_layout                     = ls_lvc_s_layo
    *             is_print                      =
    *             it_special_groups             =
    *             it_toolbar_excluding          =
    *             it_hyperlink                  =
    *             it_alv_graphics               =
    *             it_except_qinfo               =
    *             ir_salv_adapter               =
              changing
                it_outtab                     = <gt_table>
                it_fieldcatalog               = gt_dyn_fcat
    *             it_filter                     =
             exceptions
               invalid_parameter_combination = 1
               program_error                 = 2
               too_many_lines                = 3
               others                        = 4.
        if sy-subrc <> 0.
          message id sy-msgid type sy-msgty number sy-msgno
                     with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        endif.
      endif.
    endform.                    "generate_alv
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module status_0100 output.
      set pf-status 'ZAM_CELL_STATUS'.
      set titlebar 'ZAM_CELL_TIT'.
      perform generate_alv.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    module user_command_0100 input.
      data lf_okcode type syucomm.
      call method cl_gui_cfw=>dispatch.
      lf_okcode = ok_code.
      case lf_okcode.
        when 'EXIT'.
          set screen 0.
          leave screen.
        when 'CANCEL'.
          leave program.
        when 'BACK'.
          set screen 0.
          leave screen..
      endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT

  • Making individual row or cell editable or readonly depend on cell data

    Dear expert
    I'm working with dataGrid and itemEditor. I can make some
    column editable. But I would like to know how to set some specific
    row or cell editable or readonly depend on cell data. Could anybody
    guide me which method should I override or any idea?
    Thanks

    Well a simply way would be if the row contained some kind of
    data that had the info to determine if it was editable or not...
    e.g. say the data in the dataProvider of the dataGrid has a field
    called jobTitle and you didn't want cells in that row editable when
    the jobTitle is "Executive".
    <mx:DataGrid dataProvider="{jobData}" editable="true">
    <mx:columns>
    <mx:Array>
    <mx:DataGridColumn headerText="Title" dataField="Title"
    itemEditor="titleEditor"/>
    <mx:DataGridColumn headerText="Phone" dataField="Phone"
    itemEditor="phoneEditor"/>
    </mx:columns>
    </mx:DataGrid>
    Your itemEditor's could check to see if thats the case.
    phoneEditor.mxml
    <?xml version="1.0"?>
    <mx:TextInput xmlns:mx="
    http://www.adobe.com/2006/mxml"
    text="{data.Phone}" creationComplete="checkIfEditable()" >
    <mx:Script>
    public function checkIfEditable():void
    if(data.Title == 'Executive') this.editable=false;
    </mx:TextInput>

Maybe you are looking for

  • Repeatedly the same error in the omsca.log file during 11g installation

    Hi Experts, One of my customer is getting the below error in the OMSCA.log file: java.lang.Exception: CREATING_WEBTIER_INST_FAILED      at oracle.sysman.omsca.adapter.wls.OMSWLSAdapter.adapterConfigWebTier(OMSWLSAdapter.java:1808)      at oracle.sysm

  • Changing emp time data in CATSDB - user exit for CAT2?

    Hi experts, My requirement is to change the wage type against which the employee working hours gets stored in CATSDB table. I understood that through CAT2 tcode, the data is getting stored in CATSDb table. So can anyone tell me the user exit or Badi

  • 32-bit emulation in ArchLinux?

    According to the "Vordiplom, 64 Bits and Beryl" section at http://lhyanor.org/ Arch64 doesn't support 32-bit emulation. I believe, however, this may be old news. If this is the case, where is 32-bit emulation in Arch? As an example, I just recently i

  • Weblogic 7.0 on Solaris 8

    Hi all, have a question regarding weblogic 7.0 on Solaris 8. I have installed weblogic 7.0 on Solaris 8. I have root access on that machine. The way I did it was download the bin file (evaluation license) from bea.com , changed permissions (although

  • Apple id on my i phone 4 keeps telling me my password is incorrect when it works on my mac?

    how do i fix this ive tried logging in and out and changing my password multiple times?