ALV Tree with editable checkbox

Hi all,
I have a ALV Tree with editable checkbox (for all the parent & leaf  nodes) , as one of the column.On clicking of a button in toolbar , i should get the nodes which are checked in checkbox.
But the problem is i am not able to get the nodes which are checked through checkbox in the PAI of the screen,when the button is clicked.
I tried using    
CALL METHOD wf_tree->get_checked_items             
                       IMPORTING
                       et_checked_items = lint_selected_node.
but the return table is not containing any entries , even if check boxes are checked in ALV tree.I tried the GET_CHECKED_ITEMS method in event handler method of AFTER_USER_COMMAND and also CHECKBOX_CHANGE , but no success.
lfs_item_layout-fieldname = 'CHECK'.
  lfs_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
  lfs_item_layout-editable = 'X'.
  lfs_item_layout-CHOSEN = 'X'.
  APPEND lfs_item_layout TO lint_item_layout.
CALL METHOD wf_tree->add_node
    EXPORTING
      i_relat_node_key = p_lfs_final_key
      i_relationship   = cl_gui_column_tree=>relat_last_child
      i_node_text      = l_node_text
      is_outtab_line   = p_gfs_final
      is_node_layout   = lfs_node
      it_item_layout   = lint_item_layout
    IMPORTING
      e_new_node_key   = p_loc_qmnum_key.
Friends ,if you can suggest something.
Thanks
Abhijeet

hi ,
i have written below code for registering the CHECKBOX_CHANGE event of CL_GUI_ALV_TREE.
APPEND lfs_event TO lint_events.
    lfs_event-eventid = cl_gui_column_tree=>eventid_CHECKBOX_CHANGE.
  APPEND lfs_event TO lint_events.
  CALL METHOD wf_tree->set_registered_events
    EXPORTING
      events                    = lint_events
    EXCEPTIONS
      cntl_error                = 1
      cntl_system_error         = 2
      illegal_event_combination = 3.
  IF sy-subrc EQ 0.
*    MESSAGE X208(00) WITH 'ERROR'.                          "#EC NOTEXT
  ENDIF.
      SET HANDLER lo_event_receiver->handle_checkbox_change FOR wf_tree.
*      SET HANDLER lo_event_receiver->handle_button_click FOR wf_tree.
    ENDIF.
Also according to below code , i have put a break point in the event handler method of CHECKBOX_CHANGE event , so that control shall come here when check box is checked on ALV tree ...
CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS:
*      handle_checkbox_change FOR EVENT checkbox_change OF cl_gui_alv_tree,
*              importing fcode.
*      handle_button_click FOR EVENT AFTER_USER_COMMAND OF cl_gui_alv_tree
*        IMPORTING ucomm,
      handle_CHECKBOX_CHANGE for event checkbox_change of cl_gui_alv_tree
        importing CHECKED
                  FIELDNAME
                  NODE_KEY.
ENDCLASS.                    "lcl_event_receiver DEFINITION
*       CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
  METHOD handle_checkbox_change.
    data : lint_selected_node TYPE LVC_T_CHIT.
    BREAK abhijeetg.
*   CHECKED
*   FIELDNAME
*   NODE_KEY
*    case fcode.
*      when 'SELALL'.
*        perform select_all.
*    CALL METHOD WF_TREE->GET_OUTTAB_LINE
*      EXPORTING
*        I_NODE_KEY     =
**      IMPORTING
**        e_outtab_line  =
**        e_node_text    =
**        et_item_layout =
**        es_node_layout =
**      EXCEPTIONS
**        node_not_found = 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.
*    call method cl_gui_cfw=>dispatch.
    CALL METHOD wf_tree->get_checked_items
      IMPORTING
        et_checked_items = lint_selected_node.
    break abhijeetg.
  ENDMETHOD.         
ENDCLASS.
So according to you , I should get the control in the break point , but its not happening with this .. any thing missing ???
Edited by: abhijeet_7013 on Jun 21, 2011 10:31 PM

