When you've reported your list output, it may just be handy to hang on to this output for later reference. Simple concept: reporting output is set up as a list that is added to until the last WRITE statement is done. When another WRITE statement is executed after the list display is actually displayed, a new "list" is created.
Colors in the list as well as lines, symbols and/or icons are all part of the list. The list can be picked up "as a whole" (function module SAVE_LIST) and the resulting object can be stored. Stored objects can then be retrieved and displayed again (function module DISPLAY_LIST). First of all, list output needs to be populated. Try for example WRITE: / 'Hej dude!' color 7.. When the output is prepared, the following routine can be called to save a list in to table INDX:
* Global data definition:
types: begin of work_tracker_type,
requestor like sy-uname,
create_date like sy-datum,
create_time like sy-uzeit,
end of work_tracker_type.
data: i_LISTOBJECT type table of ABAPLIST,
wa_work_tracker type work_tracker_type.
*-------------------------------------------------------
form store_list_output.
CALL FUNCTION 'SAVE_LIST'
TABLES
LISTOBJECT = i_LISTOBJECT.
* Some information to be stored with the list
wa_work_tracker-requestor = sy-uname.
wa_work_tracker-create_date = sy-datum.
wa_work_tracker-create_time = sy-uzeit.
* Export the selection parameters to the database
export wa_work_tracker
i_LISTOBJECT
to database indx(ZZ) id wa_work_tracker. "tracker info also key
* Message: List output for the process run was saved
message s999(zzz).
endform.
*-------------------------------------------------------
Export to database has wonderful on-line documentation that needs to be studied... Now retrieving the stored list output:
*-------------------------------------------------------
form display_list_output. "Display ALL
data: i_SRTFD type table of INDX_SRTFD with header line.
select SRTFD from indx into table i_SRTFD
where RELID eq 'ZZ'.
if sy-subrc ne 0.
* Message: No work to be processed found (table INDX, area ZZ)
message s999(zzz).
else.
loop at i_SRTFD.
*-------------------------------------------------------
import i_LISTOBJECT
from database indx(ZZ) id i_SRTFD.
*-------------------------------------------------------
if sy-subrc eq 0.
CALL FUNCTION 'DISPLAY_LIST'
EXPORTING
FULLSCREEN = 'X'
TABLES
LISTOBJECT = i_LISTOBJECT.
endif.
endloop.
endif.
endform.
*-------------------------------------------------------
Important note: SAVE_LIST is not suitable for saving lists produced during background processing.
