06/08/2010

Report Output Into Table


REPORT ZRRSAMPLE.

DATA: BEGIN OF listout OCCURS 0,
line(1024) TYPE c,
END OF listout.

* Submit the report and export list to memory
SUBMIT ZTESTE10 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. "retrieve_list_from_memory

Nenhum comentário:

Postar um comentário