‎2012 Jun 19 4:45 AM
Hello
Requirement is: User will pick an excel file from local machine and expets data base update as per that excel file
So, i am reading that excel file into program(report prog. user will run it ONLINE/MANUALLY) specific internal table by using the below FM / code,
Note: We are on Windows 7 with dot XLSX format Excel, ECC 60 with GUI 720
DATA: it_excel TYPE STANDARD TABLE OF alsmex_tabline.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '10'
i_end_row = '2000'
TABLES
intern = it_excel (declared as )
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
But, when user is runing this report, user is getting below popup (MS Excel popup, saying that, Do you wan to save the changes you made to 'test_excel_file' with a 3 push buttons, like, SAVE DON'T SAVE CENCEL), pls. see the attached JPEG file
Pls. let me know how can i fix it? or i should use ther function module instaed of the above FM?
Thank you
‎2012 Jun 19 5:06 AM
Hi MSR,
What other options have you tried?
TEXT_CONVERT_XLS_TO_SAP
Thanks,
Shambu
‎2012 Jun 19 5:34 AM
Dear MSR,
I dont think ALSM_EXCEL_TO_INTERNAL_TABLE will give error for .xlsx files.
Check the code. There might be additional code that you have added.
‎2012 Jun 19 5:44 AM
Dear MSR.
Try this code..
form UPLOAD_DATA .
DATA: loc_filename TYPE rlgrap-filename. "string.
DATA: it_raw TYPE truxs_t_text_data.
loc_filename = p_file.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
* I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = loc_filename
TABLES
i_tab_converted_data = it_itab "gt_upload[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
endform. " UPLOAD_DATA
Please post back with your results
Regards,
Venkat
‎2012 Jun 19 5:57 AM
Hi MSR,
FM ALSM_EXCEL_TO_INTERNAL_TABLE should not give any issue for reading Excel files.
It might be the case that " yvmcon01 bdc template " is the Excel file already opened in your machine with some changes made in it and then you are using same file for uploading.
Also you can check below link where z_file_upload_download is used for Upload/Download :
You just need to create Z function module using SE37 as below::
‎2012 Jun 19 6:49 AM