Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Jigang_Zhang张吉刚
Active Contributor
0 Kudos

It's not convenient to use files generated on the server side and then let the user download files from AL11 compared with generating files locally or getting files as attachments from email. But sometimes, it has to be used as email attachments could exceed the Maximum attachment size limit or time out issue when running front-end.

01-6.jpg


Here, small tips about generating/downloading files that contain Chinese characters from AL11:

Generate file at AL11 using 'open dataset'


The below code has no code page specified, so it's not specific to Chinese characters and could support all other characters as well. (Please check this and this for more details about AL11).

  open dataset gs_outfile for output in text mode encoding default.

 

Download the file at AL11 using CG3Y

 


We have two options here which are ASCII format and Binary format. Many articles tell the difference between Binary and ASCII like this and this one. Here list few points from my perspective:

    • Output file extension could be TXT or DAT. Please do not add file extensions like XLS, XLSX which can't be opened by Excel or Notepad.

 

    • The BIN file is much larger than the ASCII file. For my example, it's 800KB vs 280 KB. After converting the BIN/ASCII formatted file from DAT/TXT to EXCEL, it's 307KB vs. 149 KB.

 

    • Both BIN and ASCII can display Chinese characters correctly when opening with a notepad. But ASCII could be truncated if lots of columns! So always use BIN instead of ASCII for download.

 

    • It's not a good approach to open the converted file by Excel directly. Instead, try using Open->new file, Excel will popup text import wizard, and suggest 65001(UTF-8) by default.






    • There are two types of errors when displaying Chinese characters after converting to a DAT/TXT file(other English text and numbers are showing correctly, not a messy file): one is show # for all Chinese characters, and another one is showing messy code for all Chinese characters.

 

    • # means the file has been generated incorrectly, check the file generation logic. Messy code could be a conversion issue, check the convert logic or convert procedure after generation. Notepad provides the function to save a file as <UTF-8 with BOM>. Just have a try if have a second type error.

 

    • Besides Chinese characters, it could be the same issue for Japanese characters or any language using Double Byte Character Sets (DBCS) as well. If using the program to download those files from AL11 by some FM, please consider the code page accordingly.



 

5 Comments
Labels in this area