Skip to Content
-1

How to Display data from memory to ALV Grid via call function 'LIST_FROM_MEMORY

Oct 17, 2016 at 12:29 PM

284

avatar image

Hello Experts,

I Have written a program to call the data from memory and it is displaying the data in ALV list perfectly.

But I want to disply the data in ALV Grid. Please guide me - how can I do it.

Also Searched on SCN, but failed to find relevant answer.

Thanks in advance.

Dev

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 zmytesting exporting list to memory and return.

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

    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.
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Raymond Giuseppi
Oct 17, 2016 at 02:47 PM
0

If zmytesting display some ALV grid, better use class cl_salv_bs_runtime_info to get the data (and layout) back. Else go to splitting the data into columns using all your skill using some split at '|' and code to identify header ignoring statistics and other header data of spool. (or find the sample that existed in a previous version of sdn.)

Regards,
Raymond

Share
10 |10000 characters needed characters left characters exceeded
Rich Heilman
Oct 17, 2016 at 04:01 PM
0

Well you would need to take that listout internal table and parse the report string at certain character positions, and put those values into columns of a structured internal table, then display that internal table as ALV Grid. Most work would be parsing out the row into columns.

Cheers,

Rich Heilman

Share
10 |10000 characters needed characters left characters exceeded