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

directory browsing in dialog selection

Former Member
0 Likes
1,743

Hi all.

I need a directory browsing in dialog module. Meaning creating the field using screen painter. Any code for creating the directory?

thks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,671

Instead of report..it should be Module...

<b>MODULE GET_FOLDER.</b>

data: objFile type ref to cl_gui_frontend_services.

data: pickedFolder type string.

data: initialFolder type string.

data : folder type string.

START-OF-SELECTION.

CALL SCREEN 100.

create object objFile.

objFile->directory_browse( exporting initial_folder = initialFolder

changing selected_folder = pickedFolder

exceptions cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3 ).

folder = pickedFolder.

ENDMODULE.<b></b>

Hi all.

I need a directory browsing in dialog module. Meaning creating the field using screen painter. Any code for creating the directory?

thks

11 REPLIES 11
Read only

Former Member
0 Likes
1,671

Hi,

You can do it:

1. Create Input Field for directory browsing ( example name: Folder ).

2. In Flow Login of your screen add code :


PROCESS AFTER INPUT.

PROCESS ON VALUE-REQUEST.
  FIELD folder  MODULE GET_FOLDER.

3. Add this code at GET_FOLDER Module.


data: objFile type ref to cl_gui_frontend_services.
data: pickedFolder type string.
data: initialFolder type string.

    create object objFile.
    objFile->directory_browse( exporting initial_folder = initialFolder
                               changing selected_folder = pickedFolder
                               exceptions cntl_error = 1
                                          error_no_gui = 2
                                          not_supported_by_gui = 3 ).

    folder = pickedFolder.

Regards,

Read only

0 Likes
1,671

some doubt in following the step

step1 completed.

step2

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

PROCESS ON VALUE-REQUEST.

FIELD folder MODULE GET_FOLDER.

issit the code for the flow login refer to above?

Step 3 i am totally lost.

what do u mean Add this code at GET_FOLDER Module, issit refer to my program. Below is my program can help me to debug. I checked the syntax, i gt this error. field folder is unknow? What statement mus i add?

REPORT ZGARY_DIRECTORY_DIALOG.

data: objFile type ref to cl_gui_frontend_services.

data: pickedFolder type string.

data: initialFolder type string.

START-OF-SELECTION.

CALL SCREEN 100.

create object objFile.

objFile->directory_browse( exporting initial_folder = initialFolder

changing selected_folder = pickedFolder

exceptions cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3 ).

folder = pickedFolder.

Read only

Former Member
0 Likes
1,671

Hi gary

create field p_file in the screen and use process on value-request.

PROCESS BEFORE OUTPUT.

.......

PROCESS AFTER INPUT.

.......

PROCESS ON VALUE-REQUEST.

FIELD p_file MODULE browse_file.

  • module browse_file

DATA L_FILE(256).

L_FILE = P_FILE.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_FILENAME = L_FILE

DEF_PATH = ''

MASK = ',..'

MODE = 'O'

TITLE = 'Open File'

IMPORTING

FILENAME = P_FILE

EXCEPTIONS

INV_WINSYS = 01

NO_BATCH = 02

SELECTION_CANCEL = 03

SELECTION_ERROR = 04.

Regards

Wiboon

Read only

0 Likes
1,671

Hi

i gt this working code but using selection screen. Is it possible that can change to dialog module for me?

parameters: p_path type localfile.

at selection-screen on value-request for p_path.

data: path_str type string.

call method cl_gui_frontend_services=>directory_browse

exporting

window_title = 'Select Directory'

changing

selected_folder = path_str

exceptions

cntl_error = 1.

call method cl_gui_cfw=>flush

exceptions

cntl_system_error = 1

cntl_error = 2.

p_path = path_str.

Screen 1000 is created automatically

PROCESS BEFORE OUTPUT.

MODULE %_INIT_PBO.

MODULE %_PBO_REPORT.

MODULE %_PF_STATUS.

MODULE %_END_OF_PBO.

PROCESS AFTER INPUT.

MODULE %_BACK AT EXIT-COMMAND.

MODULE %_INIT_PAI.

FIELD !P_PATH MODULE %_P_PATH .

CHAIN.

FIELD P_PATH .

MODULE %_END_OF_SCREEN.

MODULE %_OK_CODE_1000.

ENDCHAIN.

PROCESS ON VALUE-REQUEST.

FIELD P_PATH MODULE %_P_PATH_VAL .

Read only

Former Member
0 Likes
1,671

REPORT ZGARY_DIRECTORY_DIALOG.

data: objFile type ref to cl_gui_frontend_services.

data: pickedFolder type string.

data: initialFolder type string.

<b>data : folder type string.</b>

START-OF-SELECTION.

CALL SCREEN 100.

create object objFile.

objFile->directory_browse( exporting initial_folder = initialFolder

changing selected_folder = pickedFolder

exceptions cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3 ).

folder = pickedFolder.

Read only

0 Likes
1,671

it doesnt giv me any sytnax error. But is not working. i select the the input field nothing came out. Any where i miss out something on?

Read only

Former Member
0 Likes
1,672

Instead of report..it should be Module...

<b>MODULE GET_FOLDER.</b>

data: objFile type ref to cl_gui_frontend_services.

data: pickedFolder type string.

data: initialFolder type string.

data : folder type string.

START-OF-SELECTION.

CALL SCREEN 100.

create object objFile.

objFile->directory_browse( exporting initial_folder = initialFolder

changing selected_folder = pickedFolder

exceptions cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3 ).

folder = pickedFolder.

ENDMODULE.<b></b>

Read only

0 Likes
1,671

Thk alot is working...

The directory is populated to the input field. However i cant check is my path is correct cos the input field only show partial of the path. Any ways for me to allow the input field to be scrollable? i already set the input field as scrollable in the screen painter but stil cannot scoll?

Read only

Former Member
0 Likes
1,671

Hi,

You need to press the right arrow key to scroll through the field.

Else increase the width of input field.

Best regards,

Prashant

Read only

0 Likes
1,671

thks for helping!

I gt another question.

i need to create a similar program like se11

go to view, select a table view, gt a tab call selection criteria...

i want that selection criteria table

Selection criteria

Table | Fieldname | Operator | Comparison Value | And/Or

i need to create that table for user to enter record and save it to my database.

Read only

0 Likes
1,671

hihi....

Now i want to show all the files in the folder? hw can i do it? My program is a dialog module selection.

thks