How to add a checkbox to an ALV in WDA?

Hiya,
I need a table with a column as a checkbox within my web dynpro.
So I created a structure in the context, where the column for the checkbox is setup as type WDY_BOOLEAN:
Unfortunately in the ALV it appears as a non-editable checkbox:
Anyone know what I've done wrong?
Thanks in advance!

Hiya,
I've added the following code and it seems to work. Could you just check and then I can close this discussion.
DATA:
       lr_alv_usage       TYPE REF TO if_wd_component_usage,
       lr_if_controller   TYPE REF TO iwci_salv_wd_table,
       lr_config          TYPE REF TO cl_salv_wd_config_table,
       lt_columns         TYPE        salv_wd_t_column_ref.
* Instantiate the ALV Component
   lr_alv_usage = wd_this->wd_cpuse_alv_table( ).
* Get reference to model
   lr_if_controller = wd_this->wd_cpifc_alv_table( ).
   lr_config        = lr_if_controller->get_model( ).
*Enable the non-read only fields to be edited.
   lr_config->if_salv_wd_table_settings~set_read_only( value = abap_false ).
Thanks!

Similar Messages

  • How to add a checkbox to dynamic itab  so that i can select some records

    How to add a checkbox to dynamic itab  so that i can select some records in the alv and can display them in another alv using a button
    I have requirement where i have to display the dynamic itab records in an alv ....Some records from this alv output has to be selected through checkbox  provided in the first column .( I will get to know the structure of the itab only at runtime ,so iam using dynamic itab)

    Hi,
       I tried and finally i got it , Just try for it.
    type-pools : slis.
    PARAMETERS : p_tab type dd02l-tabname.
    data : ref_tabletype  type REF TO cl_abap_tabledescr,
           ref_rowtype TYPE REF TO cl_abap_structdescr.
    field-symbols  : <lt_table>  type   standard TABLE ,
           <fwa> type any,
           <field> type abap_compdescr.
    data : lt_fcat type lvc_t_fcat,
           ls_fcat type lvc_s_fcat,
           lt_fldcat type SLIS_T_FIELDCAT_ALV,
           ls_fldcat like line of lt_fldcat.
    data : ref_data type REF TO data,
            ref_wa type ref to  data.
    ref_rowtype ?= cl_abap_typedescr=>DESCRIBE_BY_name( p_name = p_tab ).
    TRY.
    CALL METHOD cl_abap_tabledescr=>create
      EXPORTING
        p_line_type  = ref_rowtype
      receiving
        p_result     = ref_tabletype.
    CATCH cx_sy_table_creation .
    write : / 'Object Not Found'.
    ENDTRY.
    *creating object.
    create data ref_data type handle ref_tabletype.
    create data ref_wa type handle ref_rowtype.
    *value assignment.
    ASSIGN ref_data->* to <lt_table>.
    assign ref_wa->* to <fwa>.
    loop at ref_rowtype->components ASSIGNING <field>.
      ls_fcat-fieldname = <field>-name.
      ls_fcat-ref_table = p_tab.
      append ls_fcat to lt_fcat.
    if lt_fldcat[] is  INITIAL.
        ls_fldcat-fieldname = 'CHECKBOX'.
        ls_fldcat-checkbox = 'X'.
        ls_fldcat-edit = 'X'.
        ls_fldcat-seltext_m = 'Checkbox'.
        append ls_fldcat to lt_fldcat.
      endif.
      clear ls_fldcat.
      ls_fldcat-fieldname = <field>-name.
      ls_fldcat-ref_tabname = p_tab.
      append ls_fldcat to lt_fldcat.
    endloop.
    loop at lt_fldcat into ls_fldcat.
      if sy-tabix = 1.
        ls_fldcat-checkbox = 'X'.
        ls_fldcat-edit = 'X'.
    modify lt_fldcat FROM ls_fldcat
        TRANSPORTING checkbox edit.
    endif.
    endloop.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog           = lt_fcat[]
      IMPORTING
        ep_table                  = ref_data.
    assign ref_data->* to <lt_table>.
    select * FROM (p_tab) into table <lt_table>.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       IT_FIELDCAT                       = lt_fldcat[]
      TABLES
        t_outtab                          = <lt_table>.
    Thanks & Regards,
    Raghunadh .K

  • How to add the double headings in Alv Report.

    Hi All,
    Plz suggest me how to add the double headings in ALv Report.
    Ram

    Hi,
    Try out this program....
    REPORT  ypm_historycard_rep.
    TYPE-POOLS : slis.
    DATA : it_cbm TYPE STANDARD TABLE OF mara.
    DATA : it_layout TYPE STANDARD TABLE OF slis_layout_alv WITH HEADER LINE,
           wa_fcat TYPE slis_fieldcat_alv,
           it_fcat TYPE slis_t_fieldcat_alv.
    START-OF-SELECTION.
      SELECT  *
      FROM  mara
      INTO CORRESPONDING FIELDS OF TABLE  it_cbm
      where matnr = 'D80K7'.
    END-OF-SELECTION.
      it_layout-zebra = 'X'.
      it_layout-colwidth_optimize = 'X'.
      it_layout-f2code = '&ETA'.
      APPEND it_layout.
      DEFINE macro4fcat.
        wa_fcat-col_pos = &1.
        wa_fcat-fieldname = &2.
        wa_fcat-tabname = &3.
        wa_fcat-seltext_l = &4.
        append wa_fcat to it_fcat.
        clear wa_fcat.
      END-OF-DEFINITION.
      macro4fcat    '1'  'MATNR'         'IT_CBM'   'MATERIAL NO'    .
      DESCRIBE TABLE it_cbm.
      IF sy-ucomm = '&F03'.
        MESSAGE 'hi hello good morning "press enter button" this is quiz' TYPE 'S'.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      i_callback_program                = sy-repid
    i_callback_html_top_of_page       = 'HTML_TOP_OF_PAGE'
      is_layout                         = it_layout
      it_fieldcat                       = it_fcat
       i_save                            = 'A'
      TABLES
      t_outtab                          = it_cbm
      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.
    *&      Form  html_top_of_page
    *       text
    *      -->TOP        text
    FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
      DATA: l_text(255) TYPE c.
      DATA: text1(255)  TYPE c.
      DATA: t_header TYPE REF TO cl_dd_table_element ,
            wa_header TYPE REF TO cl_dd_table_area.
      CALL METHOD top->add_gap
        EXPORTING
          width = 10.
      CALL METHOD top->add_text
      EXPORTING
        text          = 'hello'
        sap_style     = 'HEADING'
    CALL METHOD top->add_gap
        EXPORTING
          width = 20.
      CALL METHOD top->add_text
      EXPORTING
        text          = 'HOW ARE YOU'
        sap_style     = 'HEADING'.
        CALL METHOD TOP->new_line
    *      EXPORTING
    *        repeat =
        CALL METHOD top->add_gap
        EXPORTING
          width = 50.
      CALL METHOD top->add_text
      EXPORTING
        text          = '____________________________________________________________'
        sap_style     = 'HEADING'.
        CALL METHOD TOP->new_line
    *      EXPORTING
    *        repeat =
        CALL METHOD top->add_gap
        EXPORTING
          width = 90.
      CALL METHOD top->add_text
      EXPORTING
        text          = 'YOU CAN TRY LIKE THIS'
        sap_style     = 'HEADING'.
    ENDFORM.                    "html_top_of_page
    Regards
    Debarshi

  • How to Edit the CheckBox in Classic ALV GRID Display

    Hi,
    I want to Edit the checkbox in Grid Display.
    I have one checkbox field in my internal Table,
    Code Of the Program,
    Data :
    Begin of itab occurs 0,
    CHK type C,
    MATNR like MARA-MATNR,
    end of itab.
    Iam building the fieldcatelog using Merge Funcion module.
    After that I am chaning the properties of the field
    catelog like below,
    loop at I_FCAT assigning <FCAT>.
    Case <FCAT>-Fieldname
    When 'CHK'.
    <FCAT>-Checkbox = 'X'.
    <FCAT>-INPUT = 'X'.
    I dont have edit option in fieldcatelog.
    modify I_FCAT from <FCAT>.
    endcase.
    endloop.
    In the Layout,
    I_LAYOUT-box_fieldname = 'CHK'.
    I_LAYOUT-box_tabname = 'ITAB'.
    It is displaying the Checkbox field.but I couldnt edit the checkBox.
    I can able to edit in REUSE_ALV_LIST_DISPLAY.
    But I  have to use REUSE_ALV_GRID_DISPLAY.How to edit the checkbox.
    Thanks in Advance,
    Sumithra

    Hi vasu,
    The below procedure explains you to create a checkbox cloumn in the grid and allows you to edit i hope this will helps u.
    The ALV Grid Control displays the cells of a column as checkboxes if the column is marked as a checkbox column in the field catalog.
    •     Add another field to the output table in which you want to display checkboxes
    OR
    •     Define an existing field as a checkbox.
    Procedure
    1.     Add a field to your output table:
    Data: gt_fieldcat type lvc_t_fcat.
    Types: begin of gs_outtab.
    Types: checkbox type c. "field for checkbox
    Include structure <ABAP Dictionary structure> .
    Types: end of gs_outtab.
    Data: gt_outtab type gs_outtab occurs 0 with header line.
    2 * Add an entry for the checkbox to the field catalog
    clear ls_fcat.
    ls_fcat-fieldname = 'CHECKBOX'.
    * Essential: declare field as checkbox and
    * mark it as editable field:
    ls_fcat-checkbox = 'X'.
    ls_fcat-edit = 'X'.
    * do not forget to provide texts for this extra field
    ls_fcat-coltext = text-f01.
    ls_fcat-tooltip = text-f02.
    ls_fcat-seltext = text-f03.
    append ls_fcat to gt_fieldcat.
    regards,
    venu.

  • How to add a check box in ALV Grid using SAP R/3 release 4.6b?

    Hello everyone,
    I hope you all fine.
    I'm writing because I have a requirement with ALV Grid,  what I need to do, is to insert a checkbox into a cell, I already read the forum to know how to do that, but I'm using a SAP R/3 release 4.6b, and when I execute the program the checkbox is displayed greyout,  because this release doesn't have the EDIT property into the slis_t_fieldcat_alv.
    Does any body know how to enable the checkbox cell in the ALV Grid for this release?, so it will allow the user to mark the desired rows.
    I'll really appreciate if you guys could help me to find a solution.
    Thanks for your time.
    Regards,
    Guillermo

    Hi,
    if you need just a check box for each line, try to get rid of this line from your layout.
    g_layout-box_fieldname = 'ZZCHECK'.
    SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
    Cheers

  • How to add Select event in dynamic ALV

    Hi,
    I have created dynamic ALV and now i want to checked the selected row value.
    If in the selected row contain 'A' value then i have to disable the Button given on the screen.
    If in the selected row contain B' value then i have to enable the Button given on the screen.
    How to add the event once I select the row.
    I have done like this . but it is not
    lw_api_2->do_dynamic_navigation(
              source_window_name          = 'ZWDCHHR_EX_TASK_DELE'
              source_vusage_name          = 'ZWDVHHR_EX_TASK_DELE_USAGE_1'
              source_plug_name            = 'TO_ALV'
              target_component_name       = 'SALV_WD_TABLE'
              target_component_usage      = 'ALV_USAGE1'
              target_view_name            = 'TABLE'
              target_plug_name            = 'DEFAULT'
              target_embedding_position   = 'ZWDVHHR_EX_TASK_DELE/VIEW_DELEG_MY_TASKS' ).
      register event handler
        lw_cmp_usage_2->add_event_handler(
           listener        =  lw_api_2
           handler_name    = 'ONSELECT_TAB1'
           controller_name = 'INTERFACECONTROLLER'
           event_name      = 'ON_SELECT' ).
    Thanks and regards
    Amita Gandhi

    Hi Amita,
    You can try fetch the number of the row which was leadselected through R_PARAM->INDEX. (This would be just a normal integer variable. You can try check this out in debugging mode. ) Now you can just read the data of this row from the context node by saying as GET_ATTRIBUTE up on the nodes reference with the index as R_PARAM->INDEX.
    Regards,
    Uday

  • How to add a button on the ALV LIST pop up

    Hi ,
    Can any one help me to add a button on the ALV list which is a pop up using ABAP Objects.
    Thanks in advance.
    Regards,
    Kavya.

    HI ,
    I want to add a push button on the ALV list out put which is comming as a pop up and I want this using classes and methods.
    I have got a method IF_SREL_BROWSER_COMMANDS~ADD_BUTTONS from class cl_gos_attachment_list  but still I am unable to get any additional button on the output ALV popup.
    Please help.
    Regards,
    Kavya.

  • Please Help: How to add a Checkbox field to a JTable

    Hi,
    I am trying to add a checkbox filed to a JTable with DefaultTableModel.
    I have tried fro hours. Just Does not work.
    Here is my sample code:
    DefaultTableModel model = new DefaultTableModel();
    JTable table = new JTable(model);
    Object[] data;
    data = new Object[2];
    data[0]= "string"
    data[2] = new Boolean(false)
    model.addRow(data);     
    What is missing in here?
    Thanks,
    Tara

    you can do that with the help of DefaultTableModel alone
    if u r so determined to use DefaultTableModel u need to have a subclass of it
    following sample may satisfy u ...
    import javax.swing.*;
    import java.awt.*;
    import java.beans.*;
    import java.awt.event.*;
    import javax.swing.table.*;
    public class MyTable extends JApplet{
         Object o[] = {"Name","Address","city","Vegetarian"};
         Object data[][] = {
              {"a","a","pune",new Boolean(true)},
              {"Alison", "Huml","mumbai",new Boolean(true)}
         class model extends DefaultTableModel
              model(Object[][] data,Object[] cn)
                   super(data,cn);
              public Class getColumnClass(int i)
                   return getValueAt(0,i).getClass();
              public Object getValueAt(int i,int j)
                   return data[i][j];
         model m = new model(data,o);
         JTable t1 = new JTable(m);
         public void init()
              Container c1 = new Container();
              c1 = getContentPane();
              c1.add(t1);
              TableColumn tc = t1.getColumnModel().getColumn(2);
              JComboBox jc = new JComboBox();
              jc.addItem("Pune");
              jc.addItem("Mumbai");
              jc.addItem("Madras");
              tc.setCellEditor(new DefaultCellEditor(jc));
    bye
    Amol

  • HOW TO ADD NEW VARIABLE DATAS ON ALV REPORT

    Hi gurus,
               I have cretaed one alv report using
    REUSE_ALV_GRID_DISPLAY.
    I HAVE CALCULATED SOME TOTALS AND STORED ON
    ONE VARIABLE .
    that variable name is 'toterror'.
    now i want to add  this variable on first line OF ALV REPORT.
    that is i should get LIKE THIS.
    PERNR   TEXT     ACTION  [ TITLES OF FIELDS ].THEN
    TOTAL ERROR RECORDS  '900'.
    THEN THE CORRESPONDING FIELDS DATA SHOULD BE DISPLAYED.
    HELP ME.
    THANKS IN ADVANCE.

    Hi
    Thanks Ajeet.
    The scenario is that I have to create a formula (contract end date-current date) and have to display the result using exeption to highlight the contracts ending in 30-60 days.
    The problem is that the info provider does not have any infoobject for date(only valid to and validity start date)
    I have created a formula variable on valid to date using replacement path. But dont have any variable to use for current date.
    The only time char in the cube is Fiscal yera variant.
    How should I go futher creating such formula? Shall I user customer exit variable? But I dont have any date char to create on.
    Can you shed some light on this problem
    Thanks

  • How to add check box in the ALV list

    dear Experts,
                 i have a requirement.
    i want show the check boxes in my ALV list.
    can u please give the solution.
    thanks

    TYPE-POOLS: slis.
    *---internal tables
    DATA: BEGIN OF it_flight OCCURS 0,
    SEL, " add a single character field in the final output table
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight,
    *--internal tables for alv
    it_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fcat LIKE LINE OF it_fieldcat,
    layout TYPE slis_layout_alv,
    it_sort type slis_t_sortinfo_alv,
    wa_sort like line of it_sort.
    DATA: BEGIN OF it_flight_sel OCCURS 0,
    SEL,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight_sel.
    data: wa_flight like it_flight.
    In the layout set give the name of the field
    whose checkbox will be created ( SEL as it has 1 char only )
    layout-box_fieldname = 'SEL'.
    *---start-of-selection .
    START-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'IT_FLIGHT'
    i_inclname = sy-repid
    CHANGING
    ct_fieldcat = it_fieldcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2.
    *----get data
    SELECT carrid
    connid
    fldate
    seatsmax
    seatsocc
    FROM sflight
    INTO CORRESPONDING FIELDS OF TABLE it_flight
    UP TO 20 ROWS.
    wa_fcat-do_sum = 'X'.
    MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
    WHERE fieldname = 'SEATSOCC' .
    wa_sort-fieldname = 'CARRID'.
    wa_sort-group = 'UL'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    wa_sort-fieldname = 'CONNID'.
    wa_sort-subtot = 'X'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    is_layout = layout
    it_fieldcat = it_fieldcat
    it_sort = it_sort
    TABLES
    t_outtab = it_flight
    EXCEPTIONS
    program_error = 1.
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
    WHEN '&IC1'.
    Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
    Read data table, using index of row user clicked on
    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    Set parameter ID for transaction screen field
    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    Sxecute transaction ME23N, and skip initial data entry screen
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
    WHEN '&IC1'. "'&DATA_SAVE'. "user presses SAVE
    loop at it_flight into wa_flight.
    if wa_flight-Sel EQ 'X'.
    collecting records in table it_flight_sel to process further
    append wa_flight to it_flight_sel.
    clear wa_flight.
    TYPE-POOLS: slis.
    *---internal tables
    DATA: BEGIN OF it_flight OCCURS 0,
    SEL, " add a single character field in the final output table
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight,
    *--internal tables for alv
    it_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fcat LIKE LINE OF it_fieldcat,
    layout TYPE slis_layout_alv,
    it_sort type slis_t_sortinfo_alv,
    wa_sort like line of it_sort.
    DATA: BEGIN OF it_flight_sel OCCURS 0,
    SEL,
    carrid LIKE sflight-carrid,
    connid LIKE sflight-connid,
    fldate LIKE sflight-fldate,
    seatsmax LIKE sflight-seatsmax,
    seatsocc LIKE sflight-seatsocc,
    END OF it_flight_sel.
    data: wa_flight like it_flight.
    In the layout set give the name of the field
    whose checkbox will be created ( SEL as it has 1 char only )
    layout-box_fieldname = 'SEL'.
    *---start-of-selection .
    START-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'IT_FLIGHT'
    i_inclname = sy-repid
    CHANGING
    ct_fieldcat = it_fieldcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2.
    *----get data
    SELECT carrid
    connid
    fldate
    seatsmax
    seatsocc
    FROM sflight
    INTO CORRESPONDING FIELDS OF TABLE it_flight
    UP TO 20 ROWS.
    wa_fcat-do_sum = 'X'.
    MODIFY it_fieldcat FROM wa_fcat TRANSPORTING do_sum
    WHERE fieldname = 'SEATSOCC' .
    wa_sort-fieldname = 'CARRID'.
    wa_sort-group = 'UL'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    wa_sort-fieldname = 'CONNID'.
    wa_sort-subtot = 'X'.
    wa_sort-up = 'X'.
    APPEND wa_sort TO it_sort.
    clear wa_sort.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    is_layout = layout
    it_fieldcat = it_fieldcat
    it_sort = it_sort
    TABLES
    t_outtab = it_flight
    EXCEPTIONS
    program_error = 1.
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    Check function code
    CASE r_ucomm.
    WHEN '&IC1'.
    Check field clicked on within ALVgrid report
    IF rs_selfield-fieldname = 'EBELN'.
    Read data table, using index of row user clicked on
    READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    Set parameter ID for transaction screen field
    SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    Sxecute transaction ME23N, and skip initial data entry screen
    CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.
    WHEN '&IC1'. "'&DATA_SAVE'. "user presses SAVE
    loop at it_flight into wa_flight.
    if wa_flight-Sel EQ 'X'.
    collecting records in table it_flight_sel to process further
    append wa_flight to it_flight_sel.
    clear wa_flight.
    Please follow the code.

  • How to capture the checkbox status in ALV Grid display

    I need some immediate help regarding Grid ALV.
    My Requirement: I need to display an ALV grid report along with checkboxes. Further, I need to provide an option wherein the user can checkboxes and select the records that I need to process further (by clicking the process button on the ALV Report).
    My Query: The problem here is that I am not able to capture the status of the checkboxes. This means that I am not able to capture which of the records have been selected by checking their resp checkboxes.
    Solutions that I have tried: I have tried capturing the same at user command by checking the value in slis_selfield. But all the records show the value as 1 for the checkbox field.
    Kinldy suggest how to go about it.
    I am not using Object Oriented ALV. Please suggest something to be used in ALV Grid display in 4.6C version.
    Regards,
    Namrata

    Here is a Sample code , it might help you
    TABLES : sflight.
    TYPE-POOLS: slis.
    DATA : w_repid LIKE sy-repid.
    w_repid = sy-repid.
    DATA: BEGIN OF it_sflight OCCURS 0,
      checkbox(1),
      carrid LIKE sflight-carrid,
    END OF it_sflight.
    *layout
    DATA: wa_layout TYPE slis_layout_alv.
    *field catalog
    DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,
              wa_fieldcatalog TYPE slis_fieldcat_alv.
    START-OF-SELECTION.
      SELECT carrid FROM sflight
         INTO CORRESPONDING FIELDS OF TABLE it_sflight.
    END-OF-SELECTION.
      CLEAR it_fieldcatalog.
      REFRESH it_fieldcatalog.
      wa_fieldcatalog-fieldname = 'CHECKBOX'.
      wa_fieldcatalog-outputlen = '3'.
      wa_fieldcatalog-col_pos = '1'.
      wa_fieldcatalog-seltext_m = 'Chk'.
      wa_fieldcatalog-checkbox = 'X'.
      wa_fieldcatalog-edit = 'X'.
      APPEND wa_fieldcatalog TO it_fieldcatalog.
      CLEAR wa_fieldcatalog.
      wa_fieldcatalog-fieldname = 'CARRID'.
      wa_fieldcatalog-outputlen = '10'.
      wa_fieldcatalog-col_pos = '2'.
      wa_fieldcatalog-seltext_m = 'Carrid'.
      APPEND wa_fieldcatalog TO it_fieldcatalog.
      CLEAR wa_fieldcatalog.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = w_repid
          is_layout = wa_layout
          i_callback_user_command = 'USER_COMMAND'
          it_fieldcat = it_fieldcatalog
        TABLES
          t_outtab = it_sflight
        EXCEPTIONS
          program_error = 1
          OTHERS = 2.
    *& Form USER_COMMAND
    FORM user_command USING p_ucomm TYPE sy-ucomm
      p_selfld TYPE slis_selfield.
      CASE p_ucomm.
       WHEN '&DATA_SAVE'.
          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.
          LOOP AT it_sflight WHERE checkbox = 'X'.
             DELETE it_sflight INDEX sy-tabix.
          ENDLOOP.
          p_selfld-refresh = 'X'.
      ENDCASE.
    ENDFORM. "user_command

  • How to add a push button in ALV Grid Top-of-page

    Is it possible to add a push button to the top-of-page in Alv grid display?if yes, then how? I am not using OO ABAP and am using reuse_alv_grid_display with top-of-page event.

    Hi,
    I am not sure whether we can add push button in top-of -page or not. But instead of that if you want to add button on toolbar as per your requirement then follow below link. it will useful.
    http://www.sap-img.com/abap/example-of-a-simple-alv-grid-report.htm
    Ram.

  • How to add excel download button to ALV grid toolbar?

    Hi,
        Im generating ALV output through the method "SET_TABLE_FOR_FIRST_DISPLAY".But in the output,I cant see a direct excel download button,just like how it used to come when we use FM "REUSE_ALV_GRID_DISPLAY". Here, the excel download option comes as part of a drop down on top.But is there any way that I can have a separate excel download button which will be more user friendly for the customer?
    Thanks,
    Mahesh

    Create your own GUI status and add a push button there. In PAI write code for Excel download for that button.
    Regards,
    Amit

  • How to add Custom button to existing ALV toolbar

    Hi,
    I want to add custom buttons for varaints in the existing row PRINT VERSION/EXPORT
    How do we do that?
    Rgds
    Vara

    I have used the standard component u2018salv_wd_tableu2019 in my application and will be able to give example by adding a button named 'NEW__BUTTON' .
    In the WDDOINIT method of the component controller, use the following code to define column name, your own buttons, visible column for the same component usage.
    DATA:
    lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage,
    lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
    *Check ALV component usage
    lr_salv_wd_table_usage = wd_this->wd_cpuse_alv( ).
    IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
    lr_salv_wd_table_usage->create_component( ).
    ELSE.
    lr_salv_wd_table_usage->delete_component( ).
    lr_salv_wd_table_usage->create_component( ).
    ENDIF.
    *Get ALV component
    lr_salv_wd_table = wd_this->wd_cpifc_alv( ).
    wd_this->mr_table type ref to CL_SALV_WD_CONFIG_TABLE.
    *Get ConfigurationModel from ALV Component
    wd_this->mr_table = lr_salv_wd_table->get_model( ).
    *Set table settings
    DATA:
    lr_table_settings TYPE REF TO if_salv_wd_table_settings.
    lr_table_settings ?= wd_this->mr_table .
    lr_table_settings->set_visible_row_count( '5' ).
    lr_table_settings->set_width( '100%' ).
    DATA:
    lr_header TYPE REF TO cl_salv_wd_header,
    l_header_text TYPE string.
    lr_header = lr_table_settings->get_header( ).
    l_header_text = cl_wd_utilities=>get_otr_text_by_alias( 'NEW__BUTTON' ).
    lr_header->set_text( l_header_text ).
    lr_header->set_tooltip( l_header_text ).
    "lr_table_settings->set_selection_mode( cl_wd_table=>e_selection_mode-multi_no_lead ).
    *Set functions
    IF wd_this->mb_no_maintain NE abap_true.
    DATA:
    lr_function TYPE REF TO cl_salv_wd_function,
    lr_fe_button TYPE REF TO cl_salv_wd_fe_button,
    l_btn_text TYPE string.
    *Add the button here for validation on the top of the ALV
    *This is where you add the buttons on the same ROW.
    lr_function = lr_functions->create_function( 'NEW__BUTTON' ).
    CREATE OBJECT lr_fe_button.
    l_btn_text = cl_wd_utilities=>get_otr_text_by_alias( 'NEW__BUTTON' ).
    lr_fe_button->set_text( l_btn_text ).
    lr_fe_button->set_tooltip( l_btn_text ).
    lr_function->set_editor( lr_fe_button ).
    After defining the buttons 'NEW__BUTTON' , handle the actions for the same using the method u2018LIST_ACTIONu2019 which should have the event as u2018ON_FUNCTIONu2019, controller as u2018interface controlleru2019 and component use as the name you have given say u2018ALVu2019.
    In the method u2018LIST_ACTIONu2019, handle the actions as below. This method will have the following importing parameters.
    WDEVENT Importing CL_WD_CUSTOM_EVENT
    R_PARAM Importing IF_SALV_WD_TABLE_FUNCTION
    method list_action .
    case r_param->id .
    when  'NEW__BUTTON'.
    "Do the validation here-"
    endcase.
    endmethod.
    Thanks,
    Rajkumar.S

  • How to add a button to an alv standar report

    Hi all,
    I've got a requiremnt to modify the behaviour of the edit button of the ALV in TX vfx3.
    When the edit button pressed, the requiered behaviour is to navigate to a Z TX. Is it possible to edit the ALV without creating a new Z alv? Just changing the standard?
    Edited by: Iñaki Nolte Usparicha on Dec 29, 2010 12:18 PM

    Hi Iñaki, you have to copy (using transaction SE41) Status-GUI "standard" from program SAPLSALV, with the same name as our program. Delete all unnecessary components and add your custom button.
    In the program you have to add:
    Form F_SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
         SET PF-STATUS 'STANDARD'.
    Endform.
    Form f_user_command USING      r_ucomm LIKE sy-ucomm
                                                                  rs_selfield TYPE slis_selfield.
         CASE r_ucomm.
                  WHEN '%NF'. "NF is the name of the button
                        PERFORM f_do_something.
           ENDCASE.
    Endform.

Maybe you are looking for

  • Bootcamp and Windows XP SP3

    Ok, here goes.  I have a Macbook Pro OS=10.6.8, 2.53gHz Intel Core Duo, 4gb, 1067mHz DDR3.  I am...or was, I should say, running Windows XP SP2++ beautifully (as marginally beautiful as Windows is) using VMware Fusion 3.1.3 thru Bootcamp.  I bought T

  • Error:Account type D is not defined for document type RE

    Hi! I encountered this error msg: "Account type D is not defined for document type RE"  while posting IR in mir6.  What does this error msg mean? Thanks!

  • Resize cl_gui_dialogbox_container SIZE_CONTROL

    Hello, In most object oriented languages I can catch an event using the signal to execute some process. Typical events like mouse clicks and mouse movements are usually implemented. So are resizing events for windows ... I a beginner in ABAP OO progr

  • Cannot connect to 127.0.0.1

    Hello I recently changed from TalkTalk to BT. Since then, I am unable to connect to http://127.0.0.1 which I need to do for web development purposes. I cannot find any information on this. All my connections and ping tests work fine. Any ideas most w

  • What does "Firefox not Responding" mean

    Lately I am getting the message on the top of my screen that says, "FIREFOX NOT RESPONDING." Also, there is the little circle icon that goes around and whatever I click on does not open up. I shut off my computer manually, and when I started it up ag