我们有一个ABAP程序,它在后台运行并调用web服务。最近我们从web服务中得到错误。不幸的是,我们只能看到这个错误的前255个字符,我们希望看到整个堆栈转储(来自c# .net web服务)。
功能模块:
"call out to web service code goes here
IF jobid CS 'Success'.
EXIT.
ELSEIF jobid CS 'Error'.
error_string = jobid.
EXIT.
ELSEIF jobid IS INITIAL.
error_string ='NULL Value Returned'.
EXIT.
ELSE.
CONCATENATE 'Unknown Error' jobid INTO error_string SEPARATED BY ':' IN CHARACTER MODE.
ENDIF.
程序检查error_string
IF error_string IS INITIAL.
WRITE: / jobid.
ELSE.
PERFORM send_mail.
WRITE: / error_string.
ENDIF.
一旦错误被记录,我们想回到Spool并查看整个错误消息(这将是来自web服务器2000+字符的大型XML消息)。
这可能吗?
编辑:error_string TYPE字符串。程序和功能模块是内部编写的程序。程序被称为SAP BW流程链中的ABAP流程,用于触发web服务器的操作。
如果您想要将输出写入报表列表,那么有许多函数模块可以将字符串转换为包含可变大小行的表。一个例子:
REPORT ztest_string_to_table LINE-SIZE 120.
CONSTANTS co_line_size TYPE i VALUE 60.
TYPES: t_line TYPE c LENGTH co_line_size.
DATA: l_string TYPE string,
lt_lines TYPE TABLE OF t_line.
FIELD-SYMBOLS: <l_line> TYPE t_line.
l_string = |Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus odio |.
l_string = |{ l_string }lorem, consectetur a est sed, dignissim mattis est. Maecenas |.
l_string = |{ l_string }id pulvinar diam. Pellentesque nec lacinia metus. In a sapien |.
l_string = |{ l_string }nisl. Morbi sem dolor, porta non sodales eu, elementum et lorem. |.
l_string = |{ l_string }Fusce ut suscipit enim. Aliquam imperdiet, nisi dapibus dictum |.
l_string = |{ l_string }tempor, elit tellus eleifend justo, sit amet imperdiet tellus |.
l_string = |{ l_string }nisl id enim. Fusce aliquam nunc augue, imperdiet tincidunt |.
l_string = |{ l_string }purus congue non. Fusce vestibulum tincidunt lorem, ac mattis |.
l_string = |{ l_string }dolor pharetra nec. Maecenas ullamcorper tincidunt elit et |.
l_string = |{ l_string }pellentesque. Curabitur in semper arcu, at adipiscing lorem.|.
l_string = |{ l_string }Lorem ipsum dolor sit amet, consectetur adipiscing elit. |.
l_string = |{ l_string }Nunc ultricies fermentum pellentesque.|.
CALL FUNCTION 'SWA_STRING_TO_TABLE'
EXPORTING
character_string = l_string
line_size = co_line_size
IMPORTING
character_table = lt_lines.
LOOP AT lt_lines ASSIGNING <l_line>.
WRITE: / <l_line>.
ENDLOOP.
检查报表语句的LINE-SIZE参数。例如,
report ztest line-SIZE 9.
data: error type string.
error = '1234567890'.
write error.
输出:
123456789
注意行长最大值是1023。为了看到全部内容,您需要将消息分成多行。