Button creation in ALV GRID

hi experts,
i have a requirement to create a alv grid report and in the output one column should be editable.(till here every thing is correct what i did)
i have to create a 'update' button to the tool bar of alv output screen so that if i enter my own data in the editable screen,and press 'update' button then my database table should be updated..
can anyone tell me how to create 'update' button and write code for that.
my code is as below:
TABLES: vbak,vbap.
TYPE-POOLS: slis.                                 "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_final,
     vbeln LIKE vbak-vbeln,
     erdat LIKE vbak-erdat,
     matnr LIKE vbap-matnr,
     posnr LIKE vbap-posnr,
     END OF t_final.
DATA: i_final TYPE STANDARD TABLE OF t_final INITIAL SIZE 0,
      wa_final TYPE t_final.
*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.
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   = 'VBELN'.
  fieldcatalog-seltext_m   = 'sales order'.
  fieldcatalog-col_pos     = 0.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'ERDAT'.
  fieldcatalog-seltext_m   = 'date'.
  fieldcatalog-col_pos     = 1.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'MATNR'.
  fieldcatalog-seltext_m   = 'material no.'.
  fieldcatalog-col_pos     = 2.
  fieldcatalog-edit        = 'X'.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'POSNR'.
  fieldcatalog-seltext_m   = 'line item no.'.
  fieldcatalog-col_pos     = 3.
  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-totals_only        = 'X'.
gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                        "click(press f2)
gd_layout-zebra             = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text       = 'helllllo'.
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_top_of_page   = 'TOP-OF-PAGE'  "see FORM
           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                = I_FINAL
       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 avbeln aerdat bmatnr bposnr FROM vbak AS a
  INNER JOIN vbap AS b ON avbeln = bvbeln
  INTO TABLE i_final WHERE avbeln = bvbeln.
ENDFORM.                    " DATA_RETRIEVAL
points will be rewarded.

Hi Nani
TO add a button on alv tool bar and to handle it
u have to use object oriented approach
for this u have to define class and implement class in which u will write code inside the method to hadle particlur event
here is the code for it.
*& Class z_cl_9_u_EVENT_RECEIVER this class contains the definition
of methods for handling events
CLASS  z_cl_9_u_event_receiver DEFINITION DEFERRED.
DATA : event_receiver TYPE REF TO  z_cl_9_u_event_receiver.
*data: create object e1 type ref to cl_alv_event_toolbar_set.
*& Class z_cl_9_u_EVENT_RECEIVER this class contains the definition
of methods for handling events
CLASS z_cl_9_u_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS:
      handle_toolbar
        FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING e_object e_interactive,
      handle_user_command
        FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING e_ucomm.
ENDCLASS.               "z_cl_9_u_EVENT_RECEIVER
CLASSES
CLASS lcl_event_receiver DEFINITION DEFERRED.
*&       Class (Implementation)   z_cl_9_u_EVENT_RECEIVER
      Add a Update Button On ALV-Toolbar and put the logic
      for handing that button
*& Class z_cl_9_u_EVENT_RECEIVER this class contains the implementation
of methods for handling events.
CLASS  z_cl_9_u_event_receiver IMPLEMENTATION.
*& Method HANDLE_TOOLBAR is to handle toolbar.
In event handler method for event TOOLBAR: Append own functions
by using event parameter E_OBJECT.
  METHOD handle_toolbar.
In event handler method for event TOOLBAR: Append own functions
  by using event parameter E_OBJECT.
    DATA: L_T_toolbar  TYPE stb_button.
Append an icon to update tables if country is otherthan NZ.
    IF g_flag = c_x AND g_back NE c_x.
      CLEAR L_T_toolbar.
      MOVE 0 TO L_T_toolbar-butn_type.
      MOVE 'UPDATE' TO L_T_toolbar-function.
      MOVE  icon_modify  TO L_T_toolbar-icon.
      MOVE text-062 TO L_T_toolbar-quickinfo.
      MOVE '' TO L_T_toolbar-text.
      MOVE ' ' TO L_T_toolbar-disabled.
      APPEND L_T_toolbar TO e_object->mt_toolbar.
