‎2009 Feb 03 12:21 PM
hi experts,
i want to upload excel file from application server through open dataset .
what code should i use.
please take your time replying. No hurry.
Thanks & Rgds
Zeba
Edited by: Matt on Feb 3, 2009 1:22 PM
‎2009 Feb 03 12:24 PM
Hi:
have a look
http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3d42358411d1829f0000e829fbfe/content.htm
Regards
Shashi
‎2009 Feb 03 12:27 PM
Plz SEARCH in SCN you will get so many posts like these.
[upload excel file to application server using open dataset |https://forums.sdn.sap.com/click.jspa?searchID=21772322&messageID=5782605]
take your time for searching.No hurry .
‎2009 Feb 03 12:28 PM
Hi,
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR = 'X'
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file
TABLES
i_tab_converted_data = it_final[]
EXCEPTIONS
conversion_failed = 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.
Hope it will help you.
Thanks
Arun Kayal
‎2009 Feb 03 12:32 PM
Hi,
Hope the below sample code helps u.
**&---------------------------------------------------------------------*
**& Form f_read_from_server
**&---------------------------------------------------------------------*
*
form f_read_from_server.
perform f_fname_print.
open dataset lv_filename for input in text mode encoding default.
if sy-subrc = 0.
perform f_file_server.
endif.
endform. "f_read_from_server
*
**&---------------------------------------------------------------------*
**& Form f_file_server
**&---------------------------------------------------------------------*
*
form f_file_server .
n_filedata = 0.
if sy-subrc = 0.
message s102.
do.
n_1 = n_1 + 1.
read dataset lv_filename into wa_file_as.
if sy-subrc = 0.
if n_1 <> 1.
split wa_file_ps at c_separ into lv_plant
lv_costelt
lv_fixcost
lv_varcost.
wa_data2-zplant = lv_plant.
wa_data2-zcost_element = lv_costelt.
wa_data2-zfixed_cost = lv_fixcost.
wa_data2-zvariable_cost = lv_varcost.
translate wa_data2-zcost_element to upper case.
n_filedata = n_filedata + 1.
wa_data2-counter = count + 1.
append wa_data2 to it_file_data.
count = count + 1.
endif.
perform f_validation2.
else.
exit.
endif.
enddo.
else.
perform f_error_msg
using text-003.
endif.
close dataset lv_filename.
endform. " f_file_server
Thanks.