编码页是一种用于字符编码的映射表格
将不同的字符集(比如ASCII、Unicode等)中的字符整合到一个特定的计算机系统中,使得这个系统能够与使用不同编码系统的其他计算机系统进行数据交换和通信
sap codepage 由四位数字组成
DATA lv_str TYPE string. lv_str = '中国china1231'. DATA:xstr TYPE xstring. "string按照编码格式转xstring xstr = cl_abap_conv_codepage=>create_out( codepage = 'GB18030' )->convert( lv_str ). xstr = cl_abap_conv_codepage=>create_out_to_sap_cp( sap_cp = cl_abap_conv_codepage=>get_sap_codepage( 'GB18030' ) )->convert( lv_str ). CALL FUNCTION 'SCMS_STRING_TO_XSTRING' EXPORTING text = lv_str encoding = '8400' IMPORTING buffer = xstr. WRITE:/ xstr. lv_str = cl_abap_conv_codepage=>create_in( codepage = 'GB18030' )->convert( xstr ). cl_abap_conv_in_ce=>create( encoding = CONV #( cl_abap_conv_codepage=>get_sap_codepage( 'GB2312' ) ) )->convert( EXPORTING input = xstr IMPORTING data = lv_str ). WRITE:/ lv_str. cl_abap_conv_out_ce=>create( encoding = CONV #( cl_abap_conv_codepage=>get_sap_codepage( 'GB2312' ) ) )->convert( EXPORTING data = lv_str IMPORTING buffer = xstr ). WRITE:/ xstr.
标签:conv,cl,codepage,abap,lv,ABAP,xstr,Sap,Codepage From: https://www.cnblogs.com/Lingcc/p/18323044