ABAP Output More Then 255 Characters
If you want to write the output to a report list, there are a number of function modules that will convert a string into a table of variably-sized lines. An example:
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.
CodeMonkey
Updated on June 04, 2022Comments
-
CodeMonkey almost 2 years
We have an abap program that runs in the background and calls out to a web service. Recently we have been getting errors from the web service. Unfortunately we are only able to see the first 255 characters of this error, and we would like to see the entire stack dump (comes from a C#.net web service).
Function module:
"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.
The program then checks the error_string
IF error_string IS INITIAL. WRITE: / jobid. ELSE. PERFORM send_mail. WRITE: / error_string. ENDIF.
Once an error is logged we would like to go back to the Spool and view the entire error message (this will be a large XML message from web server 2000+ characters).
Is this possible?EDIT: error_string TYPE string. Program and function module are zprograms written in house. Program is called as ABAP process in SAP BW process chain to trigger action from web server.