Google Search - Blog...........

Transfer Report Program Output To Internal Table

report zcal_another_rep .


data: begin of listout occurs 0,
line(1024) type c,
end of listout.

* Submit the report and export list to memory
submit YTESTSTSSTS exporting list to memory
and return.

* Get list from memory and convert to ascii
perform retrieve_list_from_memory tables listout.

loop at listout.
write:/ listout.
endloop.

************************************************************************
* RETRIEVE_LIST_FROM_MEMORY
************************************************************************
form retrieve_list_from_memory tables reportlines.

data: list like abaplist occurs 0 with header line.
data: txtlines(1024) type c occurs 0 with header line.

clear : list , reportlines .
refresh : list , reportlines.

call function 'LIST_FROM_MEMORY'
tables
listobject = list
exceptions
not_found = 1
others = 2.

check sy-subrc = 0.

call function 'LIST_TO_ASCI'
tables
listobject = list
listasci = txtlines
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.

check sy-subrc = 0.

reportlines[] = txtlines[].

call function 'LIST_FREE_MEMORY'.

endform.

No comments:

Post a Comment