07-25-2010 8:09 AM
Hi,
In selection screen (parameter) user will give input TXT file from presentation server to upload to SAP. I need to capture the file name only but not the path and need to concatenate with date stamp and need to download error log in XLS file to presentation server.
How to find out the file name from selection screen?
I searched SCN threads but not found relavant solution.
Thanks,
R Kumar
07-25-2010 11:50 AM
Kumar,
you can use this fm TRINT_SPLIT_FILE_AND_PATH
Thanks
Bala Duvvuri
07-25-2010 3:23 PM
hello,
Please check the class CL_GUI_FRONTEND_SERVICES....there you will find suitable methods for GUI related transaction.
Thanks
07-25-2010 5:44 PM
Its difficult to get what user will be giving file name for uploading and from which particular folder .
Example -File path-
C:\ABC\upload.txt
Declare a internal table with atleast 10 fields of 20 Char.(As per you require)
And then after getting the file name .Try to use SPLIT command with '\' .
As each folder and file name is seperated by '\' and get them in internal table .
Check for filed with extension .txt after looping and you will get the file name .
Hope u got an idea.
After split ,itab will have values like for file path : C:\ABC\upload.txt
Itab-first = C:
Itab-second = ABC
Itab-third = upload.txt
Itab-fourth = Blank
Itab-fifth =Blank.
So Itab-third contains the file name,Which you want .
Use CONCATENATE statement to add date etc for the file name.
Thanks!
07-25-2010 8:12 PM
Hi
This code gets only filename from selection screen :
REPORT x.
PARAMETERS p_file(100).
DATA : gv_full_path LIKE ibipparms-path,
gv_full_path_string TYPE string,
gv_filename(100),
gv_file_ext(3).
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Ask user to select file with a popup :
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = gv_full_path.
Get filename from path :
gv_full_path_string = gv_full_path.
CALL FUNCTION 'CH_SPLIT_FILENAME'
EXPORTING
complete_filename = gv_full_path_string
IMPORTING
extension = gv_file_ext
name = gv_filename.
CONCATENATE gv_filename '.' gv_file_ext INTO gv_filename.
p_file = gv_filename.
I hope it helps.