Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

A question about Command button in Selection Screen

Former Member
0 Likes
710

Hello Expert,

I have the following requirement:

My selection screen has an input field which is used to keep the directory for user to download data in the report.

I want to add a command button in the selection screen after the field. By clicking the button, the user can specify the download folder. After the user confirms the selection, the directory should be displayed in the field.

How to write such statement?

Thanks in advance,

Best Regards, Yongbo

5 REPLIES 5
Read only

Former Member
0 Likes
675

Hi,

Why not use a F4 help to browse through the directory on that field !!?

Read only

Former Member
0 Likes
675

try using this

SELECTION-SCREEN INCLUDE PUSHBUTTON [/][pos](len) button_text

[USER-COMMAND fcode]

[MODIF ID modid]

[ID id].

Read only

Former Member
0 Likes
675

PUSHBUTTON 3(5) but USER-COMMAND btn,

AT SELECTION-SCREEN.

CASE sscrfields.

WHEN 'btn'.

ENDCASE.

START-OF-SELECTION.

title = 'Bbutton'.

but = 'Button '.

CALL FUNCTION 'ICON_CREATE'

EXPORTING

name = icon_information

text = 'Button'

info = 'Button on screen'

IMPORTING

RESULT = but2

EXCEPTIONS

OTHERS = 0.

Read only

Former Member
0 Likes
675

Hi,

Check this program : demo_sel_screen_pushbutton

Regards,

Srini.

Read only

venkat_o
Active Contributor
0 Likes
675

Hi, <li>Try this way.


REPORT ztest_notepad.
DATA: file_table TYPE filetable.
DATA: file_table_line LIKE LINE OF file_table.
DATA: rc TYPE i.

SELECTION-SCREEN BEGIN OF BLOCK b1.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:p_file TYPE char50.
SELECTION-SCREEN PUSHBUTTON 53(10) but1 USER-COMMAND but1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.
  but1 = 'Click here'.

AT SELECTION-SCREEN.
  IF sy-ucomm EQ 'BUT1'.

    CALL METHOD cl_gui_frontend_services=>file_open_dialog
      EXPORTING
        window_title      = 'Select file'
        default_extension = '*.*'
      CHANGING
        file_table        = file_table
        rc                = rc.
    READ TABLE file_table INTO file_table_line INDEX 1.
    p_file = file_table_line-filename.

  ENDIF.
Thanks Venkat.O