The first thing that you need to know about SAP memory and ABAP memory is they are both used when you would like to transfer data between two internal sessions within the main session available. The ABAP memory will have contents that will only be retained within the session.
If you would like to get data, you need to do export to memory and import from memory. While for the SAP memory, all of the contents will be available even after the session has ended which means that people will be able to access it even after the session has ended.
You would need to set parameter and get parameter statements so that you can get the data from the memory.