Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Program Parameters →  Parameters in the User Memory 

SET PARAMETER

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


SET PARAMETER ID pid FIELD dobj. 

Effect

This statement sets the content of the SPA/GPA parameter specified in pid user memory to the content of the data object dobj. The ID pid must be a flat character-like field that contains no more than 20 characters and does not consist solely of blanks. pid is case-sensitive. dobj expects a flat character-like field whose binary content is passed in an unconverted format.

The statement GET PARAMETER does not access the user memory directly. Instead, it accesses a local mapping of the SPA/GPA parameter in the roll area, which is loaded when rolled in and saved in the user memory when rolled out (see SPA/GPA Parameters and ABAP Programs). If the SPA/GPA parameter specified for the current user in pid does not yet exist in the user memory, it is created. If the SPA/GPA parameter has already been created for the current user, its value is overwritten.

In a program, SPA/GPA parameters can only be created or assigned values if a name exists for them in the table TPARA. If it can be determined statically that an ID pid is not in the database table TPARA, the extended program check reports an error.


Notes

  • An SPA/GPA parameter specified in pid can match a name in the database table TPARA only if it is entered in uppercase letters.
  • The statements SET PARAMETER and GET PARAMETER do not work directly with the SPA/GPA parameters of the user memory, which means that they are only suitable for passing data within a single ABAP session and not for passing data between two main sessions in parallel This is because programs that run in parallel can change the state of the parameters unpredictably.

Example

If the user selects a flight displayed in the basic list, when the event ATLINE-SELECTION takes place, the SPA/GPA parameters CAR and CON are set to the ID of the airline and the connection number. The names of both parameters are defined in the table TPARA for this purpose. In the initial dynpro of the transaction DEMO_TRANSACTION, two input fields are associated with these SPA/GPA parameters and are displayed with the selected values as start values.

DATA: carrier     TYPE spfli-carrid, 
      connection  TYPE spfli-connid. 

START-OF-SELECTION. 
  SELECT carrid, connid 
         FROM spfli 
         INTO (@carrier, @connection). 
    WRITE: / carrier HOTSPOT, connection HOTSPOT. 
    HIDE:  carrier, connection. 
  ENDSELECT. 

AT LINE-SELECTION. 
  SET PARAMETER ID: 'CAR' FIELD carrier, 
                    'CON' FIELD connection. 
  CALL TRANSACTION 'DEMO_TRANSACTION'. 

Exceptions


Non-Catchable Exceptions

  • Cause:: Key only contains blank characters
    Runtime Error: SET_PARAMETER_ID_SPACE
  • Cause: Key is longer than 20 characters
    Runtime Error: SET_PARAMETER_ID_TOO_LONG
  • Cause: Value is longer than 255 characters
    Runtime Error: SET_PARAMETER_VALUE_TOO_LONG
  • Cause: Memory limit of the user memory was reached
    Runtime Error: SET_PARAMETER_MEMORY_OVERFLOW