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

Function Module to select file from the application server?

Former Member
0 Likes
3,861

hi

which function module can be used to select the file from the application server as to select file from the presentation server we use f4-filename.

thanks

ekta

1 ACCEPTED SOLUTION
Read only

Former Member
1,825

Hi,

Here is the function module

CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

EXPORTING

directory = ' '

filemask = ' '

IMPORTING

serverfile = p_afile

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.

Regards

Sudheer

7 REPLIES 7
Read only

Former Member
0 Likes
1,825

Hi,

you should use 'open_dataset'

grtz,

Koen

Read only

Former Member
1,826

Hi,

Here is the function module

CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

EXPORTING

directory = ' '

filemask = ' '

IMPORTING

serverfile = p_afile

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.

Regards

Sudheer

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,825

If you know the complete network path to the application server, you can use the GUI frontend control to do this. For example, this works good for me.




report zrich_0001.


parameters: p_file type localfile.


at selection-screen on value-request for p_file.


  data: ifile type filetable.
  data: xfile like line of ifile.
  data: rc type i.

  call method cl_gui_frontend_services=>file_open_dialog
    exporting
       initial_directory
        = '\<host_name>usrsapTST'
    changing
      file_table              = ifile
      rc                      = rc.

  read table ifile into xfile index 1.
  check sy-subrc = 0.
  p_file = xfile-filename.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
1,825

Hi,

The FM used for obtaining an F4 help from application server is - /SAPDMC/LSM_F4_SERVER_FILE.

The FM used for obtaining files from application server - SUBST_GET_FILE_LIST.

Read only

Former Member
0 Likes
1,825

Pl try the function call 'RZL_READ_DIR_LOCAL'.

Arya

Read only

Former Member
0 Likes
1,825

I thank all of the people who responded this issue.

thanks

ekta

Read only

Former Member
0 Likes
1,825

Hi,

There is one transaction is for download a file from application server

<b>CG3Y and CG3Z</b>

try to use this for download.

if u want to print a file in application server u have to write a code as following way

OPEN DATASET v_file FOR <b>OUTPUT</b> IN TEXT MODE .

<b>OUTPUT</b> for writing a text into application server

<b>INPUT</b> for reading a text from application server..

<b>reward me a points if it use full answer...</b>

praveen