Sessions and Memory Areas Study Notes

Sessions and Memory Areas – Study Notes
Overview

This document describes sessions in AS ABAP where ABAP programs are executed and the associated memory areas that can be accessed by an ABAP program.

Memory Hierarchy
┌─────────────────────────────────────────────────────────┐
│ AS Instance │
│ ┌───────────────────────────────────────────────────┐ │
│ │ Shared Memory │ │
│ │ ┌─────────────────────────────────────────────┐ │ │
│ │ │ User Session │ │ │
│ │ │ ┌─────────────────────────────────────┐ │ │ │
│ │ │ │ ABAP Session │ │ │ │
│ │ │ │ ┌─────────────────────────────┐ │ │ │ │
│ │ │ │ │ Internal Session │ │ │ │ │
│ │ │ │ │ ┌─────────┐ ┌─────────┐ │ │ │ │ │
│ │ │ │ │ │ Stack │ │ Heap │ │ │ │ │ │
│ │ │ │ │ └─────────┘ └─────────┘ │ │ │ │ │
│ │ │ │ └─────────────────────────────┘ │ │ │ │
│ │ │ └─────────────────────────────────────┘ │ │ │
│ │ └─────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘

1. AS Instance Level
Shared Memory
Every AS Instance has its own shared memory
Used by the ABAP runtime environment for:
Programs and program data
Buffers (e.g., table buffering)
ABAP programs can store:
Shared objects
Data clusters

⚠️ Note: Shared memory is frequently used and may become a sparse resource, causing bottlenecks.

Identifying AS Instance
Transaction: SM51 (overview of AS Instances)
System class: CL_ABAP_SYST
Method: GET_INSTANCE_NAME
Format: hostname_sysid_instnr
System field: sy-host (host computer name)

Example:

cl_demo_output=>display( cl_abap_syst=>get_instance_name( ) ).

2. User Session Level
User Memory
Created when logging on to an AS Instance
Logon methods:
SAP GUI
RFC interface
ICF (Internet Communication Framework) including APC
User Memory Contents
Component Description
SPA/GPA Parameters Set/Get using SET PARAMETER and GET PARAMETER statements
ABAP Daemon Memory Subarea for ABAP Daemons to save context in PCP format
Configuration Parameters
Parameter Purpose
rdisp/tm_max_no Maximum number of user sessions
rdisp/rfc_max_login Percentage of sessions for RFC interface
3. ABAP Session Level
ABAP Memory
One ABAP session per user session
Stores data clusters accessible within a call sequence
Data retained for the duration of the top level transaction
Cannot use SAP Easy Access program as top level transaction

⚠️ Note: SAP Easy Access does NOT function as a top level transaction for ABAP memory.

Opening Additional ABAP Sessions
Method Description
Command field Enter /o + transaction code
Function Module TH_CREATE_MODE
Async RFC Dynpro Creates additional session for SAP GUI communication
Session Limits
Maximum: 16 ABAP sessions per user session
Default: 6 sessions (configurable via rdisp/max_alt_modes)
Extended Passport (EPP)
Each ABAP session has an EPP for logging and analysis
Contains constant values
Can be passed to communication partners
4. Internal Session Level
Session Memory Structure

Internal session memory is divided into:

Area Description
Stack Contains modifiable program objects
Heap Contains modifiable program objects
PXA (Program Execution Area)
Non-modifiable program data is stored here
Session memory contains references to PXA data
Both session memory and PXA are stored in the shared memory of AS Instance
Internal Session Limits
Per ABAP session: Maximum 9 internal sessions
64-bit platforms: Theoretical limit ~4 TB
32-bit platforms: Theoretical limit ~4 GB
Practical limit depends on physically installed memory
Important Notes
Class instances (except shared objects) are located in internal session
References to objects cannot be stored in ABAP memory
Session memory limits configured via profile parameters
Memory Area Summary
Level Memory Area Contents Scope
AS Instance Shared Memory Programs, buffers, shared objects All users on instance
User Session User Memory SPA/GPA parameters, ABAP Daemon data Single user
ABAP Session ABAP Memory Data clusters Call sequence
Internal Session Session Memory (Heap/Stack) Program objects Single program
Key Takeaways
Session Hierarchy: AS Instance → User Session → ABAP Session → Internal Session
Shared Memory: Per AS Instance, contains programs, buffers, shared objects
User Memory: SPA/GPA parameters, accessible across transactions
ABAP Memory: Data clusters shared within call sequence
Internal Session: Contains actual program objects in heap/stack
Max Sessions: 16 ABAP sessions/user, 9 internal sessions/ABAP session

Content Source: https://help.sap.com/

Leave a Comment

Your email address will not be published.