Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

Add button to ALV created with REUSE_ALV_GRID_DISPLAY

$
0
0

Below you can see how to add an additional button to an ALV created with function module

REUSE_ALV_GRID_DISPLAY. I especially want to point out that the GUI status which needs to be copied to your custom

report needs to be STANDARD_FULLSCREEN of program SAPLSLVC_FULLSCREEN.

 

1. Copy the GUI status STANDARD_FULLSCREEN of programSAPLSLVC_FULLSCREEN to your custom report in SE41, in this

case report ZBUTTONTEST.

 

1.jpg

 

2. After having copied the GUI status add the new functioncode to the GUI status in your report:

 

2.png

 

3. The report ZBUTTONTEST:

 

  *&---------------------------------------------------------------------*
*& Report  ZBUTTONTEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZBUTTONTEST.

DATA: lt_scarr TYPE TABLE OF scarr.

START-OF-SELECTION.

SELECT * FROM scarr INTO TABLE lt_scarr.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER                = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program                = sy-repid
i_callback_pf_status_set          = 'SET_PF_STATUS'
i_callback_user_command           = 'HANDLE_USERCOMMAND'
* I_CALLBACK_TOP_OF_PAGE            = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
i_structure_name                  = 'SCARR'
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS                   =
* IS_LAYOUT =
* IT_FIELDCAT =
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_STARTCOLUMN =
* I_SCREEN_START_LINE =
* I_SCREEN_ENDCOLUMN =
* I_SCREEN_END_LINE =
* I_HTML_HEIGHT_TOP                 = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab                          = lt_scarr
EXCEPTIONS
program_error                     = 1
OTHERS                            = 2.

IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

*&---------------------------------------------------------------------*
*&      Form set_pf_status
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM set_pf_status USING rt_extab TYPE slis_t_extab.

SET PF-STATUS 'STANDARD_FULLSCREEN'.

ENDFORM. "set_pf_status

*&---------------------------------------------------------------------*
*&      Form handle_user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM handle_usercommand USING r_ucomm     TYPE sy-ucomm
rs_selfield TYPE slis_selfield.

CASE r_ucomm.
WHEN '&NEWBUTTON'.
* Handle functioncode of new button
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar        = 'Functionality of additional button'
*         DIAGNOSE_OBJECT = ' '
text_question   = 'Please make your selection'
EXCEPTIONS
text_not_found  = 1
OTHERS          = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

ENDCASE.

ENDFORM.                    "handle_user_command

 

 

4. When executing the report in SE38 the output looks as follows with the new custom button:

3.png

5. After clicking on the new button in this case the subroutine handle_usercommand handles the functioncode. In this case

   a pop-up with some text appears.

4.png


Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>