‎2009 Mar 10 7:34 AM
How to return file path without the filename c:\folder1\folder2\folder3?
Pass in c:\folder1\folder2\folder3\abc.txt
Want to return c:\folder1\folder2\folder3
Any code sample or function module?
‎2009 Mar 10 7:36 AM
‎2009 Mar 10 7:40 AM
hi paul,
use this code,,this will solve ur probelm.
DAAT : F_NAME LIKE RLGRAP-FILENAME.
parameter: f_path like rlgrap-filename obligatory.
call function 'F4_FILENAME'
exporting
program_name = sy-repid
dynpro_number = sy-dynnr
importing
file_name = f_name
exceptions
others = 1.
if sy-subrc ne 0 .
write : / 'Enter File Name'.
endif.
With Regards,
T.Durai murugan.
‎2009 Mar 10 7:53 AM
Hi,
u can use either of these FM's
TRINT_SPLIT_FILE_AND_PATH or
SO_SPLIT_FILE_AND_PATH
Keerthi
‎2009 Mar 10 8:05 AM
Function Modules hampers the performance of your program because the memory of the function group get loaded into you program at runtime.So for small requirement avoid FM.. use codes.
DATA:w_path(255) TYPE c VALUE 'c:\folder1\folder2\folder3\abc.txt',
w_file(255) TYPE c,
w_len TYPE i.
w_len = strlen( w_path ).
DO.
IF w_path+w_len(1) = '\'.
w_file = w_path+w_len.
w_path+w_len = space.
EXIT.
ENDIF.
SUBTRACT 1 FROM w_len.
IF w_len LT 1.
EXIT.
ENDIF.
ENDDO.
WRITE : w_path,w_file+1.Try out these codes it will work.
Regards,
Gurpreet
‎2009 Mar 10 8:17 AM
‎2009 Mar 10 8:18 AM
Hi,
Call the method DIRECTORY_BROWSE from class CL_GUI_FRONTEND_SERVICES.
Regards,
Shailaja
‎2009 Mar 10 12:24 PM
hi ,
use below fm to browser for foler or path
TMP_GUI_BROWSE_FOR_FOLDER
or use the below fm to browse the path or get the path by passing full file length
TMP_GUI_GET_TEMPPATH
Regards,
Prabhudas
‎2009 Mar 10 12:37 PM
Try this code:
*FORM fr_f4_app_server CHANGING p_path1.
*
* DATA: lv_input TYPE dxfields-longpath,
* lv_output TYPE dxfields-longpath.
*
* lv_input = p_path1.
*
* CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
* EXPORTING
* i_location_flag = 'A'
* i_path = lv_input
* IMPORTING
* o_path = lv_output
* EXCEPTIONS
* rfc_error = 1
* error_with_gui = 2
* OTHERS = 3.
* IF sy-subrc EQ 0.
* DATA: lv_path TYPE rlgrap-filename.
* lv_path = lv_output.
*
* CALL FUNCTION 'LIST_SPLIT_PATH'
* EXPORTING
* filename = lv_path
* IMPORTING
* pathname = lv_path.
* IF sy-subrc EQ 0.
* p_path1 = lv_path.
* ENDIF.
* ENDIF.
*
*ENDFORM. " FR_F4_APP_SERVER
‎2009 Mar 10 12:46 PM
Hi,
U can use both the fms to get the op as e.x:
TRINT_SPLIT_FILE_AND_PATH or
SO_SPLIT_FILE_AND_PATH
If u pass the parameter as c:\data\abc.text then u will get
STRIPPED_NAME ABc.TXT
FILE_PATH C:\DATA\
Regards