‎2009 Jul 29 7:18 PM
hye techies,
when i am uploading an *.xls file using GUI_UPLOAD i am getting error message accces denied. Please help.
regards,
Imran
‎2009 Jul 29 7:27 PM
HI,
Try using this FM for uloading the .xls files.
ALSM_EXCEL_TO_INTERNAL_TABLE
Regards,
Satish
‎2009 Jul 29 7:28 PM
Hi, Imran
I think your Excel File is Open please Check and try after Closing and also place the file one the else drive mean not place it on the driver where your OS Installed
Please Reply if else Issue,
Best Regards.
Faisal
‎2009 Jul 29 7:42 PM
hye Altaf,
Thanks for the reply. It partially solved my problem.
I am using internal table which has 2 fields, one char24 and other is char4.
The first coloum mite have entries which start with 0. So in excel i am making the coloum customized to 24 characters text.
when i am executing upload from excel FM which is now opening, the internal table has so many rows almost 36 rows with values ########$#%#@@ #### .. many are spl symbols.
Please help.
Thanks,
Imran.
‎2009 Jul 29 7:57 PM
I am not sure, but in GUI_UPLOAD, you can try with "ASC" type
Kuntal
‎2009 Jul 29 8:15 PM
Hi, Imran
I think you better to SAVE AS that XLS file to CSV file when you will save this file as from the other file option you can select file type as CSV after save as open this CSV file in NOTEPAD you will see a ',' after every Field now you can up load this using GUI_UPLOAD File Type ASC internal table for upload of following type
data : begin of mitab occurs 1000,
row(200) type c,
end of mitab.than loop at that table and use the following way.
split mitab-row at ',' into
itab-field1 itab-field2 itab-field3.and than append this to your Final table.
Hope will be helpful for you .
Please Reply if any issue,
Best Regards,
Faisal
‎2009 Jul 29 8:30 PM
Hi, Imran
Test the following Sample Code it is working fine for me hope will solve out your problem too.
TYPES: BEGIN OF ty_test,
row(200), "( name, amount )
END OF ty_test.
TYPES: BEGIN OF ty_final, " Because i have only two Col in my Excel file and now in CSV
name(50), " it is like this ( name, amount )
amount TYPE p DECIMALS 2,
END OF ty_final.
DATA: it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
DATA: it_final TYPE STANDARD TABLE OF ty_final WITH HEADER LINE,
camount(20).
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\TEST.CSV'
filetype = 'ASC'
TABLES
data_tab = it_test[].
LOOP AT it_test.
WRITE: / it_test-row.
SPLIT it_test AT ',' INTO it_final-name camount.
it_final-amount = camount.
APPEND it_final.
ENDLOOP.
LOOP AT it_final.
WRITE: / it_final-name, it_final-amount.
ENDLOOP.Thanks and Regards,
Faisal
‎2009 Jul 30 4:45 AM
Hi,
Try out the following code:
DATA: lv_filetype(10) TYPE c,
lv_gui_sep TYPE c,
lv_file_name TYPE string.
lv_filetype = 'ASC'.
lv_gui_sep = 'X'.
lv_file_name = pa_dfile.
FM call to upload file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = lv_file_name
filetype = lv_filetype
has_field_separator = lv_gui_sep
TABLES
data_tab = gi_zhralcon_file.
First save your excel file as tab delimited file and then execute the code.
file should be closed when you execute the code.
it will help you.
Regards,
Rajesh Kumar
‎2009 Jul 30 7:59 AM
hii Imran,
You cannot use .xls in GUI_UPLOAD.
Convert the file to Tab-delimited and then Try using DAT format.
DATA P_FILET TYPE STRING.
PARAMETERS: P_FILE1 TYPE IBIPPARMS-PATH.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
IMPORTING
FILE_NAME = P_FILE1.
P_FILET = P_FILE1.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = P_FILET
FILETYPE = 'DAT'
TABLES
DATA_TAB = IT_DATA.or
if u want to upload data directly from Excel (i.e. without converting it to tab-delimited) then use
FM F4_FILENAME as mentioned above.
Data T_TAB LIKE STANDARD TABLE OF FS_TAB.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
*** I_FIELD_SEPERATOR =
*** I_LINE_HEADER =
I_TAB_RAW_DATA = T_TAB
I_FILENAME = P_FILE
TABLES
I_TAB_CONVERTED_DATA = IT_DATA[]. "Body of Your Internal TableRegards,
Apoorv