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

LIST_TO_MEMORY

Former Member
0 Likes
929

Hi All,

I want to save a report output and export it to a unix file. However, I don't want to use Submit.....Exporting_List_To_Memory... I want to use <b>LIST_TO_MEMORY</b>. Could someone giving me a short working example of how I would use this function correctly? Thank you in advance,

Jim

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
805

HEre is a pretty simply example.



report  zrich_0001.


data: ilist type table of  abaplist with header line.
data: istr type table of string with header line.

start-of-selection.

  do 10 times.
    write:/ sy-index.
  enddo.

  call function 'LIST_TO_MEMORY'
       exporting
            list_index = 0
       tables
            listobject = ilist
       exceptions
            empty_list = 1.

  call function 'LIST_FROM_MEMORY'
       tables
            listobject = ilist.

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

  skip 5.
  write:/ 'The following has been pulled from memory'.
  loop at  istr.
    write:/ istr.

  endloop.

Regards,

Rich Heilman

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
806

HEre is a pretty simply example.



report  zrich_0001.


data: ilist type table of  abaplist with header line.
data: istr type table of string with header line.

start-of-selection.

  do 10 times.
    write:/ sy-index.
  enddo.

  call function 'LIST_TO_MEMORY'
       exporting
            list_index = 0
       tables
            listobject = ilist
       exceptions
            empty_list = 1.

  call function 'LIST_FROM_MEMORY'
       tables
            listobject = ilist.

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

  skip 5.
  write:/ 'The following has been pulled from memory'.
  loop at  istr.
    write:/ istr.

  endloop.

Regards,

Rich Heilman

Read only

0 Likes
805

Hi Rich,

Thanks, but the function <b>'LIST_TO_ASCI'

tables

listasci = istr

listobject = ilist

exceptions

empty_list = 1

list_index_invalid = 2

others = 3.</b>

gives me an ABAP dump on the <b>istr</b> object - any idea why?

Jim

Read only

0 Likes
805

Post your code.

Regards

Rich Heilman

Read only

0 Likes
805

Rich,

I substituted an explicit internal table declaration for the istr table, i.e.,

data: begin of istr with header line,

line(1024),

end of istr.

This worked fine - thanks again and I the points will be rewarded.

Jim

Read only

ferry_lianto
Active Contributor
0 Likes
805

Hi Jim,

Please try to replace this line.

DATA: ISTR TYPE TABLE OF STRING WITH HEADER LINE.

with this line.

DATA: ISTR TYPE TABLE OF LISTZEILE WITH HEADER LINE.

Regards,

Ferry Lianto