How to disable self defined button from ALV Toolbar when ok_code ='BACK'

here is the code
CLASS Z_CL_6_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.         
CLASS  Z_CL_6_U_EVENT_RECEIVER IMPLEMENTATION.
  METHOD HANDLE_TOOLBAR.
DATA: LS_TOOLBAR  TYPE STB_BUTTON.
IF G_FLAG = 'X' and ok_code = space.
      CLEAR LS_TOOLBAR.
       MOVE 0 TO LS_TOOLBAR-BUTN_TYPE.
      MOVE 'UPDATE' TO LS_TOOLBAR-FUNCTION.
      MOVE  ICON_MODIFY  TO LS_TOOLBAR-ICON.
      MOVE 'Update Records'(111) TO LS_TOOLBAR-QUICKINFO.
      MOVE ''(112) TO LS_TOOLBAR-TEXT.
      MOVE ' ' TO LS_TOOLBAR-DISABLED.
      APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
elseif ok_code = 'BACK'.
      CLEAR LS_TOOLBAR.
  LS_TOOLBAR-function = 'UPDATE'.
  LS_TOOLBAR-butn_type = 0.
  LS_TOOLBAR-icon = ICON_MODIFY.
  LS_TOOLBAR-quickinfo = 'Update Records'.
  LS_TOOLBAR-disabled = 'X'.
  append LS_TOOLBAR TO <i><b>E_OBJECT</b></i>->MT_TOOLBAR.
ENDIF.
  ENDMETHOD. 
<i><b>ERROR COMES when ok_code is 'BACK'.
at this point E_OBJECT has null reference instead of ref to Class cl_ALV_EVENT_TOOLBAR_SET.</b></i> 
tell me why this error coming.
pls help

Hello Neetu
To give you an example I have copied sample report BCALV_GRID_DEMO, added some code (search for <b>$Comment</b>) and modified the GUI-status <b>MAIN100</b> (replace function code EXIT with <b>BACK</b> for the F3 function).
Run the program and push several times the BACK button: one toolbar function after the other will be inactivated.
PROGRAM test.
DATA: ok_code LIKE sy-ucomm,
      gt_sflight TYPE TABLE OF sflight,
      g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
      grid1  TYPE REF TO cl_gui_alv_grid,
      g_custom_container TYPE REF TO cl_gui_custom_container.
<b>----
      CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
  PUBLIC SECTION.
    CLASS-DATA:
      md_cnt    TYPE i.
    CLASS-METHODS:
      handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
        IMPORTING
          e_object
          e_interactive
          sender.
ENDCLASS.                    "lcl_eventhandler DEFINITION
      CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
  METHOD handle_toolbar.
    DATA:
      ls_button    TYPE stb_button.
    ADD 1 TO md_cnt. " a simple counter
    LOOP AT e_object->mt_toolbar INTO ls_button FROM 1 TO md_cnt.
      ls_button-disabled = 'X'.
      MODIFY e_object->mt_toolbar FROM ls_button.
    ENDLOOP.
  ENDMETHOD.                    "handle_toolbar
ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION</b>
START-OF-SELECTION.
*       MAIN                                                          *
  SELECT * FROM sflight INTO TABLE gt_sflight.
  CALL SCREEN 100.
*       MODULE PBO OUTPUT                                             *
MODULE pbo OUTPUT.
  SET PF-STATUS 'MAIN100'.
  IF g_custom_container IS INITIAL.
    CREATE OBJECT g_custom_container
           EXPORTING container_name = g_container.
*   Instantiate ALV grid control
    CREATE OBJECT grid1
           EXPORTING i_parent = g_custom_container.
    CALL METHOD grid1->set_table_for_first_display
      EXPORTING
        i_structure_name = 'SFLIGHT'
      CHANGING
        it_outtab        = gt_sflight.
<b>*$Comment: Set event handler for event TOOLBAR
    SET HANDLER:
      lcl_eventhandler=>handle_toolbar FOR grid1.
  ENDIF.</b>
ENDMODULE.                    "PBO OUTPUT
*       MODULE PAI INPUT                                              *
MODULE pai INPUT.
*   to react on oi_custom_events:
  CALL METHOD cl_gui_cfw=>dispatch.
  CASE ok_code.
    WHEN 'EXIT'.
      PERFORM exit_program.
