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

Submit and gat data

Former Member
0 Likes
754

Hi there,

I want so make a submit in a program that is a report write, so, I want to get this data from the spool or the memory, but I don't know how to do it.

Thanks!!!

Alexandre Nogueira.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
686

Here is a little sample....




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

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
687

Here is a little sample....




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
686

DO 10 TIMES.

WRITE : / sy-index.

ENDDO.

The Calling Program.....

REPORT ztest2 LINE-SIZE 255.

SUBMIT ztest EXPORTING LIST TO MEMORY AND RETURN.

DATA : listtable LIKE abaplist OCCURS 0.

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = listtable

EXCEPTIONS

not_found = 1

OTHERS = 2.

Read only

0 Likes
686

Thank you,

It's solved now!

Alexandre Nogueira

The points are awarded

Read only

Former Member
0 Likes
686

Hi

Did you say report or report writter ?

If it is report then you can use this syntax.

SUBMIT PROGRAMNAME AND RETURN EXPORTING LIST TO MEMORY .

Use FM LIST_FROM_MEMORY to read the output list and then FM LIST_TO_ASCI to convert .

Use FM LIST_FREE_MEMORY to free the saved list.

Regards

Kalpana