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

F4 help for file path in the Application server

Former Member
0 Likes
4,832

Hi All,

i want to provide the F4 help so as to enable us to give the file path in the application server (AL11). I'm in version 4.0

Regards

Shekhar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,605

Hi Shekar,



CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

    IMPORTING

      serverfile       = p_log

    EXCEPTIONS

      canceled_by_user = 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.

Check if this function module there in version 4.0

Best regards

Poorna

Hi Shekar,



CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

    IMPORTING

      serverfile       = p_log

    EXCEPTIONS

      canceled_by_user = 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.

Check if this function module there in version 4.0

Best regards

Poorna

7 REPLIES 7
Read only

Former Member
0 Likes
3,605

Use FM F4_DXFILENAME_TOPRECURSION

Sample code here

report ztest.

data : filename like DXFIELDS-LONGPATH.

data : begin of itab occurs 0,

a(200) type c,

end of itab.

*----


CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

I_LOCATION_FLAG = 'A'

*I_SERVER = '?'

*I_PATH =

FILEMASK = '.*'

*FILEOPERATION = 'R'

IMPORTING

*O_LOCATION_FLAG =

*O_SERVER =

O_PATH = filename

*ABEND_FLAG =

EXCEPTIONS

RFC_ERROR = 1

ERROR_WITH_GUI = 2

OTHERS = 3

.

*----


break-point.

open dataset filename for input in binary mode.

while sy-subrc = 0.

clear itab .

read dataset filename into itab.

append itab.

endwhile.

*----


CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE =

FILENAME = 'd:\abc.txt'

FILETYPE = 'BIN'

TABLES

DATA_TAB = itab

.

Regards,

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
3,605

Hi

Using the below declarations, you can get the Browse Functionality for File Path.

So that you can give the Application Server's Path.

parameter: p_file TYPE IBIPPARMS-PATH.

at selection-screen on value-request for p_file.

call function 'F4_FILENAME'

importing

FILE_NAME = p_file.

OR

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

EXPORTING

I_LOCATION_FLAG = 'A'

*I_SERVER = '?'

*I_PATH =

FILEMASK = '.*'

*FILEOPERATION = 'R'

IMPORTING

*O_LOCATION_FLAG =

*O_SERVER =

O_PATH = filename

*ABEND_FLAG =

EXCEPTIONS

RFC_ERROR = 1

ERROR_WITH_GUI = 2

OTHERS = 3

Regards,

Sree

Edited by: sree ram on Mar 14, 2008 10:02 AM

Read only

Former Member
0 Likes
3,605

Use the Function Module WS_FILENAME_GET

Read only

Former Member
0 Likes
3,606

Hi Shekar,



CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

    IMPORTING

      serverfile       = p_log

    EXCEPTIONS

      canceled_by_user = 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.

Check if this function module there in version 4.0

Best regards

Poorna

Read only

Former Member
0 Likes
3,605

Hi Shekhar,

U can use the FM like this with location flag 'A'

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

  • EXPORTING

I_LOCATION_FLAG = ' A '

  • I_SERVER = '?'

  • I_PATH =

  • FILEMASK = '.'

  • FILEOPERATION = 'R'

  • IMPORTING

  • O_LOCATION_FLAG =

  • O_SERVER =

  • O_PATH =

  • ABEND_FLAG =

  • EXCEPTIONS

  • RFC_ERROR = 1

  • ERROR_WITH_GUI = 2

  • OTHERS = 3

.

IF sy-subrc <> 0.

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

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

ENDIF.

Thanks Arjun

Read only

Former Member
0 Likes
3,605

Hi,

Use FILE_GET_NAME function module. U can get the application server path. Pass client = sy-mandt, logical filename, operating system = sy-opsys.

Refer this link below :

Please reward points if useful.

Regards

rose

Read only

0 Likes
3,605

Hi

Copy paste the following code and see the result

Here you can see 2 types of open dialogs

1. Directory View

2. File View

Use any one as per your requirement.

DATA : l_filetable TYPE filetable,

l_rc TYPE i.

DATA: l_folder TYPE string,

l_file TYPE string.

PARAMETERS: p_folder(100) TYPE c,

p_file(100) TYPE c.

*Provide a Dialogue box for getting a folder path

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_folder.

CALL METHOD cl_gui_frontend_services=>directory_browse

EXPORTING

window_title = 'Select Folder Path'

initial_folder = 'D:\'

CHANGING

selected_folder = l_folder.

p_folder = l_folder.

*Provide a Dialogue box for getting a file path

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

window_title = 'Select a Text File'

initial_directory = l_folder

CHANGING

file_table = l_filetable

rc = l_rc.

Reward points generously

Regards

Akshay Chonkar

READ TABLE l_filetable INTO p_file INDEX 1.

CHECK sy-subrc <> 0.