Fetching the data from Memory in SAP

Fetching the data from memory means, we may get a requirement that we need to submit any report with return option.In those cases we need to get the out put of that particular report. At that time, we can use the following piece of code in our program, that will retrieve the data from memory and stored in the internal table.


SUBMIT <>
USING SELECTION-SET <>
EXPORTING LIST TO MEMORY
AND RETURN.


Step 1:

We can use List_from_memory Function module to fetch the data from memory:



*Import the data into one internal table
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = y_i_abaplist
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc NE 0.
ENDIF.


Step2 :
Now we need to convert it into internal format. That data from above function module is in ascii format.

*Convert to ASCII format
IF NOT y_i_abaplist[] IS INITIAL.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = y_i_ascilist
listobject = y_i_abaplist
EXCEPTIONS
empty_list = 1
list_index_invalid = 2
OTHERS = 3.
IF sy-subrc = 0.
ENDIF.
ENDIF.

ENDFORM. " y_f_liste


In the out put internal we will get the out put of internal table y_i_abaplist.


Have a good day.... :)

Thank U.
Vamsi.