In a self defined button, you can disable the button with option DISABLED = 'X'
    ELSEIF g_back = c_x.
      CLEAR L_T_toolbar.
      L_T_toolbar-function = 'UPDATE'.
      L_T_toolbar-butn_type = 0.
      L_T_toolbar-icon = icon_modify.
      L_T_toolbar-quickinfo = text-015.
      L_T_toolbar-disabled = 'X'.
      APPEND L_T_toolbar TO e_object->mt_toolbar.
      CLEAR ok_code.
    ENDIF.
  ENDMETHOD.                    "handle_toolbar
*& Method HANDLE_USER_COMMAND does processing based on user inputs.
E_UCOMM has the user command.
  METHOD handle_user_command.
In event handler method for event USER_COMMAND:
    DATA: L_T_Rows TYPE lvc_t_row,
          L_Size TYPE sy-tabix.
    CASE e_ucomm.
      WHEN 'UPDATE'.
        REFRESH L_T_Rows.
        CALL METHOD alv_grid->get_selected_rows
          IMPORTING
            et_index_rows = L_T_Rows.
        CALL METHOD cl_gui_cfw=>flush.
        DESCRIBE TABLE L_T_Rows LINES L_Size.
        IF L_Size IS INITIAL.
          MESSAGE i071.
        ELSE.
       Execute this subroutines to capture the changed data
      in ALV and pass it to Ztables,
          PERFORM f4700_update_table  TABLES L_T_Rows.
          PERFORM f4800_get_changed_data.
          PERFORM f0500_get_analysis_details USING g_socnr g_matnr.
          CALL METHOD alv_grid->refresh_table_display.
        ENDIF.
    ENDCASE.
  ENDMETHOD.                           "handle_user_command
ENDCLASS.
now call these methods wher eever u r calling the alv like in PBO of screen.
IF g_custom_container IS INITIAL.
    g_t_lvc_s_layo-info_fname = c_l_line_colour.
    g_t_lvc_s_layo-no_keyfix = '1'.   "
    CREATE OBJECT g_custom_container
           EXPORTING container_name = 'CONTAINER_DETAIL'.
    CREATE OBJECT alv_grid
           EXPORTING i_parent = g_custom_container.
    CALL METHOD alv_grid->set_table_for_first_display
      EXPORTING
        i_structure_name = 'structre of table'
        is_layout        = g_t_lvc_s_layo
      CHANGING
        it_outtab        = g_t_outtab[]
        it_fieldcatalog  = g_t_fieldcat.
*OLY EN01434 BEGIN
->Create Object to receive events and link them to handler methods.
    CREATE OBJECT event_receiver.
    SET HANDLER event_receiver->handle_user_command FOR alv_grid.
    SET HANDLER event_receiver->handle_toolbar FOR alv_grid.
  ELSE. "SUBSEQUENT ITERATIONS:
F g_custom_container IS INITIAL.
  Layout field 'info-fname' points to the field/column in the
  OUTTAB that controls the colour attribute. (OUTTAB is
  maintained in function Y_DIP_METER_REC_CALCULATION).
    g_t_lvc_s_layo-info_fname = c_l_line_colour.
    g_t_lvc_s_layo-no_keyfix = '1'.   "RSC18Sep02 - allow hor scroll
    CREATE OBJECT g_custom_container
           EXPORTING container_name = 'CONTAINER_DETAIL'.
    CREATE OBJECT alv_grid
           EXPORTING i_parent = g_custom_container.
    CALL METHOD alv_grid->set_table_for_first_display
      EXPORTING
        i_structure_name = 'ZV9NDMRA'
        is_layout        = g_t_lvc_s_layo
      CHANGING
        it_outtab        = g_t_outtab[]
        it_fieldcatalog  = g_t_fieldcat.
*OLY EN01434 BEGIN
->Create Object to receive events and link them to handler methods.
    CREATE OBJECT event_receiver.
    SET HANDLER event_receiver->handle_user_command FOR alv_grid.
    SET HANDLER event_receiver->handle_toolbar FOR alv_grid.
  ELSE. "SUBSEQUENT ITERATIONS:
