03-22-2010 10:11 AM
Hi Friends,
I have a excel sheet in one of the directory in application server...
Now iam opening the data in text mode to read line by line of the excel..
Open data Zsample in text mode encoding default
Now iam able to open a file here but when i try to read data using read dataset iam getting a short dump here...
The dump error is cannot convert to code page 4102.
Now how to over come this senario... i tried using UTF-8 also but iam getting the same dump.. UTF-16 is giving me a syntax error.
when i tried to open the same excel sheet using AL11 manually iam getting the same dump as above..
Now my question is can we read an excel file from application server... if so how to proceed further .. ?
Suggestions will be appreciated..
Regards
Kumar
03-22-2010 10:13 AM
Hello,
Try using the IGNORING CONVERSION ERROR addition in the open dataset statement and check
Open dataset zsample in text mode encoding default ignoring conversion errors.
Vikranth
03-22-2010 2:10 PM
Hi Vikranth,
I used the syntax Ignorning Conversion Errors
By that syntax iam able to read the data from the excel file and appending into internal table itab.
But here iam getting the data as ####%##74##############+#######$@####4@####4@#####@###
How can i correct it..
Regards
Kumar
03-22-2010 2:36 PM
is the character indicating a character which could not be translated. ignoring conversion error is not a miracle which eliminates errors in a secret manner.
03-22-2010 2:45 PM
Hi Rainer,
How to over come this error...
can any one suggest me..
Regards
kumar
03-22-2010 3:00 PM
Why didnt you answer my question about excel and csv?
And if the system prompts you to install a codepage, you need to do that. Ignoring this will give hash sign for all characters which can not be converted.
03-22-2010 3:44 PM
Hi Rainer,
My Question is Dataset Problem while reading an excel file
Yes it is a excel file..
How to correct this..
Regards
Kumar
03-22-2010 10:27 AM
03-22-2010 4:50 PM
Hi Kumar
I think that read the excel(native) file by Open Dataset is impossible (not in text mode) because it isn't be a text file and without OLE2 you don't get any information from there.
Best Regards
Szymon Glapiak
03-22-2010 5:06 PM
Any further info on this...
or else how to covert ####%##74##############+#######$@####4@####4@#####@###
into charecter format..
Regards
Kumar
03-22-2010 5:31 PM
kumar,
I am pretty sure that this cannot, be done. Excel (.XLS) is a Microsoft proprietary format that need to be properly translated. The open dataset, read, and transfer statement simply reads and right raw data. I believe it has no chance of being able to translate it properly. Your best option would be to save the Excel file into a CSV file prior to putting it on the application server. Then you can read it without problems using open dataset and read. Otherwise you will have a very very long row to hoe.
I also am assuming that this program is running as a background process or that the Excel file cannot be saved locally or on the network.. If it can be run interactive, then you have a shot using a FM such as ALSM_EXCEL_TO_INTERNAL_TABLE and others.
03-22-2010 9:22 PM
any further approach on this...
Moderator message - Please do not offer po1nts
Regards
Kumar
Edited by: Rob Burbank on Mar 22, 2010 5:35 PM
03-23-2010 12:15 AM
Why don't you try using open dataset in BINARY MODE.
OPEN DATASET p_file FOR INPUT IN BINARY MODE.
In this way you get all the data as an XSTRING and then to convert xstring to string data type use this [link|http://www.divulgesap.com/blog.php?p=NjA=].
Cheers,
Ravi
03-23-2010 12:36 PM
What part of
You cant upload/interpret an excel file via open dataset
you dont understand?
Transform the file into CSV which is readable.
03-23-2010 12:29 PM
u can use like that
data w_lfimg(17).
*Concatenating data and time into file.
concatenate filepath
sy-datum
sy-uzeit
'.csv'
into filepath.
htab = cl_abap_char_utilities=>horizontal_tab.
OPEN DATASET filepath FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.