<b>    WHEN 'BACK'.
$Comment: Toolbar can be modified on-the-fly
      grid1->set_toolbar_interactive( ).</b>
    WHEN OTHERS.
*     do nothing
  ENDCASE.
  CLEAR ok_code.
ENDMODULE.                    "PAI INPUT
*       FORM EXIT_PROGRAM                                             *
FORM exit_program.
*  CALL METHOD G_CUSTOM_CONTAINER->FREE.
*  CALL METHOD CL_GUI_CFW=>FLUSH.
  LEAVE PROGRAM.
ENDFORM.                    "EXIT_PROGRAM
Regards
  Uwe

Similar Messages

  • How to create user defined button in alv report

    how to create user defined button in alv report
    thnks in advance.

    Hi,
    U can define it the the PF-STATUS ( Menu for ALV ).
    For that u have to define it in the EVENTCAT.
    form z_eventcat  using    p_i_eventcat type slis_t_event.
      data: i_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
        exporting
          i_list_type     = 0
        importing
          et_events       = p_i_eventcat
        exceptions
          list_type_wrong = 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.
      clear i_event.
      read table p_i_eventcat with key name = slis_ev_top_of_page into
      i_event.
      if sy-subrc = 0.
        move 'TOP_OF_PAGE' to i_event-form.
        append i_event to p_i_eventcat.
      endif.
      read table p_i_eventcat with key name = slis_ev_pf_status_set into i_event.
      if sy-subrc = 0.
        move 'SET_PF_STATUS' to i_event-form.
        append i_event to p_i_eventcat.
      endif.
      clear i_event.
      read table p_i_eventcat into i_event with key name = slis_ev_user_command .
      if sy-subrc = 0.
        move 'USER_COMMAND' to i_event-form.
        append i_event to p_i_eventcat.
      endif.
    And in the DISPLAY
    call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
         i_callback_program                = v_progname
         i_callback_pf_status_set          = 'SET_PF_STATUS'
         i_callback_user_command           = 'USER_COMMAND'
         i_callback_top_of_page            = 'TOP_OF_PAGE'
         i_grid_title                      = v_gridtitle
         i_save                            = 'A'
         is_layout                         = i_layout
         it_fieldcat                       = i_fieldcat[]
         it_sort                           = i_sortinfo
         it_events                         = i_eventcat
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        tables
          t_outtab                          = it_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.
    *MENU SETTINGS.
    form set_pf_status using rt_extab type slis_t_extab.
      set pf-status 'ALV_MENU'.
    endform.                    "SET_PF_STATUS
    endform.                    " Z_EVENTCAT
    Now double click on ALV MENU nad u can create a button in the application bar.
    Regards,
    Pritha.

  • Hide 'Change Layout' button from alv toolbar

    Hello All,
    can anyone let me know how can we hide the change layout button or exclude the change layout button from the ALV tool bar using OOPS . what's the fcode for it.
    Thank You !
    Ravi

    Hi Ravi,
    Please refer to this [Program|http://www.saptechies.com/disable-some-standard-buttons-from-alv-display/].
    Hope this helps.
    Regards,
    Chandravadan

  • Disable some standard buttons from ALV display

    Hello All,
    I am creating an ALV display using object oriented approach. I know how to exclude some of the standard function buttons from the list.
    But suppose instead of deleting, the requirement is to disable (I mean grayed out)
    some standard buttons from ALV. Could anyone please comment on how to do this.
    Many thanks in advance.
    Regards
    Indrajit

    Hello Indrajit
    The following sample reports shows how to disable toolbar functions. Run the report and the push the ENTER button repeatedly.
    *& Report  ZUS_SDN_ALV_EVT_TOOLBAR
    *& This sample report explains the handling of event TOOLBAR in order
    *% to activate or inactive buttons of the ALV toolbar.
    *& Based on: BCALV_GRID_DEMO
    *& Procedure: Copy BCALV_GRID_DEMO and replace entire coding  OR
                copy screen '0100' and GUI status 'MAIN100' from
                BCALV_GRID_DEMO to this report.
    REPORT  zus_sdn_alv_evt_toolbar.
    TYPE-POOLS: abap, cntb, icon.
    DATA:
      ok_code                TYPE ui_func,
      gt_sflight             TYPE TABLE OF sflight,
      g_container        TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
      g_grid1               TYPE REF TO cl_gui_alv_grid,
      g_custom_container    TYPE REF TO cl_gui_custom_container.
    PARAMETERS:
      p_inact    RADIOBUTTON GROUP grp1  DEFAULT 'X',  " delete buttons
      p_dele     RADIOBUTTON GROUP grp1.               " inactivate buttons
    PARAMETERS:
      p_newbut   AS CHECKBOX  DEFAULT ' ',  " add new button
      p_newddm   AS CHECKBOX  DEFAULT 'X'.  " add dropdown menu
          CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_cnt    TYPE i.
        CLASS-METHODS:
          handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING
              e_object
              e_interactive
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
          CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_toolbar.
    § 2.In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
        DATA:
          ls_toolbar  TYPE stb_button,
          ls_menu     type STB_BTNMNU.
    E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
    This class has got one attribute, namly MT_TOOLBAR, which
    is a table of type TTB_BUTTON. One line of this table is
    defined by the Structure STB_BUTTON (see data deklaration above).
    A remark to the flag E_INTERACTIVE:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            'e_interactive' is set, if this event is raised due to
            the call of 'set_toolbar_interactive' by the user.
            You can distinguish this way if the event was raised
            by yourself or by ALV
            (e.g. in method 'refresh_table_display').
            An application of this feature is still unknown...
        ADD 1 TO md_cnt. " a simple counter
      (1.a) Inactivate toolbar buttons
        IF ( p_inact = abap_true ).
          LOOP AT e_object->mt_toolbar INTO ls_toolbar FROM 1 TO md_cnt.
            ls_toolbar-disabled = 'X'.
            MODIFY e_object->mt_toolbar FROM ls_toolbar.
          ENDLOOP.
      (1.b) Delete toolbar buttons
        ELSE.
          DO md_cnt TIMES.
            DELETE e_object->mt_toolbar INDEX 1.
          ENDDO.
        ENDIF.
      (2) Add new button
        IF ( p_newbut = abap_true ).
        Add separator to separate default and new buttons
          CLEAR: ls_toolbar.
          ls_toolbar-butn_type = cntb_btype_sep.  " separator
          APPEND ls_toolbar TO e_object->mt_toolbar.
        Add new button "DETAIL"
          CLEAR: ls_toolbar.
          ls_toolbar-function  = 'DETAIL'.
          ls_toolbar-icon      = icon_detail.
          ls_toolbar-quickinfo = 'QuickInfo'.
          ls_toolbar-butn_type = cntb_btype_button.
          ls_toolbar-disabled  = abap_false.
          ls_toolbar-text      = 'Details'.
         ls_toolbar-checked = ' '.
          APPEND ls_toolbar TO e_object->mt_toolbar.
        ENDIF.
      (3) Add new dropdown menu
        IF ( p_newddm = abap_true ).
        Add separator to separate default and new buttons
          CLEAR: ls_toolbar.
          ls_toolbar-butn_type = cntb_btype_sep.  " separator
          APPEND ls_toolbar TO e_object->mt_toolbar.
        Add new dropdown menu "DETAIL"
          CLEAR: ls_toolbar.
          ls_toolbar-function  = 'DDMENU'.
          ls_toolbar-icon      = icon_detail.
          ls_toolbar-quickinfo = 'QuickInfo'.
          ls_toolbar-butn_type = cntb_btype_dropdown.
          ls_toolbar-disabled  = abap_false.
          ls_toolbar-text      = 'DD-Menu'.
         ls_toolbar-checked = ' '.
          APPEND ls_toolbar TO e_object->mt_toolbar.
        ENDIF.
      ENDMETHOD.                    "handle_toolbar
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
          MAIN                                                          *
      SELECT * FROM sflight INTO TABLE gt_sflight.
      CALL SCREEN 100.
    END-OF-SELECTION.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
               EXPORTING container_name = g_container.
      Instantiate ALV grid control
        CREATE OBJECT g_grid1
               EXPORTING i_parent = g_custom_container.
        CALL METHOD g_grid1->set_table_for_first_display
          EXPORTING
            i_structure_name = 'SFLIGHT'
          CHANGING
            it_outtab        = gt_sflight.
      Set event handler for event TOOLBAR
        SET HANDLER:
          lcl_eventhandler=>handle_toolbar FOR g_grid1.
      ENDIF.
    $Comment: Toolbar can be modified on-the-fly
      g_grid1->set_toolbar_interactive( ).
    ENDMODULE.                    "PBO OUTPUT
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      to react on oi_custom_events:
      CALL METHOD cl_gui_cfw=>dispatch.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN OTHERS.
        do nothing
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                    "PAI INPUT
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    CALL METHOD G_CUSTOM_CONTAINER->FREE.
    CALL METHOD CL_GUI_CFW=>FLUSH.
      LEAVE PROGRAM.
    ENDFORM.                    "EXIT_PROGRAM[/code]
    Regards
      Uwe

  • How to remove a Sort button from ALV List

    Hi Experts,
    How to remove sort button from ALV List.
    I have requirement where I need to remove the sort button from ALV list.
    Kindly give me useful clues.
    Higher points will be awarded for the useful inputs.
    Thanks in Advance,
    Dharani

    Hi dharani,
    1. UP and Down Sort Button will get removed.
    2. Important code is marked in bold
    3. Just copy paste.
    4.
    report abc.
    TYPE-POOLS : slis.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvfcwa TYPE slis_fieldcat_alv.
    <b>data : excl type SLIS_T_EXTAB.
    data : exclwa type SLIS_EXTAB.</b>
    data : begin of itab occurs 0.
            include structure usr02.
    data : end of itab.
    START-OF-SELECTION.
      select * from usr02
      into table itab.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-repid
          i_internal_tabname     = 'ITAB'
          i_inclname             = sy-repid
        CHANGING
          ct_fieldcat            = alvfc
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
    <b>*----
    IMPORTANT
    fcodes to remove
    Up and Down Sort Button
    exclwa-fcode = '&OUP'.
    append exclwa to excl.
    exclwa-fcode = '&ODN'.
    append exclwa to excl.</b>
    Display
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          it_fieldcat   = alvfc
          <b>IT_EXCLUDING     = excl</b>
        TABLES
          t_outtab      = itab
        EXCEPTIONS
          program_error = 1
          OTHERS        = 2.
    regards,
    amit m.

  • How to disable the custom button on alv?

    Hi All,
                       i created a ALV Report .I created a Custom Button on ALV.Based on the input value i need to enable/disable  that Button.
    How can i achieve?And what are the methods i need to code?
    Regards
    Ravi

    Hi Ravi,
       You create the button like this:
    Data: mr_functions type ref to IF_SALV_WD_FUNCTION_SETTINGS,
             mr_button_func type ref to CL_SALV_WD_FUNCTION
      mr_functions ?=  mr_alv_model.
      CALL METHOD mr_functions->create_function
        EXPORTING
          id    = '<<Button Id>>'
        RECEIVING
          value = mr_button_func.
      CREATE OBJECT mr_button.
      mr_button->set_text( 'some text' ).
      mr_button_func->set_editor( mr_button ).
    to sent enable/disable
    mr_button->set_enabled(abap_false).
    hope this will serve your purpose.
    Regards,
    Ritwik.

  • How to disable user defined buttons

    hi,
    how to disable userdefined buttons in alv in webdynpro abap.
    thanks and regards,
    Sridevi.D

    Hi,
    Create attribute in context to control enabling/disabling action of a button. Bind this attribute to button. In some action method populate this attibute with boolean values.
    Reward point if useful.
    Regards,
    Karthick S

  • Make self defined function on ALV toolbar invisible

    Hello Experts,
    I have defined a self defined function dropdown on standard ALV toolbar on the Lead select event  and defined the function too.
    But I want at some condition the dropdown should disappear. How can I set the drop down on the ALV toolbar to invisible.
    Please suggest.
    Thanks and Best Regards,
    Sahil

    While defining the drop down, just bind the visible property to a context node attribute of type WDUI_VISIBILITY and set it based on your requirement.
    Manas Dua

  • How to trap Append row fcode from ALV toolbar in OOPS approache

    Hi
    1. I would like trap the function code for ALV toolbar button like APPEND row and Delete row etc. Please let the procedure for that or may be if somebody can tell me that how do what logic is being  followed while appending a line to the grid using "Insert Row" in BCALV_TEST_GRID_EDITABLE program.
    2. My is editable ALV grid, if i pressing the delete button from the keyboard then it is deleting the from the ALV.I would like to prevent from not deleting the rows.
    Thanks
    Suruchi

    how did you resolve it?
    thank in advance.

  • How to disable the radio buttons in alv lsit .

    hi experts ,
    i created one alv list using oops alv . in list three radio buttons . i used code for that in fieldcat-icon = 'x' .
    then in internal table i passed radiobutton icon . using this code i get a radio buttons on list correct .
    but when iam displaying the alv list . i some rows i want radio buttons in disable mode .
    can any one explain

    Tiberiu,
    I think you need to change the webdynpro for java code using NWDI
    Thanks
    Bala Duvvuri

  • How to add Change Layout Button to ALV Toolbar?

    Hi All,
    I am using a SAP GUI STATUS 'STANDARD' that has almost all the funcationality needed except for the change layout button.
    I have tried changing the GUI STATUS to 'STANDARD_FULLSCREEN' which has the button I am looking for but it does not show up.
    What am I missing to have the 'Change Layout' Button show on the toolbar?
    thank you

    I am using Classes.
    I did not specify any type of table of 'exclude' buttons.
    here is my code that display the ALV
    DATA gr_alv TYPE REF TO cl_salv_table.
    DATA gr_functions TYPE REF TO cl_salv_functions_list.
    DATA gr_selections TYPE REF TO cl_salv_selections.
    DATA gr_events TYPE REF TO cl_salv_events_table.
    DATA gr_settings TYPE REF TO cl_salv_display_settings.
    DATA gr_layout TYPE REF TO cl_salv_layout.
      TRY.
          cl_salv_table=>factory(
           IMPORTING r_salv_table = gr_alv
           CHANGING  t_table      = gt_rpt_details ).
          PERFORM f_display_settings.
          gr_alv->set_screen_status(
          "pfstatus = 'Z_STANDARD'
          pfstatus = 'ZSTANDARD_FULLSCREEN'
          report = sy-repid
          "i_save = 'A'
          set_functions = gr_alv->c_functions_all ).
          gr_events = gr_alv->get_event( ).
          "create layout object
          CREATE OBJECT gr_layout.
          gr_layout->get_current_layout( ).
          CREATE OBJECT event_handler.
          SET HANDLER event_handler->on_user_command FOR gr_events.
          gr_functions = gr_alv->get_functions( ).
          gr_functions->set_all('X').
          gr_functions->set_group_filter( value = if_salv_c_bool_sap=>false ).
    *       Set print preview
          gr_functions->set_print_preview( ).
          gr_alv->get_display_settings( ).
          gr_alv->display( ).

  • How can I stop OK button from closing dialog when validations are failing?

    I am using jDev 11.1.1.6.0.
    I am using a commandButton with a showPopupBehavior. If I change values in the dialog that cause validation messages, I can still press the OK button and the dialog closes. Is there a way to prevent the dialog form closing (without use of javascript) if there are validation errors? Is this a bug in ADF?
    My .jsff page contains the following fragment
    <af:commandButton id="cb-new"
    text="#{ResourcesGenBundle['AltTxt.New.Newobject']}..."
    immediate="true" useWindow="true">
    <af:showPopupBehavior popupId="p-crf" triggerType="action"/>
    </af:commandButton>
    <af:popup id="p-crf" contentDelivery="lazyUncached"
    binding="#{pageFlowScope.manageRule.createRuleFolderPopup}">
    <af:dialog id="d-crf"
    title="#{ZspBusinessRulesGenBundle['Action.CreateRuleFolder.CreateRuleFolderInManageSalesP']}"
    contentWidth="360" contentHeight="360" resize="on"
    dialogListener="#{pageFlowScope.manageRule.onCreateRuleFolderDialogEvent}"
    stretchChildren="first">
    <f:subview id="s-mrf">
    <jsp:include page="/oracle/apps/spe/businessRules/publicUi/page/ManageRuleFolderPF.jsff"/>
    </f:subview>
    </af:dialog>
    </af:popup>

    trick was to set autoCancel="disabled" on the popup and hide the popup in the DialogListener when appropriate

  • How to create a radio button in ALV Reports

    Hi all,
    Best wishes to all..
    Kindly reply me to this question... that is "How to create a radio button in ALV Report"
    Thanks and Regards
    Anjali

    HI
    here is an example :
    PROGRAM ZUS_SDN_BCALV_GRID_DEMO_2.
    Based on: BCALV_GRID_DEMO.
    TYPE-POOLS: icon.
    TYPES: BEGIN OF ty_s_sflight.
    INCLUDE TYPE sflight.
    TYPES: button1    TYPE lvc_emphsz.
    TYPES: button2    TYPE lvc_emphsz.
    TYPES: button3    TYPE lvc_emphsz.
    TYPES: button4    TYPE lvc_emphsz.
    TYPES: END OF ty_s_sflight.
    DATA:
      gt_sflight    TYPE STANDARD TABLE OF ty_s_sflight,
      gt_fcat       TYPE lvc_t_fcat.
    DATA: ok_code LIKE sy-ucomm,
         gt_sflight TYPE TABLE OF sflight,
          g_container TYPE scrfname VALUE 'BCALV_GRID_DEMO_0100_CONT1',
          grid1  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container.
          CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          md_cnt    TYPE i.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
          CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    define local data
        FIELD-SYMBOLS:
          <ls_entry>    TYPE ty_s_sflight,
          <ld_fld>      TYPE ANY.
        READ TABLE gt_sflight ASSIGNING <ls_entry> INDEX es_row_no-row_id.
        CHECK ( <ls_entry> IS ASSIGNED ).
      Set all radio buttons "unselected"
        <ls_entry>-button1 =  icon_wd_radio_button_empty.
        <ls_entry>-button2 =  icon_wd_radio_button_empty.
        <ls_entry>-button3 =  icon_wd_radio_button_empty.
        <ls_entry>-button4 =  icon_wd_radio_button_empty.
        ASSIGN COMPONENT e_column_id-fieldname OF STRUCTURE <ls_entry>
                                                  TO <ld_fld>.
        IF ( <ld_fld> IS ASSIGNED ).
        Set selected radio button "selected".
          <ld_fld> = icon_wd_radio_button.
        ENDIF.
      Force PAI followed by refresh of table display in PBO
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'DUMMY'
         IMPORTING
           RC       =
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
          MAIN                                                          *
      PERFORM select_data.
      CALL SCREEN 100.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
               EXPORTING container_name = g_container.
        CREATE OBJECT grid1
               EXPORTING i_parent = g_custom_container.
        PERFORM build_fieldcatalog.
        CALL METHOD grid1->set_table_for_first_display
         EXPORTING
           i_structure_name = 'SFLIGHT'
          CHANGING
            it_fieldcatalog  = gt_fcat
            it_outtab        = gt_sflight.
      Set event handler for event TOOLBAR
        SET HANDLER:
          lcl_eventhandler=>handle_hotspot_click FOR grid1.
      else.
        CALL METHOD grid1->refresh_table_display
         EXPORTING
           IS_STABLE      =
           I_SOFT_REFRESH =
          EXCEPTIONS
            FINISHED       = 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.
      ENDIF.
    ENDMODULE.                    "PBO OUTPUT
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      to react on oi_custom_events:
      CALL METHOD cl_gui_cfw=>dispatch.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN OTHERS.
        do nothing
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                    "PAI INPUT
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    CALL METHOD G_CUSTOM_CONTAINER->FREE.
    CALL METHOD CL_GUI_CFW=>FLUSH.
      LEAVE PROGRAM.
    ENDFORM.                    "EXIT_PROGRAM
    *&      Form  BUILD_FIELDCATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcatalog .
    define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat,
        ls_hype        TYPE lvc_s_hype.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
        I_BUFFER_ACTIVE              =
          i_structure_name             = 'LVC_S_FCAT'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_BYPASSING_BUFFER           =
        I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 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.
      DELETE gt_fcat WHERE ( fieldname <> 'EMPHASIZE' ).
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
        I_BUFFER_ACTIVE              =
          i_structure_name             = 'SFLIGHT'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_BYPASSING_BUFFER           =
        I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 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.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'EMPHASIZE'.
      IF ( syst-subrc = 0 ).
        DELETE gt_fcat INDEX syst-tabix.
      ENDIF.
      ls_fcat-fieldname = 'BUTTON4'.
      ls_fcat-icon    = 'X'.
      ls_fcat-hotspot = 'X'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON3'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON2'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      ls_fcat-fieldname = 'BUTTON1'.
      INSERT ls_fcat INTO gt_fcat INDEX 4.
      LOOP AT gt_fcat INTO ls_fcat.
        ls_fcat-col_pos = syst-tabix.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDLOOP.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
    define local data
      DATA:
        ls_sflight    TYPE ty_s_sflight.
      SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
      ls_sflight-button1 = icon_wd_radio_button.
      ls_sflight-button2 = icon_wd_radio_button_empty.
      ls_sflight-button3 = icon_wd_radio_button_empty.
      ls_sflight-button4 = icon_wd_radio_button_empty.
      MODIFY gt_sflight FROM ls_sflight
          TRANSPORTING button1 button2 button3 button4
        WHERE ( carrid IS NOT INITIAL ).
    ENDFORM.                    " SELECT_DATA
    Regards,
    Prasanth
    Reward all helpful answers

  • How to merge two search button from different criteria

    How to merge two search button from different criteria
    this image show the question
    http://s24.postimg.org/4algthuj9/1111.jpg
    two different criteria for the same view and I need to merge it in one button as when I click
    on the button search result give from two criteria parameters

    You can!t using af:query. the af:query component comes as is. If you can't do it through the properties, you probably can't do it at all.
    As in your other thread, the way to go is to program your own search form. This way you can use a layout and functionality you like.
    For this you create a form with input fields for the values you are searching for, put them on hte page in a way you like and in the end by hitting on a button (e.g. called Search) map all inputfields to parameters of a service method you defined in your application module or VO. This service method then executes a view criteria returning all matches in the default iterator (just as if you had used af:query.
    Timo 

  • How to hide 'layout button' on ALV toolbar

    Hi,
    I have an ALV and it has standard toolbar, now i want to hide 'Layout button' from the toolbar based on specific condition e.g when flag = 1.
    How to do that.
    Thanks,

    If you are using the REUSE function, you can use the "EXCLUDING" parameter, and pass the FCODE for "Change Layout" to this table.  This will remove the icon from the toolbar.  Here is an example.
    REPORT rich_0001 .
    * Global ALV Data Declarations
    TYPE-POOLS: slis.
    * Internal Tables
    DATA: BEGIN OF ialv OCCURS 0,
          test1(10) TYPE c,
          test2(10) TYPE c,
          END OF ialv.
    DATA: xfc TYPE slis_fieldcat_alv.
    DATA: ifc  TYPE slis_t_fieldcat_alv.
    DATA: iexcluding TYPE  slis_t_extab.
    DATA: xexcluding LIKE LINE OF iexcluding.
    PARAMETERS: p_hide TYPE c DEFAULT 'X'.
    START-OF-SELECTION.
      REFRESH iexcluding.
    * If the user wants to hide the change layout icon, then add to IEXCUDING
      IF p_hide = 'X'.
        xexcluding-fcode = '&OL0'.
        APPEND xexcluding TO iexcluding.
      ENDIF.
      REFRESH ifc.
      xfc-reptext_ddic = 'Test1'.
      xfc-fieldname    = 'TEST1'.
      xfc-outputlen    = '10'.
      APPEND xfc TO ifc.
      xfc-reptext_ddic = 'Test2'.
      xfc-fieldname    = 'TEST2'.
      xfc-outputlen    = '10'.
      APPEND xfc TO ifc.
    * Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_excluding = iexcluding
          it_fieldcat  = ifc
        TABLES
          t_outtab     = ialv.
    Regards,
    Rich Heilman

Maybe you are looking for

  • Photoshop slideshow:love/hate some features-what's the best approach??

    Trying to create a slideshow for graduating class. Have created slideshow with photoshop 4.0. What I liked: pan and zoom feature which I use a lot is easywith lots of control. What I didn't like: not be able to fade music, pixelation of some pics (on

  • Creating a password protected folder

    Hi everyone, I hope someone can help me with a little problem I can't seem to resolve, here goes................ I Have a Macbook for home use and a PC that I have to use at work. I have recently purchased a 128 MB keyfob USB drive for using to trans

  • Saving session state during pagination

    See http://htmldb.oracle.com/pls/otn/f?p=24317:152 I hacked into the PPR function to save the checkbox value into session state during pagination. Is there a way to do something similar for checkboxes in the report itself rendered using htmldb_item.c

  • Why does my raw file show editing changes in the Organizer?

    When I edit a raw (CR2) image and then save as a .tiff file and close, my original raw file also appears edited in the Organizer.  I have received advice telling me how to reset to default to get back my unedited CR2, but this is time consuming and I

  • Create Materialized View question

    Hi all, I have a question about MV. Toad creation wizard of a new snapshots (materialized view) on "Refresh Info" tab I set Refresh mode: complete On demand With: ROWID (I can't use primary key because on my table there isn't PK) Writing teh query, n