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 Filepath on Application Server

Former Member
0 Likes
9,737

How do we create a F4 Help on the Selection-Screen for the file-path on Application Server? If we use the FM "F4_FILENAME" , We get the Logical File names. But here we do not want the logical file names, but just the path.

We wrote the following piece of code:

DATA: gv_path_name TYPE localfile.

SUBMIT rs_get_f4_dir_from_applserv AND RETURN.

IMPORT path_name TO gv_path_name FROM MEMORY ID 'PATH_NAME_SDL'.

p_apser = gv_path_name.

where p_apser is the parameter on the selection-screen.

But using this the application server file paths in AL11 page does open but when we click on any path instead of copying the path into the selection-screen, it further goes down into the directory where we have to select a file. Then we get the pop-up saying - 'Display the contents of the file or copy the file name'...We say 'Copy Name' and then change the copied name to Whatever name we want.

Now my question is - Is it possible to copy only the path into the selection-screen immediately after selecting any path in selection-screen, instead of all the above process?

Thanks in Advance..

Edited by: Dagny on Feb 5, 2009 8:06 AM

9 REPLIES 9
Read only

Former Member
0 Likes
4,052

Hi

U can use function module /SAPDMC/LSM_F4_SERVER_FILE for F4 help.

With Regards,

Dwaraka.S

Read only

shishupalreddy
Active Contributor
0 Likes
4,052

Hello ,

use

fm

FILE_GET_NAME_USING_PATH

FILE_GET_NAME_AND_LOGICAL_PATH

Regards

Read only

Former Member
4,052

Hi,

try like this...

DATA: c_fnh_mask TYPE dxfields-filemask VALUE '*.*',
        search_dir TYPE dxfields-longpath VALUE '/sapglobal/users',
        file_path  LIKE dxfields-longpath.

parameter p_file like rlgrap-filename.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  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.
    p_file = file_path.
  ENDIF.

Read only

0 Likes
4,052

Excellent!

Read only

Former Member
0 Likes
4,052

Hi,,

You can do it,

try the given below code.


PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY,


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  CALL FUNCTION 'F4_FILENAME'
   EXPORTING
*     PROGRAM_NAME        = SYST-CPROG
*     DYNPRO_NUMBER       = SYST-DYNNR
     field_name          = 'P_FILE'
   IMPORTING
     file_name           = p_file

Thanks

Arun Kayal

Read only

Former Member
0 Likes
4,052

Hi Dagny,

You can put f4 help for the file from the above answer,

then you have to use OPEN DATASET CLOSE DATASET statements to save your file into the application server.

Hope it helps you

Regrds

Mansi

Read only

Subhankar
Active Contributor
0 Likes
4,052

Hi..

Please check the sample code below.

parameters: p_fname type localfile.

at selection-screen on value-request for p_fname.

  • Provide a F4 help for source file

perform sub_serverfile_f4.

form sub_serverfile_f4.

  • F4 help for application server file

call function '/SAPDMC/LSM_F4_SERVER_FILE'

exporting

directory = c_path

filemask = space

importing

serverfile = p_fname

exceptions

canceled_by_user = 1

others = 2.

if sy-subrc <> 0.

  • Message 'Unable to find filepath'.

message i000 with 'Unable to find filepath'(003).

endif.

endform. " sub_serverfile_f4

Thanks

Subhankar

Read only

kamesh_g
Contributor
0 Likes
4,052

hi

Lat post can solve your probelm .

Read only

Former Member
0 Likes
4,052

Hi,

The following func module might be helpful.

CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'

  • EXPORTING

  • I_LOCATION_FLAG = ' '

  • 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.

Regards,

Mdi.Deeba Najam.