Here a handy function module that shows the local or server directory depending on the location we specify.
data: l_path type dxfields-longpath,
l_o_path type dxfields-longpath.
l_path = ch_path.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = im_location
* I_SERVER =
I_PATH = l_path
* FILEMASK = '*.*'
* FILEOPERATION = 'R'
IMPORTING
* O_LOCATION_FLAG =
* O_SERVER =
O_PATH = l_o_path
ABEND_FLAG = ex_abend_flag
EXCEPTIONS
RFC_ERROR = 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.
ch_path = l_o_path.
l_o_path type dxfields-longpath.
l_path = ch_path.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = im_location
* I_SERVER =
I_PATH = l_path
* FILEMASK = '*.*'
* FILEOPERATION = 'R'
IMPORTING
* O_LOCATION_FLAG =
* O_SERVER =
O_PATH = l_o_path
ABEND_FLAG = ex_abend_flag
EXCEPTIONS
RFC_ERROR = 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.
ch_path = l_o_path.
I_LOCATION_FLAG "A" for application server, "P" for presentation server.
Inside this function module, the method cl_gui_frontend_services-file_open_dialog and the function module F4_DXFILENAME are called, which are the ones used commonly when we work with file systems.
No comments:
Post a Comment