Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Exporting list from memory

Former Member
0 Likes
13,579

i want to know how to retrieve the list that has been saved using exporting list from memory....how to use list_from_memory module??

6 REPLIES 6
Read only

suresh_datti
Active Contributor
0 Likes
5,080

Hi,

You EXPORT TO MEMORY & use LIST_FROM_MEMORY to import the list into an itab from memory. You have to then use 'LIST_TO_ASCI' to use the data in the Program & ofcourse close the deal with the function call 'LIST_FREE_MEMORY'.

Regards,

Suresh Datti

Read only

Former Member
0 Likes
5,080

Hi sruthi,

1. In this way.

data : P_LIST like ABAPLIST occurs 1 with header line.

call function 'LIST_FROM_MEMORY'

tables

LISTOBJECT = P_LIST.

regards,

amit m.

Read only

Former Member
0 Likes
5,080

Hi,

Once you submit the report using sumit .. exporting list to memory.

Use FM :

DATA BEGIN OF itab_list OCCURS 0.

INCLUDE STRUCTURE abaplist.

DATA END OF itab_list.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = itab_list

EXCEPTIONS

not_found = 4

OTHERS = 8.

Also refer following link :

http://www.sapdevelopment.co.uk/reporting/rep_submit.htm

Best regards,

Prashant

Read only

Former Member
5,080

This is from 'F1' on Submit statement

Addition 3

... EXPORTING LIST TO MEMORY

Effect

This addition stores the basic list for the program accessed in the ABAP Memory. It can only be used together with the addition AND RETURN.

The list is stored in the ABAP Memory as an internal table of the row type ABAPLIST, ABAPLIST being a structured data type in the ABAP Dictionary.

The calling program can access the list stored once program access is completed, using function modules belonging to the function group SLST.

The function module LIST_FROM_MEMORY loads the list from the ABAP Memory to an internal table of the row type ABAPLIST.

The function module WRITE_LIST inserts the content of an internal table of the row type ABAPLIST in the current list.

The function module DISPLAY_LIST displays the content of an internal table of the row type ABAPLIST in a separate list screen.

Note

The addition can only work provided the function key Enter is not linked to a function code in the GUI status last defined for the program accessed.

Example

Once the program report has been accessed, the list stored there in the ABAP Memory is read by means of function modules and inserted in the current list.

DATA list_tab TYPE TABLE OF abaplist.

SUBMIT report EXPORTING LIST TO MEMORY

AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = list_tab

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

CALL FUNCTION 'WRITE_LIST'

TABLES

listobject = list_tab.

ENDIF.

Read only

0 Likes
5,080

Check this sample program I had laying around.



report zrich_0003 .

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

* Submit the report and export list to memory
submit z_your_report 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.  refresh list.
  clear reportlines. refresh 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.


Regards,

Rich Heilman

Read only

Former Member
0 Likes
5,080

hi Sruthi,

list_from_memory module:

Func desc: Prepared list import from memory

Desc:

report report01.

...

data listtab like listobject occurs 1.

...

  • Either other report

  • has exported the list to memory, or

submit report02...

exporting list to memory and return.

call function 'LIST_FROM_MEMORY'

tables listobject = listtab.

  • process listtab

hope it helps..,

regards,

Vinoth