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 Folder in Application Server

Former Member
0 Likes
5,438

Hi All,

My requirement is to get folder path(not filepath) in Application server F4 help.

Please Help.

Thanks,

Anon.

8 REPLIES 8
Read only

Former Member
0 Likes
2,071

Check out FM F4_dxfilename_toprecursion for F4 help of application file

Read only

0 Likes
2,071

But i need the Folder path and not the file path.

I already tried FM F4_dxfilename_toprecursion, but it returns the filepath and not the folder.

My requirement is to Create a file at the selected folder path.

Thanks,

Anon.

Read only

Former Member
0 Likes
2,071

hi,

this might healp you ought

SELECTION-SCREEN BEGIN OF BLOCK DATA WITH FRAME TITLE TEXT-001.

PARAMETERS: P_FILE TYPE RLGRAP-FILENAME DEFAULT 'C:\WINDOWS\Desktop' OBLIGATORY.

SELECTION-SCREEN END OF BLOCK DATA.

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.

Read only

Former Member
0 Likes
2,071

Hi,

The problem was not solved by using the FMs you provided.

After searching a lot, we got a function module which solved the problem.

The FM is '/SAPDMC/LSM_F4_SERVER_FILE'.

Thanks,

Anon

Read only

0 Likes
2,071

Silver Could you plz explain how did you achieve the requirement using '/SAPDMC/LSM_F4_SERVER_FILE' ?

Read only

0 Likes
2,071

DATA: t_dir TYPE TABLE OF dynpread,

          w_dir TYPE dynpread,

           l_path TYPE string,

           l_dir  TYPE btch0000-text80.

  CONSTANTS: c_l TYPE char1 VALUE '/,

                       c_1000 TYPE char4 VALUE '1000'.

  CLEAR: w_dir, l_path, l_dir.

  REFRESH t_dir.

  w_dir-fieldname = 'P_DIRSER'.

  APPEND w_dir TO t_dir.

  CALL FUNCTION 'DYNP_VALUES_READ'

    EXPORTING

      dyname     = sy-repid

      dynumb     = c_1000

    TABLES

      dynpfields = t_dir.

  READ TABLE t_dir INTO w_dir INDEX 1.

  l_path = w_dir-fieldvalue.

  SHIFT l_path RIGHT DELETING TRAILING c_l.

  CONDENSE l_path. CONCATENATE l_path c_l INTO l_path.

  w_dir-fieldvalue = l_path.

  l_dir = w_dir-fieldvalue.

  CALL FUNCTION 'PFL_CHECK_DIRECTORY'

    EXPORTING

      directory                   = l_dir

    EXCEPTIONS

      pfl_dir_not_exist           = 1

      pfl_permission_denied       = 2

      pfl_cant_build_dataset_name = 3

      pfl_file_not_exist          = 4

      OTHERS                      = 5.

  IF sy-subrc NE 0.

    MESSAGE 'File not found' TYPE 'I'.

    EXIT.

  ENDIF.

  CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

    EXPORTING

      directory        = w_dir-fieldvalue

      filemask         = '*'

    IMPORTING

      serverfile       = p_dirser

    EXCEPTIONS

      canceled_by_user = 1

      OTHERS           = 2.

  IF sy-subrc = 0.

    CONCATENATE p_dirser c_l INTO p_dirser.

  ENDIF.

Read only

Former Member
0 Likes
2,071

Hi Vrithika,

FM  '/SAPDMC/LSM_F4_SERVER_FILE'  will suit your requirement.

To  retrieve only folder paths, pass the FILEMASK as 'directory' to the function module

Regards,

Read only

0 Likes
2,071

Hi Rojer,

Can u pls elaborate what do u mean by passing 'directory' to FILEMASK parameter.

I do have the similar requirement of getting the directory path not the filepath.

Thanks in advance.