on 07-09-2014 4:27 PM
Dear Venkat,
Try this code.
Create one custom method with parameter lv_path as type string.
method ZZSPLIT_PATH .
data lv_len type i.
data lv_delimiter type c VALUE '\'.
data lv_lines type i.
data ls_split type string.
data lt_split type table of string.
check iv_path is not initial.
* get path/file separator
* cl_gui_frontend_services=>get_file_separator(
* changing
* file_separator = lv_delimiter
* exceptions
* cntl_error = 1
* error_no_gui = 2
* not_supported_by_gui = 3
* others = 99
* ).
* if sy-subrc <> 0.
* raise_exception( sy-subrc ).
* endif.
* check last char for delimiter
lv_len = strlen( iv_path ) - 1.
if iv_path+lv_len eq lv_delimiter
or lv_delimiter is initial.
* last char = delimiter, so most likely only path has been given
" ev_path = iv_path.
clear ev_name.
return.
endif.
split iv_path at lv_delimiter into table lt_split.
describe table lt_split lines lv_lines.
if lv_lines eq 1.
* only path has been given
" ev_path = iv_path.
clear ev_name.
else.
* path and name have been found
loop at lt_split into ls_split.
if sy-tabix < lv_lines.
" concatenate ev_path ls_split lv_delimiter into ev_path.
else.
ev_name = ls_split.
endif.
endloop.
endif.
endmethod.
on action upload.
Data:lv_text1 type string,
lv_text2 type string.
get the file path.
lo_el_n_upload->get_static_attributes(
importing
static_attributes = ls_n_upload ).
ls_file_details-file_name = wd_this->zzsplit_path( iv_path = ls_n_upload-file_name ).
split ls_file_details-file_name at '.' into lv_text1 lv_text2.
clear: ls_file_details-file_name.
move lv_text1 to ls_file_details-file_name.
append ls_file to lt_file.
lo_nd_file_details->bind_table( new_items = lt_file_details set_initial_elements = abap_true ).
endmethod.
Regards
Jayaprakash T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is no direct way you can use a FILE UPLOAD for this purpose and get the file name attached to it and then you can use the SYST fields for time and date.
Phani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.