Register Login

Convert a report to ascii and save it in an internal table

Updated May 18, 2018

data:
* Internal table for report in ascii format
begin of i_ascii_list occurs 0,
text(134) type c,
end of i_ascii_list.
* Internal table for report in ABAPLIST (Structure for Internal
Table as List Container) format
i_abaplist like abaplist occurs 0 with header line,

End-of-selection.
perform write_list.
perform save_ascii_list.

form write_list.
* Write report to screen
write: / .........
endform.

form save_ascii_list.
*---------------------------------------------------------------------------
* Save report in ascii format in table i_ascii_list
*---------------------------------------------------------------------------


* Save report as List container
CALL FUNCTION 'SAVE_LIST'
* EXPORTING
* LIST_INDEX = '0'

TABLES
listobject = i_abaplist
EXCEPTIONS
list_index_invalid = 1
OTHERS = 2. .
IF sy-subrc 0.
ENDIF.

* Store report i ascii formt in table i_ascii_list
CALL FUNCTION 'LIST_TO_ASCI'
* EXPORTING
* LIST_INDEX = -1
TABLES
listasci = i_ascii_list
listobject = i_abaplist
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc 0.
ENDIF.
endorm.


×