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 Application server filename

Former Member
0 Likes
2,208

Hi All,

is there any function module to provide f4 help for the user to get file name of the application server (AL11),

similar to f4_filename.

Regards,

Raghavendra

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,937

Check these FM:

F4_DXFILENAME_TOPRECURSION

TH_SELECT_SERVER

Or check this code:


PARAMETERS: f_app(128).

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.                    "get_fname_app

Check the similar thread:

8 REPLIES 8
Read only

Former Member
0 Likes
1,938

Check these FM:

F4_DXFILENAME_TOPRECURSION

TH_SELECT_SERVER

Or check this code:


PARAMETERS: f_app(128).

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.                    "get_fname_app

Check the similar thread:

Read only

vinod_gunaware2
Active Contributor
0 Likes
1,937

F4_DXFILENAME_TOPRECURSION

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.

regards

vinod

Read only

0 Likes
1,937

hi Raghav,

Use FM <b>'F4_DXFILENAME_TOPRECURSION'</b>

Thanks,

Santosh

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,937

Hi,

Here is the sample code.Kindly reward points if it helps.

CALL FUNCTION 'F4_DXFILENAME_4_DYNP'

EXPORTING

dynpfield_filename = p_applfile

dyname = sy-cprog

dynumb = sy-dynnr

filetype = 'P'

location = 'A'

server = space.

Read only

Former Member
0 Likes
1,937

Hi raghavendra ,

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.

Cheers

Sunny

Rewrd points, if found helpful

Read only

0 Likes
1,937

Hi Raghavendra,

You can use the following code to get the F4 help for

the appliaction server file name

Data : P_FILE1 TYPE STRING

At selection screen on value request for p_file.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SY-REPID

DYNPRO_NUMBER = SY-DYNNR

IMPORTING

FILE_NAME = V_FILE

.

IF SY-SUBRC <> 0.

MESSAGE I000(ZI) WITH 'TRY AGAIN'.

ELSE.

P_FILE = V_FILE.

ENDIf.

regards,

krishna

Read only

0 Likes
1,937

Use '/SAPDMC/LSM_F4_SERVER_FILE'. Please close the thread if answered.

Read only

Former Member
0 Likes
1,937

data: dsn_logical like filename-fileintern.

select-options s1 for dsn_logical no-extension no intervals.

DATA: DS_PHY_NAME LIKE FILENAME-FILEEXTERN. "VWMK056015

clear ds_phy_name.

CALL FUNCTION 'FILE_GET_NAME' "VWM0K56015

EXPORTING "VWM0K56015

LOGICAL_FILENAME = s1-low "VWM0K56015

IMPORTING "VWM0K56015

FILE_NAME = DS_PHY_NAME "VWM0K56015

EXCEPTIONS "VWM0K56015

FILE_NOT_FOUND = 08. "VWM0K56015

IF NOT SY-SUBRC IS INITIAL. "VWM0K56015

MESSAGE E102(LX) WITH DSn_logical. " VWM0K56015

ENDIF. "VWM0K56015