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

Browse folder in the application server

Former Member
0 Likes
1,921

Hi there,

In a program, I need to create an output file, and to save it either in the applictaion server or in the presentation server.

But I want the user to be able to choose the folder where to save it, not the file itself. Browsing the Web I have found a method of a class, the cl_gui_frontend_services=>directory_browse, by means of which I achieved displaying a screen to select a folder in the computer.

But I couldn't find a function module for displaying a screen for the user to choose a folder from the application server.

Sending an 'A' in the parameter i_server in function module F4_DXFILENAME_TOPRECURSION won't work, since the window displayed is to choose a file and not a folder.

Thanks a lot in advance.

Regards,

Ignacio

Hi there,

In a program, I need to create an output file, and to save it either in the applictaion server or in the presentation server.

But I want the user to be able to choose the folder where to save it, not the file itself. Browsing the Web I have found a method of a class, the cl_gui_frontend_services=>directory_browse, by means of which I achieved displaying a screen to select a folder in the computer.

But I couldn't find a function module for displaying a screen for the user to choose a folder from the application server.

Sending an 'A' in the parameter i_server in function module F4_DXFILENAME_TOPRECURSION won't work, since the window displayed is to choose a file and not a folder.

Thanks a lot in advance.

Regards,

Ignacio

2 REPLIES 2
Read only

Former Member
0 Likes
779

Give this a try:

data: l_abend_flag type dxxabend,         "FISKROB
        l_path type dxlpath.

  concatenate '/usr/sap/' sy-sysid into l_path.

*-- F4 functionality for filename on Application Server
  call function 'F4_DXFILENAME_TOPRECURSION'
    exporting
      i_location_flag       = 'A'
      i_server              = ' '
      i_path                = l_path
    importing
      o_path                = l_path
      abend_flag            = l_abend_flag
    exceptions
      communication_failure = 1
      system_failure        = 2
      rfc_error             = 3.
  if sy-subrc eq 0.
    p_file_name = l_path.
  endif.
  if l_abend_flag = 'X'.
    exit.
  endif.

Rob

Read only

former_member156446
Active Contributor
0 Likes
779
SELECTION-SCREEN BEGIN OF BLOCK 002 WITH FRAME TITLE text-002.
PARAMETERS : p_aps LIKE rlgrap-filename MODIF ID pth .
SELECTION-SCREEN END OF BLOCK 002.
DATA : path_name(150) TYPE c.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_aps.

  SUBMIT rs_get_f4_dir_from_applserv AND RETURN.
  IMPORT path_name FROM MEMORY ID 'PATH_NAME_SDL'.
  p_aps = path_name.

[Retrieve application server file names in F4 help|http://searchsap.techtarget.com/tip/0,289483,sid21_gci943422,00.html]

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.

PERFORM application_server_path.

*&---------------------------------------------------------------------*

*& Form application_server_path

*&---------------------------------------------------------------------*

FORM application_server_path.

IF p_read = 'X'.

*& Selecting file from server on pressing f4

CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

EXPORTING

directory = '.\'

filemask = ' '

IMPORTING

serverfile = p_file1

EXCEPTIONS

canceled_by_user = 1.

ELSE.

MESSAGE 'F4 is only valid for transfering data from Server to PC' TYPE 'S'.

ENDIF.

ENDFORM. " application_server_path