2010 Jul 30 12:10 PM
Hi,
I have two reports, one that creates files on the application server, and another that reads the contents of the files and shows them using the WRITE instruction.
When I use the first report and then download the file to my computer (using CG3Y) everything is alright. But when I use the second report some of the characters (Portuguese special characters, e.g. á, ã, é, etc.) that are shown are wrong:
Original:
2B002AG0262350100000660000000100020REF_002 Joaquim Neves Transf. Bancária Indeminização
Output:
2B002AG0262350100000660000000100020REF_002 Joaquim Neves Transf. Bancária Indeminização
The code I'm using to read the files and show their data is:
abrir ficheiro
open dataset lv_filename for input
in text mode
encoding default.
if sy-subrc eq 0.
exportar todos os registos para o ecran
do.
clear lv_output.
read dataset lv_filename into lv_output
maximum length lv_length.
if sy-subrc eq 0.
write lv_output.
else.
exit.
endif.
enddo.
endif.
close dataset lv_filename.
Can anyone help me on this?
Best regards,
Mário Espinheira
2010 Jul 30 12:17 PM
Hi Mario,
I presume this is due to the GUI problem.
Do as specified below. Hope this should solve the issue.
ALt+F12-> Options>I18N---> Check the Activate the multibyte functionalities
Then restart ur PC and try downloading.
Let me know If you still have any issues.
2010 Jul 30 12:17 PM
Hi Mario,
I presume this is due to the GUI problem.
Do as specified below. Hope this should solve the issue.
ALt+F12-> Options>I18N---> Check the Activate the multibyte functionalities
Then restart ur PC and try downloading.
Let me know If you still have any issues.
2010 Jul 30 12:31 PM
It didn't work, the contents of the files are still shown with the wrong special characters.
Thanks for the suggestion anyway
2010 Aug 02 8:16 AM
Hi Mario,
I presume your environment is Unicode.
In Unicode programs, only the content of character-type data objects can be transferred to text files and read from text files. The addition encoding must be specified in Unicode programs, and can only be omitted in non-Unicode programs.
OPEN DATASET filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.OR
Try using method gui_upload of class cl_gui_front_end_services instead of open dataset.
2010 Aug 02 11:59 AM
Hello,
I'm already opening the dataset as you said, and the class CL_GUI_FRONTEND_SERVICES only works with files from the Client PC, not with files from the Application Server like I need it.
Kind regards,
Mário Espinheira
2010 Aug 02 12:22 PM
I tried with UTF-8 encoding & seems to work for me.
DATA: v_asfile TYPE fileextern VALUE '/tmp/Unicode.txt',
v_string TYPE string.
OPEN DATASET v_asfile FOR INPUT IN TEXT MODE ENCODING UTF-8.
DO.
READ DATASET v_asfile INTO v_string.
IF sy-subrc = 0.
WRITE / v_string.
ELSE.
EXIT.
ENDIF.
ENDDO.BR,
Suhas
2010 Aug 02 12:27 PM
Hello,
Tried with encoding UTF-8 and it worked also. Full points awarded.
The problem was reading a backup file that was copied using FM EPS_FTP_PUT. When I read the original file it's all ok.
Thank you!
Edited by: Mario Espinheira on Sep 23, 2010 12:18 PM
2010 Aug 02 8:20 AM
Hi ,
Check with your basis guy if the code page what is set is having these special characters.
Code Page transaction SCP.
Br,
Vijay