Application Development 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: 

Opening a file dialog

Former Member
0 Kudos

How to open a file dialog when we click a button in module pool..

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You need to handle the user command event for this.

Button control will have a Ok-code/Function code associated with it and this will be stored in system variable (SY-UCOMM).

In the PAI event of the screen, you can handle the ok-code to execute the open file dialog FM(GUI_FILE_LOAD_DIALOG).

for eg:

In the PAI of the screen,

Include the following code.

Case sy-ucomm.

when 'FOPN'.

call function 'GUI_FILE_LOAD_DIALOG'

Exporting

-


Importing

-


.

Endcase.

By this way you can open a file dialog if a button is clicked.

Hpe this helps..

Reward if helpful...

Regards,

Dillli

6 REPLIES 6

former_member214131
Active Contributor
0 Kudos

You mean FM: F4_FILENAME ?

- Murugesh AS

Former Member
0 Kudos

Hi,

You need to handle the user command event for this.

Button control will have a Ok-code/Function code associated with it and this will be stored in system variable (SY-UCOMM).

In the PAI event of the screen, you can handle the ok-code to execute the open file dialog FM(GUI_FILE_LOAD_DIALOG).

for eg:

In the PAI of the screen,

Include the following code.

Case sy-ucomm.

when 'FOPN'.

call function 'GUI_FILE_LOAD_DIALOG'

Exporting

-


Importing

-


.

Endcase.

By this way you can open a file dialog if a button is clicked.

Hpe this helps..

Reward if helpful...

Regards,

Dillli

Former Member
0 Kudos

Hi,

In addition to the above you can handle at user command events to open a file dialog(again it depends on the requirement).

Syntax is :

At user-command.

case sy-ucomm.

when 'FOPN'.

call the Open dialog FM

endcase.

Here the function code 'FOPN' is associated with the button and it indicates that the button is clicked.

Former Member
0 Kudos

Hi,

In addition to the above you can handle at user command events to open a file dialog(again it depends on the requirement).

Syntax is :

At user-command.

case sy-ucomm.

when 'FOPN'.

call the Open dialog FM

endcase.

Here the function code 'FOPN' is associated with the button and it indicates that the button is clicked.

dev_parbutteea
Active Contributor
0 Kudos

Hi,

you may use FM: TMP_GUI_FILE_OPEN_DIALOG

Regards.

Former Member
0 Kudos

Consider the code below, i hope this is what u r luking for...

----


  • Data declaration

----


DATA:

W_FILENAME LIKE rlgrap-filename.

----


  • AT SELECTION-SCREEN

----


AT SELECTION-SCREEN.

IF SY-UCOMM EQ 'ONLI' OR SY-UCOMM EQ 'PRIN'.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = 'File to be uploaded'

IMPORTING

FILE_NAME = W_FILENAME

.

IF W_FILENAME EQ SPACE.

MESSAGE ID '0' TYPE 'I' NUMBER '0'

WITH 'No file selected.'

'Please select the file to be uploaded...'.

leave to screen 1000.

ENDIF.

ENDIF.

Reward points if useful, get back in case of query...

Cheers!!!