adesso orange🍊Stellenangebote:
Software Engineer Trainee · Senior
| (Senior) Cloud Software Engineer BTP
(Senior) Consultant Technologie · Consultant ABAP
Werkstudent Softwareentwicklung · Fiori / UI5 · Consulting · Application Management
Datei Upload auf Applikationsserver
Aus SAP Wiki ツ
Codeschnipsel
DATA: data_tab TYPE rsanm_file_table,
filename TYPE string,
path_filename TYPE string,
table TYPE STANDARD TABLE OF t_line,
to_dir_file TYPE string,
TRY.
path_filename = p_up,
"Upload from client to application server
cl_gui_frontend_services=>gui_upload( EXPORTING filename = path_filename
CHANGING data_tab = table ).
data_tab = table.
"File from Path
lcl_utilities=>get_filename_from_path( EXPORTING iv_path_filename = path_filename IMPORTING ev_filename = filename ).
"Rename it with Filename pattern from cust table and date/time stamp
lcl_utilities=>rename_build_to_dir_path( EXPORTING iv_filename = filename
io_cust = cust
IMPORTING ev_path_filename = to_dir_file ).
"Write file to application server
cl_rsan_ut_appserv_file_writer=>appserver_file_write( EXPORTING i_filename = to_dir_file
i_data_tab = data_tab
i_overwrite = abap_true
IMPORTING e_lines_written = DATA(lines_written) ).
"User has uploaded the selected file
MESSAGE s018(zbc_dir_file) WITH sy-uname filename to_dir_file INTO DATA(msgg).
zcl_bc_application_log=>add_sy_msg_to_bal_msg_tab( CHANGING xt_bal_msg = messages_bal_msg_tab ).
MESSAGE s016(zbc_dir_file) WITH filename.
CATCH zcx_bc_basic INTO DATA(cx_basic).
RAISE EXCEPTION TYPE zcx_bc_basic
MESSAGE e023(zbc_dir_file) WITH filename.
ENDTRY.