*********SAVE IMPORT PARMAETER IS ADDED BY NEEC
    PERFORM f4900_set_excluding_buttons." USING sy-dynnr.
    CALL METHOD alv_grid->set_table_for_first_display
      EXPORTING
        i_structure_name     = 'ZV9NDMRA'
        is_layout            = g_t_lvc_s_layo
        it_toolbar_excluding = g_t_toolbar_excl
      CHANGING
        it_outtab            = g_t_outtab[]
        it_fieldcatalog      = g_t_fieldcat.
    CALL METHOD alv_grid->set_toolbar_interactive.
    CALL METHOD alv_grid->refresh_table_display.
I hope it will help to sme extent
Rewards if helpful and if any help required reply back.....
    CALL METHOD alv_grid->set_table_for_first_display
      EXPORTING
        i_structure_name     = 'ZV9NDMRA'
        is_layout            = g_t_lvc_s_layo
        it_toolbar_excluding = g_t_toolbar_excl
      CHANGING
        it_outtab            = g_t_outtab[]
        it_fieldcatalog      = g_t_fieldcat.
    CALL METHOD alv_grid->set_toolbar_interactive.
    CALL METHOD alv_grid->refresh_table_display.

Similar Messages

  • Create standard sap "SAVE" button along with ALV grid buttons

    I need to create a standard SAP "Save" button  in my ALV GRID display in the application tool bard
    I copied the PF-Status 'standard' from a SAP program and assinged it here.
    When i try to add the SAP save buttion by using this standard pf-status , its not getting displayed in the application tool bar.
    But in STandard TOOl bar (in menu painter ) , when i assign save its displayed in the screen .
    I need this to be displayed in the application tool ba
    Please suggest me how to do this.
    Thanks in advance.

    Hello,
      Application of ALV means the place where the buttons(standard for ALV) like sort,add,delete,copy etc are dipslayed.IF u need need to add a save button on the same toolbar/same place u need to copy the standard GUI status of standard ALV program .For that go to SE80 , give the program name as SAPLSLVC_FULLSCREEN
    In the GUI status u'll find the status named as STANDARD_FULLSCREEN ....Right click on it and give the "TO Program " as your program.Now once u activate ur program u'll find the same status there.
    add ur save button in the status by edidting it. Now u need to write the FORM ENDFORM for user command and assign the form name in caps to the USER_COMMAND parameter in the func module REUSE_ALV_GRID_DISPLAY.
    Hope this help.
    Regards,
    Neeraj

  • How can we add a button on our ALV Grid

    Hello,
    I need to add a button on the ALV Grid and write a code on that button to download a file on the desktop of the user's machine.
    How can we write a code for the same and what would be the syntax of that code.

    Hi,
    you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.
    ENTER SAPLKKBL PROGRAM
    STATUS STANDARD.
    exexute.
    select standard  check box. copy to your zprogram and your gui status.
    Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.
    then go to se 38 double click on pf status .it goes to me41 screen .
    there you can add your button along with predefined buttons on application toolbar.
    then write code for button using user command event.
    Code:
    Form Set_pf_status
    Notes: Called by FM REUSE_ALV_GRID_DISPLAY
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD'.
    ENDFORM. "Set_pf_status
    In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called '%DELETE'.
    3). Create the following report:
    Code:
    Form User_command
    Notes: Called by FM REUSE_ALV_GRID_DISPLAY
           Detects whether the icon/button for
           'Return Tag Deletion' has been pressed. If it has then
           detect whether any rows have been highlighted and then
           set the delete flag.
    FORM user_command USING r_ucomm     LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
    DATA: li_count TYPE I.
    IF r_ucomm EQ '%DELETE'.
      LOOP AT %g00 WHERE mark EQ 'X'.
        ADD 1 TO li_count.
      ENDLOOP.
      IF li_count GT 0.
        gc_delete_flag = 'X'.
        r_ucomm = '&F03'. "Back arraow
      ELSE.
        MESSAGE W000 WITH 'Please highlight the rows to be deleted!'.
      ENDIF.
    ENDIF.
    ENDFORM.  "User_command
    *reward points if usefull

  • Can we disable the default push buttons on the ALV Grid

    Hi,
        Can we disable the default push buttons on the ALV
    Grid Control...
        If so, pls send me the procedure...
    thanks and regards
       raghu

    Hi,
    In the PBO:
      PERFORM f9100_exclude_functions USING :
                             i_exclude[]  '&CHECK',
                             i_exclude[]  '&REFRESH',
                             i_exclude[]  '&LOCAL&CUT' ,
                             i_exclude[]  '&LOCAL&COPY',
                             i_exclude[]  '&LOCAL&PASTE',
                             i_exclude[]  '&LOCAL&PASTE_NEW_ROW',
                             i_exclude[]  '&LOCAL&UNDO' ,
                             i_exclude[]  '&LOCAL&APPEND',
                             i_exclude[]  '&LOCAL&INSERT_ROW',
                             i_exclude[]  '&LOCAL&DELETE_ROW',
                             i_exclude[]  '&SORT_ASC',
                             i_exclude[]  '&SORT_DSC',
                             i_exclude[]  '&FIND',
                             i_exclude[]  '&SUMC',
                             i_exclude[]  '&SUBTOT',
                             i_exclude[]  '&MINIMUM',
                             i_exclude[]  '&MAXIMUM' ,
                             i_exclude[]  '&VGRID' ,
                             i_exclude[]  '&VEXCEL' ,
                             i_exclude[]  '&VCRYSTAL',
                             i_exclude[]  '&HTML',
                             i_exclude[]  '&MAINTAIN',
                             i_exclude[]  '&SAVE',
                             i_exclude[]  '&GRAPH',
                             i_exclude[]  '&HELP',
                             i_exclude[]  '&ALL' ,
                             i_exclude[]  '&SAL' .
    *                         i_exclude[]  '&EXCLALLFC'.
    *&      Form  f9100_exclude_functions
    * This form exclude buttons  from the toolbar.
    *      -->P_IEXCLUDE  text
    *      -->P_1150   text
    FORM f9100_exclude_functions USING   pexclude LIKE i_exclude
                                   value(pfunction).
      DATA: l_exclude TYPE ui_func.
      l_exclude = pfunction.
      APPEND l_exclude TO pexclude.
    ENDFORM.                    " f9100_exclude_functions
    This will exculde the default push buttons.
    Let us know if it works for you.
    Regards,
    Anjali

  • How to add a push button on an ALV grid  ?

    Hi,
    How to add a push button on an ALV grid, using ON_TOOLBAR, ON_USERCOMMAND Methods. Clicking on that push button, a new screen has to be displayed.

    Hi,
            Assuming that you want to have a "push-button" column, i.e. push-buttons within an ALV grid then you need to implement the following steps:
    (1) Set the style of the column as button
      ls_fcat-style = CL_GUI_ALV_GRID => MC_STYLE_BUTTON.
    (2) When the user pushes the button event BUTTON_CLICK is triggered. Thus, define an appropriate event handler method.
    <b>Reward points</b>
    Regards

  • How to add the REFRESH button in OOPs ALV grid

    how to add the REFRESH button in OOPs ALV grid

    Hi Naidu.
    Check the below code:
    Local Class Definition and implementation For events handeling
    CLASS LCL_EVENT DEFINITION .
      PUBLIC SECTION.
        METHODS :TOOLBAR FOR EVENT TOOLBAR OF  CL_GUI_ALV_GRID
                         IMPORTING E_OBJECT,
                 USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                         IMPORTING E_UCOMM.
    ENDCLASS.    
    CLASS LCL_EVENT IMPLEMENTATION.
      METHOD TOOLBAR.
        WA_TOOL-FUNCTION = 'ZFC1'.
        WA_TOOL-TEXT     = 'TEST'.
        WA_TOOL-ICON     = '@EA@'.
        APPEND WA_TOOL TO E_OBJECT->MT_TOOLBAR.
      ENDMETHOD.             "DISPLAY
      METHOD USER_COMMAND.
        IF E_UCOMM = 'ZFC1'.
              ENDIF.
      ENDMETHOD.                    "USER_COMMAND
    ENDCLASS.                    "LCL_EVENT IMPLEMENTATION
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'ZALV_BTON'.
      SELECT * FROM VBAK INTO TABLE GT_VBAK
               UP TO 30 ROWS.
    **** CREATE CONTAINER OBJECT
      CREATE OBJECT MY_CONTAINER
        EXPORTING
          CONTAINER_NAME              = 'CC1'
         EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6 .
    ****** GRID TO CONTAINER
      CREATE OBJECT ALV
          EXPORTING
          I_PARENT          = MY_CONTAINER
         EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5.
      CREATE OBJECT OBJ.
      SET HANDLER : OBJ->TOOLBAR FOR ALV.
      SET HANDLER : OBJ->USER_COMMAND FOR ALV.
    ****** ALV DISPLAY
      CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'VBAK'
        CHANGING
          IT_OUTTAB                     = GT_VBAK[]
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
    *       text
    MODULE USER_COMMAND_0200 INPUT.
      IF SY-UCOMM EQ 'BACK'.
        LEAVE PROGRAM.
      ENDIF.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    Regards
    Kumar M

  • Radio button in dynamic ALV grid

    Hi guys!
    I want to implement a dynamical ALV grid with a radiobutton in the first column.
    when clicking a button, or processing the program i want to get the information of the selected row and perform other things....
    Can someone help me with a code example for this, or just tell me where i can find the necessary information`?
    regards
    thomas

    Hi,
    I dont understand why you need Radio button, If you use REUSE_ALV_GRID_DISPLAY the output grid will by default allow you to select only one row.
    see the program - BCALV_FULLSCREEN_DEMO for more information

  • How can I hide the marker button in an ALV GRID line?

    Hi all,
    I am switching an old program from ALV LIST to ALV GRID. In the old list, I put a checkbox on each line to abilify the user to mark some lines. However, there are some lines that I don't want the user to select. In the list, I set the field for the box name to "*" (asterisk) and in the list, the checkbox is not input enabled.
    Now in the grid, this does not function any more. all lines are markable. How can I deactivate the marker function for some lines?
    Greetings
    Jörg

    Hi,
         use the below snippet in your code
      DATA: ls_celltab TYPE lvc_s_styl.
      REFRESH pt_celltab.
      IF p_mode EQ text-103.
    *§2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
       to status "editable".
        ls_celltab-fieldname = c_character1.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = c_character2.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = c_character3.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = text-107.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = c_selectionid.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
        INSERT ls_celltab INTO TABLE pt_celltab.
    Regards

  • Need new button's on ALV grid

    Hi All,
    I  have to select all / deselect all records from alv out put, how to add those buttonds to alv grid..
    Regards,
    DSK

    Hi Suresh,
    Try this program. It works.
    REPORT ztest_notepad.
    DATA: BEGIN OF it_t100 OCCURS 0,
            checkbox LIKE abgr-kzart,
            arbgb    LIKE t100-arbgb,
            msgnr    LIKE t100-msgnr,
            text     LIKE t100-text,
          END OF it_t100.
    DATA:program TYPE sy-repid VALUE sy-repid.
    TYPE-POOLS slis.
    DATA:it_fieldcat TYPE slis_t_fieldcat_alv,
         wa_fieldcat LIKE LINE OF it_fieldcat.
    DEFINE fieldcatalog. "Macro defining.
      wa_fieldcat-fieldname = &1.
      wa_fieldcat-tabname   = 'IT_T100'.
      wa_fieldcat-checkbox  = &2.
      wa_fieldcat-edit      = &3.
      wa_fieldcat-seltext_m = &4.
      append wa_fieldcat to it_fieldcat.
      clear  wa_fieldcat.
    END-OF-DEFINITION.
    START-OF-SELECTION.
      SELECT * FROM t100 INTO TABLE it_t100 UP TO 100 ROWS.
      fieldcatalog: 'CHECKBOX' 'X' 'X' 'CHECKBOX',
                    'ARBGB'    ''  ''  'ARBGB'   ,
                    'MSGNR'    ''  ''  'MSGNR'   ,
                    'TEXT'     ''  ''  'TEXT'    .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = program
          i_callback_pf_status_set = 'PF_STATUS_SET'
          i_callback_user_command  = 'USER_COMMAND'
          it_fieldcat              = it_fieldcat
        TABLES
          t_outtab                 = it_t100.
    *&      Form  PF_STATUS_SET
    FORM pf_status_set USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'STATUS' EXCLUDING rt_extab.
    ENDFORM.                    "PF_STATUS_SET
    *&      Form  user_command
    FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield.
      IF ucomm = 'SEL_ALL'.
        LOOP AT it_t100.
          it_t100-checkbox = 'X'.
          MODIFY it_t100 INDEX sy-tabix.
        ENDLOOP.
        selfield-refresh = 'X'.
      ELSEIF ucomm = 'DESEL_ALL'.
        LOOP AT it_t100.
          it_t100-checkbox = space.
          MODIFY it_t100 INDEX sy-tabix.
        ENDLOOP.
        selfield-refresh = 'X'.
      ENDIF.
    ENDFORM.                    "user_command
    Thanks
    Venkat.O

  • Back button issue in ALV Grid(Factory method)

    Hi All,
    I have displayed a report using factory method(CL_SALV_TABLE).In that i have added buttons in application bar too.So when clicking on refresh button ALV should display again with latest number of records,that is working fine but when clicking on back button it should go to selection screen instead of that it is going a step back and displaying previous list of grid and then back and then selection screen.
    Can any one help me how to directly go to input selection screen instead of going step back...
    Regards,
    Ram

    HI,
    Use this syntax (CALL SELECTION-SCREEN 1000)...Try this one
    regards,
    balaji

  • How to remove the select button from the alv grid

    Hi,
    I am using the Function modules for alv report,
    My 1st field in the list is checkbox,
    User can select the checkbox for further process.
    My problem is I want to remove the standards select option from alv.
    I have searched in slis_layout_alv for any option, but I could not.
    Please help me.
    Regards
    Rajan

    HI
      Exclude process options from ALV
        PERFORM alv_excl. ( g_r_excl     TYPE  ui_functions  . )
    FORM alv_excl.
      APPEND cl_gui_alv_grid=>mc_mb_sum          TO  g_r_excl.
      APPEND cl_gui_alv_grid=>mc_mb_subtot       TO  g_r_excl.
      APPEND cl_gui_alv_grid=>mc_fc_graph        TO  g_r_excl.
      APPEND cl_gui_alv_grid=>mc_fc_info         TO  g_r_excl.
      APPEND cl_gui_alv_grid=>mc_fc_print_back   TO  g_r_excl.
    ENDFORM.                    " alv_excl
    CALL METHOD g_r_grid->set_table_for_first_display
              EXPORTING
                is_layout                     = g_r_layo
                is_variant                    = g_r_variant
                it_toolbar_excluding       = g_r_excl
                i_save                        = 'X'
              CHANGING
                it_outtab        = g_t_yetprint[]
                it_fieldcatalog  = g_t_fieldcat.
    Options appended in g_r_excl, will be excluded from ALV
    Praveen

  • Urgent  :  code for the change/display button in the ALV Grid control

    Hi gurus,
    Here i have the following situation,
    I must place a button which should work as both change/display,
    first click should be change and the next click should be display,
    when i click for the first time the row/rows selected should be locked and when again click on the same button that should be unlocked.
    If you have the solution please come back with the solution.
    Bharath Kumar<b></b>

    Hi,
    try this
    *&      Form  SET_PF_STATUS
          text
         -->EXTAB      text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
    DATA GIT_FCODE TYPE TABLE OF SY-UCOMM.
      IF GIT_ITEMS IS INITIAL.   ( you have to maintain a counter )
    ( like data: g_count type i.
    and if it is divisible by 2 then display
    other wise change.
        CLEAR GIT_FCODE.
        APPEND 'CHANGE' TO GIT_FCODE.
        SET PF-STATUS 'ZPF_STATUS' EXCLUDING GIT_FCODE.
      ELSE.
        CLEAR GIT_FCODE.
        APPEND 'DISP' TO GIT_FCODE.
        SET PF-STATUS 'ZPF_STATUS' EXCLUDING GIT_FCODE.
      ENDIF.
    thanks & regards,
    Venkatesh

  • How to create and assign a help document to INFO button on ALV grid

    Hi All,
    Can somebody tell me how to create an 'END USER DOCUMENTATION' document and the 'FUNCTION MODULE' to call it and display in the form of F1 help screen.
    OR
    Is there any standard method to call & display a help document, when the user clicks the INFO(i) button on the ALV grid standard toolbar?
    Thanks in advance.
    Rkumar

    Hello Rkumar
    If you have defined a documentation for your ALV report which you want to display when the INFO button is pushed you can use the following coding:
    CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'           
        EXPORTING                                  
             DOKCLASS           = 'RE'                                          " = report
             DOKNAME            = '<name of your ALV report>'
             SHORT_TEXT         = 'X'              
        EXCEPTIONS                                 
             OTHERS             = 1.     
    Regards
      Uwe

  • Push button in ALV Grid Display

    Hi all,
    I have a requirement wherin i need to place a button in the ALV Grid Display which should update all the records whatever are displayed in the specified infotype. This is to be done in a report.
    Can anybody give me any pointers or sample code for the above query.
    Regards,
    Amrita

    Simply add a button on your GUI status. Then when pushed, code your logic for update IT0008.
    AT USER-COMMAND event block will be triggered when you press your button.
    AT USER-COMMAND.
      if sy-ucomm = 'PUSHBUTTON'.    "here comes function code of your pushbutton
         "update your diplayed records
      endif.

  • ALV GRID Export to Excel button Missing

    HI All,
    I am facing some problem with ALV GRID. When excuting the report with my user id I am able to see the 'Export to Local file' button in the ALV GRID where as if i am excuting with another user id which is having less authorisations than the button is greyed out.  I checked by giving all authorisation than we are able to see the button.
    Could anyone please tell me which authorisation object we have to assign to see the buttons.
    Thanks & Regards,
    Murali.

    Hi,
    Before clicking on the Export to Excel button, start the debugging session by placing the command /H in the command prompt.
    Now, put the break point at statement AUTHORITY-CHECK. Now it will trigger all the authorization objects relevant to this.
    check the sy-subrc value gets failed.
    Regards,
    Santhosh.

Maybe you are looking for

  • Management Console Doesn't Display

    Hi Experts , we are facing issue with Management Console doesn't display after login ,none of the screens shows any user or activity data. Our DB admin went through the prerequisite list from note 1262933 and everything appears to be correct with the

  • Where is libstreamanalyzer.so.0 ??

    On kde4, I had some libraries missing. Probably I made some error, but I cant retrace it back. I could reinstall all of them, except  'libstreamanalyzer.so.0'. When I run Kmail, konsole, kopete I get: kmail: error while loading shared libraries: libs

  • Query Regarding SM30

    Dear all, I have created table maintance generator for 1 ztable. When i see it through t-code sm30.. In this user maintance screen , some columns are displaying without heading name ? So , please anybody help me regarding it........  Thank You ,

  • What are some ways to hook my imac to my tv

    I am looking for some ways to hook my G5+isight to my tv.  im not really sure what kind of cables to buy.  i would like not to have to move my comp but the only way i found for that would be the apple tv, am i right? my tv has all kinds of diff conne

  • Anand SELECT current_scn, SYSTIMESTAMP FROM v$database;

    How to rectify this error in 10g SELECT current_scn, SYSTIMESTAMP FROM v$database; ora 0942: table or view does not exist given grant create table,session grant resource connect given