abap read_text方法有时会读不出数据 30
CALLFUNCTION'READ_TEXT'EXPORTINGID='F02'LANGUAGE='1'"zhNAME=nameOBJECT='EKPO'TABLESLI...
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID ='F02'
LANGUAGE ='1' "zh
NAME = name
OBJECT = 'EKPO'
TABLES
LINES = lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
OTHERS = 6.
使用上述方法测试发现如果文本中包含 ’&‘符号,此方法会读不出数据,有没有办法全部能读出来啊? 展开
EXPORTING
ID ='F02'
LANGUAGE ='1' "zh
NAME = name
OBJECT = 'EKPO'
TABLES
LINES = lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
OTHERS = 6.
使用上述方法测试发现如果文本中包含 ’&‘符号,此方法会读不出数据,有没有办法全部能读出来啊? 展开
2个回答
展开全部
请参考:
REPORT ztestlx1.
SELECTION-SCREEN BEGIN OF BLOCK bl01.
PARAMETER: p_ebeln LIKE ekpo-ebeln OBLIGATORY. "采购凭证号
PARAMETER: p_ebelp LIKE ekpo-ebelp OBLIGATORY. "采购凭证行项目号
SELECTION-SCREEN END OF BLOCK bl01.
DATA: tdname LIKE thead-tdname.
DATA: line1 LIKE TABLE OF tline WITH HEADER LINE.
DATA: txt2(120) TYPE c.
DATA: BEGIN OF line2 OCCURS 0,
value(120) TYPE c,
END OF line2.
CONCATENATE p_ebeln p_ebelp INTO tdname.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F02'
language = '1'
name = tdname
object = 'EKPO'
TABLES
lines = line1
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
* EXPORTING
* LANGUAGE = SY-LANGU
* LF = ' '
* IMPORTING
* STREAM_LINES =
TABLES
itf_text = line1
text_stream = line2
.
READ TABLE line2 INDEX 1.
txt2 = line2-value.
REFRESH line2.CLEAR line2.
ENDIF.
WRITE:/ txt2.
REPORT ztestlx1.
SELECTION-SCREEN BEGIN OF BLOCK bl01.
PARAMETER: p_ebeln LIKE ekpo-ebeln OBLIGATORY. "采购凭证号
PARAMETER: p_ebelp LIKE ekpo-ebelp OBLIGATORY. "采购凭证行项目号
SELECTION-SCREEN END OF BLOCK bl01.
DATA: tdname LIKE thead-tdname.
DATA: line1 LIKE TABLE OF tline WITH HEADER LINE.
DATA: txt2(120) TYPE c.
DATA: BEGIN OF line2 OCCURS 0,
value(120) TYPE c,
END OF line2.
CONCATENATE p_ebeln p_ebelp INTO tdname.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F02'
language = '1'
name = tdname
object = 'EKPO'
TABLES
lines = line1
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
* EXPORTING
* LANGUAGE = SY-LANGU
* LF = ' '
* IMPORTING
* STREAM_LINES =
TABLES
itf_text = line1
text_stream = line2
.
READ TABLE line2 INDEX 1.
txt2 = line2-value.
REFRESH line2.CLEAR line2.
ENDIF.
WRITE:/ txt2.
更多追问追答
追问
没有回答到点子上。
追答
你的问题不就是有了&符号后数据显示为&"的形式吗?
如"测试&$特殊符号"显示为
"测试&$特殊符号"?你想让他正常显示?难道不是这个问题?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询