Abap Creating a workable button on the selection screen

*&---------------------------------------------------------------------*
*& Report Y_MARK_TEST_BUTTON
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT Y_MARK_TEST_BUTTON.
TABLES sscrfields.
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i,
gd_file TYPE c.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.


PARAMETERS : P_FILE LIKE RLGRAP-FILENAME default 'C:\EMAIL_RESULT.XLS'.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON (20) dl_excel USER-COMMAND dl_excel. "button!
SELECTION-SCREEN END OF LINE.


SELECTION-SCREEN END OF BLOCK B1.


* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
* Display save dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
* window_title = ' '
default_extension = 'XLS'
default_file_name = 'EMAIL_RESULT'
initial_directory = 'C:\'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
p_file = ld_fullpath.


AT SELECTION-SCREEN OUTPUT.
MOVE 'Download' TO dl_excel. "giving the button label

AT SELECTION-SCREEN.
case sy-ucomm.
when 'DL_EXCEL'.
"DO WHAT EVER YOU LIKE
endcase.
0 comments:

Post a Comment

message

Labels

NuffNang

Search google

Blog Archive

My Blog List

Twitter

Message

Followers