Similar Messages

  • ALV LIST with few checkboxes fields

    Hi everyone,
    I want to create an ALV with 2 fields that are checkboxes.
    I am succeeding to create an ALV with one checkbox field.
    How do we do in order to create an ALV with 2 checkboxes fields using ALV LIST ?
    I know that we have to specify in the layout of the ALV the name of the field we want it to be checkbox.
    For example :
      gs_layout-box_fieldname   = 'FLAG'.            
    But, how do we specify a second checkbox field ?
    Thanks.
    Regards.

    Slight modification to my earlier post. this is with 2 checkboxes.
    REPORT  ztest_alv_checkbox.
    TYPE-POOLS: slis.
    DATA: it_fcat TYPE  slis_t_fieldcat_alv,
          wa_cat LIKE LINE OF it_fcat.
    DATA: BEGIN OF it_alv OCCURS 0,
           check1(1),
           check2(1),
           carrid LIKE sflight-carrid,
           connid LIKE sflight-connid,
          END OF it_alv.
    DATA:it_events TYPE slis_t_event,
         wa_events LIKE LINE OF it_events.
    SELECT carrid
           connid
      FROM sflight
      INTO CORRESPONDING FIELDS OF TABLE it_alv
      UP TO 20 ROWS.
    wa_cat-fieldname = 'CHECK1'.
    wa_cat-input = 'X'.
    wa_cat-edit = 'X'.
    wa_cat-checkbox = 'X'.
    wa_cat-seltext_l = 'Check'.
    wa_cat-tabname = 'IT_ALV'.
    APPEND wa_cat TO it_fcat.
    CLEAR wa_cat.
    wa_cat-fieldname = 'CHECK2'.
    wa_cat-input = 'X'.
    wa_cat-edit = 'X'.
    wa_cat-checkbox = 'X'.
    wa_cat-seltext_l = 'Check'.
    wa_cat-tabname = 'IT_ALV'.
    APPEND wa_cat TO it_fcat.
    CLEAR wa_cat.
    wa_cat-fieldname = 'CARRID'.
    wa_cat-seltext_l = 'Carrid'.
    wa_cat-tabname = 'IT_ALV'.
    APPEND wa_cat TO it_fcat.
    CLEAR wa_cat.
    wa_cat-fieldname = 'CONNID'.
    wa_cat-seltext_l = 'Connid'.
    wa_cat-tabname = 'IT_ALV'.
    APPEND wa_cat TO it_fcat.
    wa_events-name = slis_ev_end_of_list.
    wa_events-form = 'MODIFY_LIST'.
    APPEND wa_events TO it_events.
    CLEAR wa_events.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        it_fieldcat        = it_fcat
        it_events          = it_events
      TABLES
        t_outtab           = it_alv
      EXCEPTIONS
        program_error      = 1
        OTHERS             = 2.
    IF sy-subrc NE 0.
    ENDIF.
    "After The list display i am modifying the report output
    "using the END_OF_LIST event of ALV
    "here conditionally i can make the cell input off
    *&      Form  MODIFY_LIST
    *       text
    FORM modify_list.
      DATA: l_lines TYPE i,
            l_index TYPE i.
      l_lines  = l_lines + 3.
      "because we have 3 lines extra occupied by lables.
      "if we have header,i mean top of page add the no.of lines
      "how many ever top of page have + 3 for labels.
      DESCRIBE TABLE it_alv LINES l_lines.
      l_lines  = l_lines + 3.
      "understnad this part alone.
      DO l_lines TIMES.
        IF sy-index GT 3.
          l_index = sy-index - 3.
          READ TABLE it_alv INDEX l_index.
          "this is my condition..
          IF sy-subrc = 0 .
            IF it_alv-carrid <> 'AA'.  "place your condition here.
              "accordingly you can disable the checkbox
              "use the below logic
              READ LINE sy-index INDEX sy-lsind.
              IF sy-subrc = 0.
                MODIFY LINE sy-index INDEX sy-lsind
                           FIELD FORMAT  it_alv-check1 INPUT OFF
                                         it_alv-check2 INPUT OFF.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDDO.
    ENDFORM.                    "MODIFY_LIST

  • Create a Procedural ALV Report with editable fields and save the changes

    Hi,
    I am new to ABAP. I have created a Procedural ALV Report with 3 fields. I want to make 2 fields editable. When executed, if the fields are modified, I want to save the changes. All this I want to do without using OO concepts. Please help . Also, I checked out the forum and also the examples
    BCALV_TEST_GRID_EDIT_01
    BCALV_TEST_GRID_EDIT_02
    BCALV_TEST_GRID_EDIT_04_FORMS
    BCALV_TEST_GRID_EDITABLE
    BCALV_EDIT_01
    BCALV_EDIT_02
    BCALV_EDIT_03
    BCALV_EDIT_04
    BCALV_EDIT_05
    BCALV_EDIT_06
    BCALV_EDIT_07
    BCALV_EDIT_08
    BCALV_FULLSCREEN_GRID_EDIT
    But all these are using OO Concepts.
    Please help.
    Regards,
    Smruthi

    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,
      line_color(4) TYPE c,     "Used to store row color attributes
    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,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
    fieldcatalog-edit             = 'X'
      fieldcatalog-col_pos     = 5.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
      gd_layout-info_fieldname =      'LINE_COLOR'.
    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'
           EXPORTING
                i_callback_program      = gd_repid
                i_callback_pf_status_set = 'STATUS'
                i_callback_top_of_page   = 'TOP-OF-PAGE'
               i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           TABLES
                t_outtab                = it_ekko
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      DATA: ld_color(1) TYPE c.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekko.
      LOOP AT it_ekko INTO wa_ekko.
        ld_color = ld_color + 1.
        IF ld_color = 8.
          ld_color = 1.
        ENDIF.
        CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
        MODIFY it_ekko FROM wa_ekko.
      ENDLOOP.
    ENDFORM.                    " DATA_RETRIEVAL
          FORM top-of-page                                              *
    FORM top-of-page.
      WRITE:/ 'This is First Line of the Page'.
    ENDFORM.
          FORM status                                                   *
    FORM status USING rt_extab TYPE slis_t_extab.  .
      SET PF-STATUS 'ALV'.
    ENDFORM.
          FORM USER_COMMAND                                          *
    -->  RF_UCOMM                                                      *
    -->  RS                                                            *
    FORM user_command USING rf_ucomm LIKE sy-ucomm
                             rs TYPE slis_selfield.            
      DATA ref1 TYPE REF TO cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = ref1.
      CALL METHOD ref1->check_changed_data.
      CASE rf_ucomm.
    when 'SAVE'.
    get all the modified entries and store them in an internal table and udpate them in to the required transaction or your custom table.
    endcase.
    endform.
    ENDFORM.
    here u need to 2 performs for PF status and USER_COMMAND in the ALV parameters.
    create a custom PF status and create push buttons and assign your ok codes in your PF status.
    if the field has to be edited in the ALV then pass EDIT = 'X' for that field in the fieldcatlog preparation.
    Hope this will help you.
    Regards,
    phani.

  • ALV grid with editable fields

    Dear Colleagues,
    I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.
    I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?
    Thanks a lot and kind regards
    Peter

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
    * Displaying the output in ALV Grid
        vs_layout_grid-no_rowmark = 'X'.
        vs_layout_grid-zebra      = 'X'.
        vs_layout_grid-cwidth_opt = 'X'.
        vs_layout_grid-edit       = 'X'.
        vs_layout_grid-ctab_fname = 'CT'.
        vs_layout_grid-stylefname = 'CELLTAB'.
        CALL METHOD v_grid->set_table_for_first_display
          EXPORTING
            i_save                        = 'X'
            is_layout                     = vs_layout_grid
            it_toolbar_excluding          = i_toolbar_excluding[]
          CHANGING
            it_outtab                     = itab[]
            it_fieldcatalog               = it_fieldcat[]
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc NE 0.
          MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
          STOP.
        ENDIF.                             " IF sy-subrc NE 0
      ELSE.                                " IF w_custom_container...
    * Refresh the container if it already exists
        CALL METHOD v_grid->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS   = 2.
        IF sy-subrc NE 0.
          MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
          STOP.
        ENDIF.                            

  • Synchronize recursive tree with edit form

    Hi,
    I am trying to synchronize recursive tree with form, i have followed this post exactly Oracle ADF Developer: ADF - Synchronizing form with recursive tree
    the first level of the tree works but the inner levels does not.
    I am using JDEV 11.1.2.3

    Try sample 83 here -
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html#CodeCornerSamples

  • ALV Tree with field editable

    Hi All,
    We used the class CL_GUI_ALV_TREE for display.
    We need to do the field editable, is it possible? How?
    Thank you.

    This question has been asked and answered many times - please search.
    matt

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

  • How to make field editable in ALV tree in OOPs?

    Hi Gems,
    Again I need help from you all.
    I am writing a program using OOPs and the uotput will be in ALV tree. I need to make a field editable in a perticular row.
    I am doing it using layout but the program is giving error during
    CALL METHOD CL_GUI_CFW=>FLUSH
          EXCEPTIONS
            CNTL_SYSTEM_ERROR = 1
            CNTL_ERROR        = 2.
    This method is returning sy-subrc = 2 and I am unable to get the output.
    I am using below code to make the field editable:
    DATA: LT_LAYOUT_ITEM TYPE LVC_T_LAYI,
                LS_LAYOUT_ITEM TYPE LVC_S_LAYI.
      LS_LAYOUT_ITEM-FIELDNAME = 'ACPCKTWRT'.     "ACPCKTWRT is the field name in the Internal table
      LS_LAYOUT_ITEM-EDITABLE = 'X'.
      APPEND LS_LAYOUT_ITEM TO LT_LAYOUT_ITEM.
    CALL METHOD G_ALV_TREE->ADD_NODE
        EXPORTING
          I_RELAT_NODE_KEY     = FP_RELAT_KEY
          I_RELATIONSHIP       = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
          IS_OUTTAB_LINE       = LS_TMP_FINFCNO                                                "structure of the internal table
         IS_NODE_LAYOUT       =
          IT_ITEM_LAYOUT       = LT_LAYOUT_ITEM                                                "Added layout to make the field editable
          I_NODE_TEXT          = LV_NODE_TEXT                                                      "Node text
        IMPORTING
          E_NEW_NODE_KEY       = FP_NODE_KEY
        EXCEPTIONS
          RELAT_NODE_NOT_FOUND = 1
          NODE_NOT_FOUND       = 2
          OTHERS               = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Please help me and let me know how to get the solution.

    Hello
    The ALV tree control is not intended for making values editable (e.g. see
    [How to make ALV tree columns editable|http://sap.ittoolbox.com/groups/technical-functional/sap-abap/how-to-make-alv-tree-columns-editable-2052414])
    However, if you need an editable tree control then you have to use a different class (e.g. CL_ITEM_TREE_MODEL or CL_COLUMN_TREE_MODEL) but you will not have the ALV functionality of the ALV tree control.
    Regards
      Uwe

  • Select all checkbox in ALV tree

    Hi There,
    I have developed a report using ALV tree with 3 level nodes. I have introduced checkbox in one of the column in the node..
    By this I can select the checkbox individually. I have got the requirement to select all the checkboxes simultaneously using a button. I tried several things but no help..
    Please help me with this..I have used class 'cl_gui_alv_tree' for designing the Tree.

    Hi,
    You need to add a button to the toolbar manually, when the button is pressed loop at all the nodes that have a checkbox and update the checkbox field.
    Something like....
    data:  go_tree1     type ref to cl_gui_alv_tree,
           go_toolbar   type ref to cl_gui_toolbar
    * Add buttons to the toolbar
      call method go_tree1->get_toolbar_object
        importing
          er_toolbar = go_toolbar.
      check go_toolbar is not initial.
      call method go_toolbar->add_button
        exporting
          fcode     = 'SELALL'
          icon      = icon_select_all
          butn_type = cntb_btype_button
          text      = ''
          quickinfo = 'Select All'.
    * Define an event handler
    data: go_receiver  type ref to lcl_event_receiver.
    class lcl_event_receiver definition.
      public section.
        methods:
          function_selected for event function_selected of cl_gui_toolbar
                  importing fcode.
    endclass.
    class lcl_event_receiver implementation.
      method function_selected.
        case fcode.
          when 'SELALL'.
            perform select_all.
      endmethod.
    * Register the event
      create object go_receiver.
      set handler go_receiver->function_selected for go_toolbar.
    form select_all.
      data: lv_field type lvc_fname.
    * Update the checkbox on each node of the ALV tree
      lv_field = 'CHECK'.   "Whatever you've called the checkbox
      call method go_tree1->change_item
        exporting
          i_node_key     = node_key   "<-- loop at the nodes and repeat for each one with a checkbox
          i_fieldname    = lv_field
          i_data         = ' '
        exceptions
          node_not_found = 1
          others         = 2.
      call method go_tree1->frontend_update.   "call this onces all updates have been made
    endform.
    Regards,
    Darren

  • Editing of a  Column of ALV Tree(OOPS) node

    is it possible to edit a column of node of ALV tree.
    i am using ALV class "CL_GUI_ALV_TREE".
    After searching existing threads, for the same issue..i found the following.
    1) Editable Tree ALV
      ( displays pop up window where user can change values and then transfer these changes back to ALV tree)
    2) Editable Field in ALV TREE Display Using OOPs
         (this approach is not working for ALV Tree)
    But i want to edit directly coulmn of a node of ALV tree.
    is it possible in  OOPS ALV Tree?
    if it possible, can any one provide the sample code,

    As you already noticed, this is not possible, but you may edit your fields outside the tree and bring your changes back to tree. I struggled with the same once but eventually used described alternative. If you use saplink you may check upgrade [chain and rename|http://code.google.com/p/saplink-chain-and-rename/downloads/list] where this approach is released. The code is free so you will be able to study and copy whatever you need from it.
    Editing in a pop up is also an alternative here.
    Regards
    Marcin

  • ALV tree - run time error.

    I'm trying to creat an ALV tree with the format exactly the same as BCalv_tree_simple_demo program, except adding one more node. I create a database table in se11 and exporting this table to ALV. However when i run it, it showed run time error that "Field symbol has not yet been assigned".
    Trigger Location of Runtime Error                                               
        Program                                 CL_GUI_ALV_TREE_SIMPLE========CP    
        Include                                 CL_GUI_ALV_TREE_SIMPLE========CM01G 
        Row                                     13                                  
        Module type                             (METHOD)                            
        Module Name                             SET_HIERARCHY_DATA                  
    This is a part of my code
    FORM build_fieldcatalog.
    * get fieldcatalog
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZTRANG'                """
        CHANGING
          ct_fieldcat      = gt_fieldcatalog.
    * change fieldcatalog
      DATA: ls_fieldcatalog TYPE lvc_s_fcat.
      LOOP AT gt_fieldcatalog INTO ls_fieldcatalog.
        CASE ls_fieldcatalog-fieldname.
          WHEN 'ZTELCO' OR 'ZVP' OR 'ZDEPT' OR 'ZKOSTL'.
            ls_fieldcatalog-no_out = 'X'.
            ls_fieldcatalog-key    = ''.
          WHEN 'ZDESC' OR 'ZMONTH1' OR 'ZMONTH2' OR 'ZMONTH3'.
            ls_fieldcatalog-do_sum = 'X'.
        ENDCASE.
        MODIFY gt_fieldcatalog FROM ls_fieldcatalog.
      ENDLOOP.
    ENDFORM.                               " BUILD_FIELDCATALOG
    *&      Form  BUILD_OUTTAB
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_outtab.
      SELECT * FROM ztrang INTO TABLE gt_tree.
    *              up to 1 rows.
    ENDFORM.                               " BUILD_OUTTAB
    *&      Form  BUILD_SORT_TABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_sort_table.
      DATA ls_sort_wa TYPE lvc_s_sort.
    * create sort-table
      ls_sort_wa-spos = 1.
      ls_sort_wa-fieldname = 'ZTELCO'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
      ls_sort_wa-spos = 2.
      ls_sort_wa-fieldname = 'ZVP'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
      ls_sort_wa-spos = 3.
      ls_sort_wa-fieldname = 'ZDEPT'.
      ls_sort_wa-up = 'X'.
      ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
      ls_sort_wa-spos = 4.
      ls_sort_wa-fieldname = 'ZKOSTL'.
      ls_sort_wa-up = 'X'.
    *  ls_sort_wa-subtot = 'X'.
      APPEND ls_sort_wa TO gt_sort.
    ENDFORM.                               " BUILD_SORT_TABLE
                                                                                    Do you have any clues for this? Thanks.
    Edited by: trangie on Apr 13, 2009 5:13 PM

    Hello,
    Please check the dumps in ST22 and search for applicable notes based on your version of installation.
    Regards,
    Gowrinadh

  • ALV Grid Handle Edit Event (Lost Focus)

    Hi all,
    I have some problems with the ALV Grid.
    Target:
    I have an ALV Grid with editable Column. If the user insert, update or delete the content of the column and leave the column (column lost focus) i'd like to do somthing - this means I need a event for this action. Can anybody help me to solve this problem?
    Thanks Stefan

    Use Event data_changed and data_changed_finished of the cl_gui_alv_grid.Then all you have to do is registering your event to the ALV and fill the methods with what you want to do.In ALV Grid, There is no event to capture the lost focus of a column if you don't modify it.
    CLASS lcl_event_receiver DEFINITION.
        METHODS:
    *$ Check the change
           handle_data_changed FOR EVENT data_changed
                                   OF cl_gui_alv_grid
                               IMPORTING er_data_changed
                                         e_ucomm
                                         e_onf4
                                         e_onf4_before
                                         e_onf4_after,
           handle_data_changed_finished
                               FOR EVENT data_changed_finished
                                   OF cl_gui_alv_grid
                                IMPORTING e_modified
                                         et_good_cells
                                         sender,
    ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION

  • Interactive ALV tree problem

    Hi all,
    Please help,
    I have created ALV tree, with the help of standard program bcalv_tree_01. now i want to create it interative like DOUBLE CLICK on any ITEM or NODE. so i have define class and implement it with two method for event NODE_DOUBLE_CLICK and ITEM_DOUBLE_CLICK. and i have register it. when i display the tree it doesn't expand, but i comments the CALL METHOD gd_tree->set_registered_events it works fine. should i have to implement the event EXPAND_NO_CHILDREN also?
    and what should be the code, becoz i am new in alv tree and oops. for sytex please refer BCALV_TREE_01.
    please help as soon as possible.
    Thanks in advance.

    Hi!
    Ya you have to code for the method  EXPAND_NO_CHILDREN
    Where you will be defining the childs to the particular node.
    the better example for it you can refer to SAPSIMPLE_TREE_CONTROL_DEMO
    where
    HANDLE_EXPAND_NO_CHILDREN method implemented shows the childs added and  METHOD  HANDLE_NODE_DOUBLE_CLICK
    implemented to handle the doulbe click.
    Regards.

  • Header background in ALV Tree

    Hello,
    I'm using ALV Tree with HTML commentary header. I found in example only one background for that header.
    me->mo_tree->set_table_for_first_display(
        EXPORTING
          is_hierarchy_header = ls_hierarchy_hdr
          it_list_commentary  = lt_commentary
          i_background_id      = 'ALV_BACKGROUND'
        CHANGING
          it_outtab           = mt_tree_data
          it_fieldcatalog     = lt_fcat ).
    The background is called ALV_BACKGROUND. Do you know some other background images in standard SAP? Where can I find that? Some db table or transaction?
    Thanks and best regards,
    Marcin

    use TC : se78
    Reward points if helpful
    Regards
    Nilesh

  • Editable field with F4 help in alv tree output using cl_gui_alv_tree

    HI
    i need Editable field with F4 help in alv tree output using cl_gui_alv_tree
    Regards
    Naresh

    Hi Naresh,
    Pass the field catalog with the additional parameter (ls_fcat-edit = 'X'.).
    for F4 help if the data element have the search help it automatically will come. other wise include the additional parameter in the field catalog (ls_fcat-F4AVAILABL = 'X')
    Reward if found helpful.
    Regards,
    Boobalan Suburaj

Maybe you are looking for

  • My iphone 5 was stolen from me if they've reset the device fully will I still be able to find it with the imei number or the sim cards wifi

    I'm just soo annoyed that someone stole from me and if they've restored the device will i be able to ring up the company (vodaphone) or apple to get them to track my IMEI on the phone because they're bound to connect to wifi at some point weither its

  • Hierarchy format in Flat file

    Hi gurus,       please tellme  the Hierarchy format in Flat file.            ThanQ.    Regards,    Ramesh.

  • A question in the query

    Hi, i would lke to display 2 rows and 2 columns in the query. 2 rows: material nr and year 2 columns: Total amount for whole year and a quarter of this year eg.      material nr    year      amount for 2010    amount for 4. quarter 2010            00

  • Set Category Level in RfC

    Hi, I've got the problem, that I can't select the Category "Level1", etc. in a RfC in status "Validation for release". I'm using this sequence of workflow https://websmp105.sap-ag.de/~sapidb/011000358700001063542013E/index.htm I guess the bug is some

  • Creation of Interlinking Action in VMS

    Hello Experts, I want ro create a interlinking action in VELO tcode( VMS)  for creation of used vehicle ( CRUV) and Trade In PO ( POEU ). Can anyone let me know how do i create this interlinking action in VMS. Thanks & Regards, Ravi Aswani