ABAP--关于Unicode的常见错误和解决方法

本文详细介绍了在ABAP中遇到的Unicode错误及其解决方案,包括OPEN DATASET、WS_UPLOAD/WS_DOWNLOAD、UPLOAD/DOWNLOAD、WS_EXECUTE等函数模块的使用问题,并提供了相应的修正代码。同时,提到了在转换、文件操作和结构赋值中需要注意的Unicode兼容性问题。
摘要由CSDN通过智能技术生成

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               
Unicode

Unicode is the international character encoding standard that allows the systems to handle text data from multiple languages simultaneously and consistently. In fact, more than 5,000 SAP customer installations are already purely Unicode-based, and the relative share of pure Unicode installations is growing rapidly. Many companies are adopting Web services to gain benefits such as greater openness that extends processes to customers and business partners.
Service-oriented architectures (SOAs), including SAP's Enterprise Services Architecture,rely on a set of standards that enable global interoperability across systems, programming languages, and application services.
One of these required standards is Unicode.Much of the enterprise software out there is already completely Unicode-ready.Everything in the Java space and everything based on XML is Unicode by definition.New system installations will have to be Unicode only in future releases and new SAP products will only be offered in Unicode.In fact, SAP NetWeaver Portal and SAP NetWeaver Exchange Infrastructure (XI) are already Unicode-only.Each character has a unique number („Unicode code point") Notation U+nnnn (where nnnn are hexadecimal digits) See http://www.unicode.org for complete code charts

 

Note:
Unicode flag ( "Unicode checks active") is used as a Program Attribute to control the Unicode enabling procedure


A program without Unicode flag is NOT executable on a Unicode system. Transaction UCCHECK can be used as tool to analyze customer coding for unicode errors.

 

Common Unicode Errors and Their Corrections:

1. Error regarding OPEN DATASET:
 Before Unicode:  
 OPEN DATASET P_UNIX FOR OUTPUT IN TEXT MODE.
 Resolution:
 OPEN DATASET P_UNIX FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
 OR
 OPEN DATASET P_UNIX FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
 OR
 OPEN DATASET P_UNIX FOR OUTPUT IN LEGACY TEXT MODE.
  The choice of resolution depends on the kind of data the file contains. The addition ENCODING defines how the characters are represented in the text file. When writing to a text file, the content of a data object is converted to the representation entered after ENCODING, and transferred to the file. The same rule is followed for reading files using the OPEN DATASET command.
 
 Before Unicode:
 OPEN DATASET P_UNIX FOR OUTPUT IN BINARY MODE.
 Resolution:
 OPEN DATASET P_UNIX FOR OUTPUT IN LEGACY BINARY MODE.
Note: Some time it is possible that mode has not been specified in old system, then by default system will take it as BINARY mode, We should add LEGACY BINARY mode for such syntax.

 

2. Error regarding WS_UPLOAD/WS_DOWNLOAD.
 Before Unicode:
  Parameters: filename (128) lower case.
 CALL FUNCTION 'WS_UPLOAD'
 EXPORTING
 FILENAME      = filename
 FILETYPE      = 'DAT'
 TABLES
 DATA_TAB      = I_INREC
 EXCEPTIONS
 FILE_OPEN_ERROR            = 1
 FILE_READ_ERROR            = 2
 CONVERSION_ERROR        = 3
 INVALID_TABLE_WIDTH    = 4
 INVALID_TYPE               = 5
 NO_BATCH                   = 6
 UNKNOWN_ERROR              = 7.
 
 Resolution:
 Data:w_filename TYPE STRING.
 Field-symbols:  <fs_filename> type any.
 Assign filename to <fs_filename>.
 Move <fs_filename> to w_filename.
 
 CALL FUNCTION 'GUI_UPLOAD'
 EXPORTING
 FILENAME = w_filename
 FILETYPE = 'DAT'
 TABLES
 DATA_TAB = I_INREC
 EXCEPTIONS
 FILE_OPEN_ERROR = 1
 FILE_READ_ERROR = 2
 NO_BATCH        = 3
 GUI_REFUSE_FILETRANSFER = 4
 INVALID_TYPE            = 5
 NO_AUTHORITY            = 6
 UNKNOWN_ERROR           = 7
 BAD_DATA_FORMAT         = 8
 HEADER_NOT_ALLOWED      = 9
 SEPARATOR_NOT_ALLOWED   = 10
 HEADER_TOO_LONG         = 11
 UNKNOWN_DP_ERROR        = 12
 ACCESS_DENIED           = 13
 DP_OUT_OF_MEMORY        = 14
 DISK_FULL               = 15
 DP_TIMEOUT              = 16
 OTHERS                  = 17.
The Function Modules WS_UPLOAD / WS_DOWNLOAD is obsolete and hence need to be replaced by their new counterparts' viz. GUI_UPLOAD / GUI_DOWNLOAD.

3.Error regarding UPLOAD / DOWNLOAD:
 Before Unicode:

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值