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

Path for Directory in Selection Screen

Former Member
0 Likes
5,352

I have one field in selection screen Error log.

I have to pick path for dirctory in that parameter, so that I can save my error log there on that path.

how i can do it ?

F4 for the path is needed. how i will define that parameter in selection screen?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,798

Hi,

Use this


DATA : f_path TYPE string,
      f_pathname TYPE string.


PARAMETERS: f_path1 TYPE string.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR f_path1.
  CALL METHOD cl_gui_frontend_services=>directory_browse
    CHANGING
      selected_folder      = f_path1
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      OTHERS               = 4.

  IF sy-subrc EQ 0.
    f_pathname = f_path1.
    WRITE: f_pathname.
  ENDIF.

I have one field in selection screen Error log.

I have to pick path for dirctory in that parameter, so that I can save my error log there on that path.

how i can do it ?

F4 for the path is needed. how i will define that parameter in selection screen?

8 REPLIES 8
Read only

GauthamV
Active Contributor
0 Likes
2,798

Plz SEARCH in SCN before posting.

Read only

Former Member
0 Likes
2,798

I have searched, but option for picking file is there.

no option for picking path of directory found

Read only

sarbajitm
Contributor
0 Likes
2,798

Call the FM 'F4_Filename' in the event AT SELECTION-SCREEN on(your parameter for filepath).

Regards,

Sarbajit.

Read only

Former Member
0 Likes
2,798

this is for picking file.

I need to pick directory path only in result.

Edited by: Study Sap on Mar 11, 2010 9:01 AM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,798

Can you not use the static method: cl_gui_frontend_services=>file_save_dialog for this ?

Crap !!!

Edited by: Suhas Saha on Mar 11, 2010 1:54 PM

Read only

Former Member
0 Likes
2,798

hi,

you can use the Fm

GUI_FILE_SAVE_DIALOG

Read only

Former Member
0 Likes
2,798

Hi

Check the below logic:

DATA :G_DIR1 TYPE STRING.

DATA : G_T_FILENAMES TYPE SETST_TYPE_STANDARD_TABLE,

G_WA_FILES LIKE LINE OF G_T_FILENAMES.

PARAMETERS: P_FOLDER TYPE RLGRAP-FILENAME OBLIGATORY

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FOLDER.

PERFORM F1000_GET_DIR.

START-OF-SELECTION.

IF G_DIR IS INITIAL.

G_DIR = P_FOLDER.

ENDIF.

PERFORM F1100_GET_FILENAMES USING G_DIR.

FORM F1000_GET_DIR .

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE

EXPORTING

WINDOW_TITLE = 'Folder for ADP Files'

INITIAL_FOLDER = G_DIR1

CHANGING

SELECTED_FOLDER = G_DIR1

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

NOT_SUPPORTED_BY_GUI = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ELSE.

P_FOLDER = G_DIR1.

ENDIF.

ENDFORM.

FORM F1100_GET_FILENAMES USING P_DIR.

DATA : L_DIR TYPE STRING,

L_COUNT TYPE I,

L_COUNT1 TYPE I.

DATA : L_T_FILES TYPE SETST_TYPE_STANDARD_TABLE,

WA_FILES LIKE LINE OF L_T_FILES.

L_DIR = P_DIR.

CLEAR : G_T_FILENAMES[], G_T_FILENAMES.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

EXPORTING

DIRECTORY = L_DIR

  • FILTER = '.'

  • FILES_ONLY =

  • DIRECTORIES_ONLY =

CHANGING

FILE_TABLE = L_T_FILES

COUNT = L_COUNT

EXCEPTIONS

CNTL_ERROR = 1

DIRECTORY_LIST_FILES_FAILED = 2

WRONG_PARAMETER = 3

ERROR_NO_GUI = 4

NOT_SUPPORTED_BY_GUI = 5

OTHERS = 6

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

G_T_FILENAMES[] = L_T_FILES[].

LOOP AT G_T_FILENAMES INTO G_WA_FILES.

IF G_WA_FILES CS SY-DATUM.

G_WA_FILES1 = G_WA_FILES.

APPEND G_WA_FILES1 TO G_T_FILENAMES1.

ENDIF.

ENDLOOP.

Regards,

Ravinder

Read only

Former Member
0 Likes
2,799

Hi,

Use this


DATA : f_path TYPE string,
      f_pathname TYPE string.


PARAMETERS: f_path1 TYPE string.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR f_path1.
  CALL METHOD cl_gui_frontend_services=>directory_browse
    CHANGING
      selected_folder      = f_path1
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      OTHERS               = 4.

  IF sy-subrc EQ 0.
    f_pathname = f_path1.
    WRITE: f_pathname.
  ENDIF.