Create change/edit button in ALV

Hello Experts,
               How to insert the button in ALV grid toolbar. Now its showing Check,insert,append and delete button.How to add change or edit button in ALV ?
I'm using ALV componenet  SALV_WD_TABLE.
Thanks.

Hi,
With the previous reply you can create the customized button.
to make ALV editable or non editable(change or read only) the code to be written is:
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
  DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
  DATA lo_value TYPE REF TO cl_salv_wd_config_table.
  lo_cmp_usage =   wd_this->wd_cpuse_alv_table( ).
  IF lo_cmp_usage->has_active_component( ) IS INITIAL.
    lo_cmp_usage->create_component( ).
  ENDIF.
  lo_interfacecontroller =   wd_this->wd_cpifc_alv_table( ).
  lo_value = lo_interfacecontroller->get_model( ).
*lr_table_settings->set_read_only( abap_false ).*"you can  make it abap_true or abap_false based  to make
the ALV editable or non editable
Priya

Similar Messages

  • Add Change/Edit button in ALV

    Hello Experts,
                   How to insert the button in ALV grid toolbar. Now its showing Check,insert,append and delete button.How to add change or edit button in ALV ?
    I'm using ALV componenet  SALV_WD_TABLE.
    Thanks.

    Hi Stars,
    To achieve this, you have to two of ALV grid events. Use event TOOLBAR to add a button & event USER_COMMAND to implement a function.
    In the method handling the toolbar event, we define a new button by filling a structure and appending it to the table attribute mt_toolbar of the object to whose reference we can reach via the parameter e_object of the event.
    Example code snippet for your reference :-
    DATA: ls_toolbar TYPE stb_button.
    CLEAR ls_toolbar.
    MOVE 3 TO ls_toolbar-butn_type.
    APPEND ls_toolbar TO i_object->mt_toolbar.
    CLEAR ls_toolbar.
    MOVE 'PER' TO ls_toolbar-function. "#EC NOTEXT
    MOVE icon_display_text TO ls_toolbar-icon.
    MOVE 'Passenger Info'(201) TO ls_toolbar-quickinfo.
    MOVE 'Passenger Info'(201) TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
    APPEND ls_toolbar TO i_object->mt_toolbar.
    CLEAR ls_toolbar.
    MOVE 'EXCH' TO ls_toolbar-function. "#EC NOTEXT
    MOVE 2 TO ls_toolbar-butn_type.
    MOVE icon_calculation TO ls_toolbar-icon.
    MOVE 'Payment in Other Currencies'(202) TO ls_toolbar-quickinfo.
    MOVE ' ' TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled. "#EC NOTEXT
    APPEND ls_toolbar TO i_object->mt_toolbar.
    Regards
    Abhii

  • Hide Change Layout Button in ALV report o/p for MB52 Tcode

    Hi,
    Is it possible to Hide Change Layout Button in ALV output for Report MB52 using authoriztaion.
    We have created a layout in which we are hiding some coloumns which the user should not see.
    But if the change layout button is active then the user can add those coloumns to output.
    Is this possible through authorizations. I want to avoid doing any chnages to the std sap program.
    Thanks & Regards,
    Fawaz

    Check the object S_ALV_LAYO

  • 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

  • Change layout Button In ALV Grid

    Hi all,
    I have a requirement where I am creating Field Catalogue from Z Table(has 60 fields) for few(12) fields.
    The user would like to have the option to add more fields by changing the Layout. But I dont see the Fields in Hidden Column when I click the Change Layout Button in ALV Toolbar. It just displays the Field based on Field Catalogue defined.
    Is there a way I can maintain all the fields without being displayed in ALV initally and letting the user select the hidden fields as per their requirement. As happens in SE16 where we can select the fields to be displayed.
    Thanks for the support.

    Hi Abhilasha,
    In the reuse_alv function module we can see a field I_SAVE.If you pass this as 'X' then the option of saving the layout variants are available.
    Create a layout by,selecting just the fileds required for display and set it as the default variant.It can be made Global or user-specific.But  we need to declare all fields in the fieldcatalog.
    So if the default variant is set,everytime the program is run it shows only the fields selected in it but can select more form the change layout option.
    Hope it helps.
    Regards
    Byju

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

  • What is the constant name for Change layout Button in ALV Grid ABAP Objects

    Dear All,
    I have one query please help me.
    what is the constant name for Change layout Button in ALV Grid ABAP Objects.
    With Rgds,
    Babu

    Halo Vinod,
    The consant name is cl_gui_alv_grid=>mc_fc_current_variant.
    Regards
    Arshad

  • 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( ).

  • Create custom Edit button for list on SharePoint 2013 page

    Hi
    I have a custom list which holds contact information such as name, telephone, address.  I am displaying the custom list webpart with using a custom view on the site home page which only shows name and telephone.  It should only
    have 1 item so 'New Item' is not needed.  However I still need to be able to edit the item.  If I click 'Edit' on the list view on the home page, it will open a quick edit box only showing name and telephone. 
    How can I create a custom button on the home page that will open the custom list item form instead?  Therefore all columns will be editable and I can remove the "New and Edit" toolbar from the webpart.
    Marc Collins www.QGate.co.uk

    Hi,
    According to your post, my understanding is that you want to open the custom list item form.
    Per my knowledge, there is out of box method to achieve it.
    After you insert the web part to a page, you need to edit the web part and change List Views as below, then it will remove the "New and Edit" toolbar from the webpart.
    In the page, if you click the web part , the ribbon will appear. After you select the item and click Edit Item, the edit form with all fields will be displayed.
    Thanks,
    Linda Li                
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • GRC 10.0 - create role - Edit button inactive

    Hi,
    when trying to create role ((Business, Composite, Single etc.) in NWBC - AM - RM - Role Maintenance --> 'Create', it`s not possible to enter details as everything is grey and Edit button is inactive.
    Also it`s not possible to modify already existing roles which were created using Role Mass Maintenance - Role Import tool. All fields are grey and Edit button is inactive as well.
    Settings are checked, role types are active and user has full access.
    Did someone have such problem? Any idea what can be missing there?
    Thanks in advice for any advice.
    Regards,
    Aga

    Dear Aga,
    please check the following note: http://service.sap.com/sap/support/notes/1700890
    Hope this helps to understand and fix the issue.
    Regards,
    Alessandro

  • Can I create a Radio button in ALV

    Hello All,
    My requirement is to create a ALV column as Radio button. Is there a way to achieve it. I can create a check box but didnt find the option to create a radio button.
    Thanks & Regards,
    Anju

    Hello,
    Check the code snippet given here
    [http://wiki.sdn.sap.com/wiki/display/Snippets/ALV%20Grid%20List%20Using%20Radio%20Buttons]
    Vikranth

  • 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

  • Why miss change layout button in ALV report

    Hello Experts,
    I have strange problem, I run the same transaction two times, one I have the change layout button but another I miss it...
    Anything control this button?
    thanks a lot for your help!

    Hi,
    Is this standard Tcode or customized Tcode?
    If it is standard tcode, what is the tcode?
    If it is customized tcode, can you post some code for us to analyse?
    Thanks.
    Regards,
    Keng Haw

  • How to change edit  button

    Hi Friends,
    I am adding a new page to my sample test apps AnyCo Corp. the new page has edit button (a pencil and paper icon).
    But when I run the page, I saw that its not the same edit icon as the other pages. i tried to edit the pages
    again and click on BUTTONS region, but i cannot see any edit icons there.
    Where do I search this edit icon please.
    Thanks a lot

    Hi,
    Go to the button definition and use the following settings:
    Button Style: Image
    Button Image: #IMAGE_PREFIX#xxxxx.xxx
    Where xxxxx.xxx is the image name. These images are stored in the /i/ folder on the server. For a list of the ones that were available to me on my OTN workspace, see: [http://htmldb.oracle.com/pls/otn/f?p=45958:21].
    Andy

  • Change layout button in ALV Grids

    Hi Experts,
    I have displayed 2 ALV grids in a single screen using OOPS concepts and I have activated the Save Layout option for both the Lists.
    Now whenever I will save the layout for the 1st list then automatically it is taken into consideration for the common fields in the second list as well.
    Please help me on how I can avoid changing the 2nd list if I will change the 1st list if possible.
    Thanks in advance..
    Regards,
    Srinivas
    Edited by: Srinivas Hari on Jun 23, 2009 10:07 AM

    Hello,
    I think u can achieve that by populating
    HANDLE
    LOG_GROUP fields of Disvariant structure in u r program.
    Regards

Maybe you are looking for

  • Use one iTunes Library for both my MacBook and Mac Mini

    Hi, I want to make a few changes in my configuration, but before something will go terribly wrong, I want to make sure I use the correct approach. Yesterday I got a and on an older Mac Mini Model (G4 - only 40GB hard disc). It runs Leopard. It does n

  • Why does this websites not work on our Mac products?

    http://www.gordonbennett2012.ch/ We are working on the above website: We cannot get it to work on the following Mac devises. Would you please advise the reason for this and how we can fix it? From: FLY GAS Subject: Fwd: Website of Gordon Bennett 2012

  • Keeping unlimited 3g with a 4g phone

    Is it possible to keep a 3g unlimited data plan when you purchase an unsubsidized 4g phone? I do not mind keeping 3g speeds as the 4g coverage in my area is non-existent. If you upgrade to another unsubsidized 3g phone is it still possible to keep un

  • Cloning Solaris 10 with zones

    What is the best method to use when cloning a Solaris machine with zones, to ensure all software is included and can be easily installed on new hardware? Thank you!

  • Extended classic scenarion after approval of shopping cart no PO is created

    Hi Experts, In extended classic scenario,SC approved and No po created in SRM 5.0 when I check in BBP_PD status is completed and RZ20 shopping cart basket link all green and purchase order link red - Error in local purchase order. No update of refere