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: 

Regarding Application server file path browsing

Former Member
0 Kudos

Hi All,

I have a issue regarding Application Server File Path browsing.

Actually in my selection-screen i will declare a parameter as <b>Application Server File Path</b> now when i press F4 in that field it should be able to browse through <b>Application Server Path's</b>.

Just like <b>F4_FILENAME</b> in the case of <b>Presentation Server File Path</b> Browsing.

Can anybody solve my issue.

Thanks in advance.

Thanks & Regards,

Rayeez.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi...

u can try out with the following FM..

"F4_DXFILENAME_TOPRECURSION "

The detail description for it is...

*Popup to select one file from the given application server directory (pattern allowed).

*(Can be used also for selecting file on presentation server: calls WS_FILENAME_GET)

*Parameters: I_LOCATION_FLAG={A|P|space};

  • if I_LOCATION_FLAG is blank then popup to choose Appl./Present.; if I_SERVER='?' then popup to select appl.server.

as in...

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

I_LOCATION_FLAG = 'A' "(A) Server (P) Presentaión

  • I_SERVER = '?'

  • I_PATH =

  • FILEMASK = '.'

  • FILEOPERATION = 'R'

  • IMPORTING

  • O_LOCATION_FLAG =

  • O_SERVER =

  • O_PATH =

  • ABEND_FLAG =

EXCEPTIONS

RFC_ERROR = 1

OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

regards,

Ananaya.S

6 REPLIES 6

Former Member
0 Kudos

Hi,

Refer this thread:

Regards,

Gayathri

Former Member
0 Kudos

Hi Shaik,

Just copy and paste:

Here is the code for retrieving list of files contained within specific Application server directory(SAP).

PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.

data: begin of it_filedir occurs 10.

include structure salfldir.

data: end of it_filedir.

START-OF-SELECTION.

  • Get Current Directory Listing for OUT Dir

call function 'RZL_READ_DIR_LOCAL'

exporting

name = p_fdir

tables

file_tbl = it_filedir.

  • List of files are contained within table it_filedir

loop at it_filedir.

write: / it_filedir-NAME.

endloop.

Hope this will help you.

Let me know incase of any concerns.

EDIT:

There are few FM for ur refernce :

RZL_READ_DIR_LOCAL

SUBST_GET_FILE_LIST Return table with file list for the given directory (pattern allowed)

F4_DXFILENAME_TOPRECURSION Popup to select one file from the given application server directory

TH_SERVER_LIST Returns list of application servers.

EPS_GET_DIRECTORY_LISTING – Lists filenames from the application server .

Cheers

Sunny

Rewrd points, if found helpful

Message was edited by: Sunny

ferry_lianto
Active Contributor
0 Kudos

Hi Shaik,

Please check this sample code.

at selection-screen on value-request for f_app.
perform get_fname_app.


form get_fname_app.

data: c_fnh_mask type dxfields-filemask value '*.*',
search_dir type dxfields-longpath value '/sapglobal/users',
file_path like dxfields-longpath.

call function 'F4_DXFILENAME_TOPRECURSION'
exporting
i_location_flag = 'A'
i_server = ' '
i_path = search_dir
filemask = c_fnh_mask
fileoperation = 'R'
importing
o_path = file_path
exceptions
rfc_error = 1
others = 2
.
if sy-subrc eq 0.
f_app = file_path.
endif.
endform.

Hope this will help.

Regards,

Ferry Lianto

Private_Member_17805
Participant
0 Kudos

Hi,

The following code gives you the list of files available in the application server for the given directory.So with the internal table which the FM returns you can manipulate to meet your requirements.

PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.

data: begin of it_filedir occurs 10.

include structure salfldir.

data: end of it_filedir.

START-OF-SELECTION.

  • Get Current Directory Listing for OUT Dir

CALL FUNCTION 'RZL_READ_DIR_LOCAL'

EXPORTING

name = p_fdir

tables

file_tbl = it_filedir

EXCEPTIONS

ARGUMENT_ERROR = 1

NOT_FOUND = 2

OTHERS = 3

.

  • List of files are contained within table it_filedir

loop at it_filedir.

write: / it_filedir-NAME.

endloop.

Former Member
0 Kudos

hi...

u can try out with the following FM..

"F4_DXFILENAME_TOPRECURSION "

The detail description for it is...

*Popup to select one file from the given application server directory (pattern allowed).

*(Can be used also for selecting file on presentation server: calls WS_FILENAME_GET)

*Parameters: I_LOCATION_FLAG={A|P|space};

  • if I_LOCATION_FLAG is blank then popup to choose Appl./Present.; if I_SERVER='?' then popup to select appl.server.

as in...

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

I_LOCATION_FLAG = 'A' "(A) Server (P) Presentaión

  • I_SERVER = '?'

  • I_PATH =

  • FILEMASK = '.'

  • FILEOPERATION = 'R'

  • IMPORTING

  • O_LOCATION_FLAG =

  • O_SERVER =

  • O_PATH =

  • ABEND_FLAG =

EXCEPTIONS

RFC_ERROR = 1

OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

regards,

Ananaya.S

former_member188685
Active Contributor
0 Kudos

Hi Shaik,

you can use this FM <b>/SAPDMC/LSM_F4_SERVER_FILE</b>

      L_FILEMASK = '*'.
      CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
           EXPORTING
                DIRECTORY        = L_DIRECTORY
                FILEMASK         = L_FILEMASK
           IMPORTING
                SERVERFILE       = P_FILENAME
           EXCEPTIONS
                CANCELED_BY_USER = 1
                OTHERS           = 2.

Regards

Vijay