GET PARAMETER

Short Reference

Syntax

GET PARAMETER ID pid FIELD dobj.

Effect

This statement sets the content of the data object dobj to the content of the SPA/GPA parameter specified in pid. pid must be a flat character-type field that contains no more than 20 characters and does not consist solely of blanks; it is also case-sensitive. dobj must be a flat and (as of Release 6.10) character-type field into which the binary content of the SPA/GPA parameter is transferred unconverted.

If the SPA/GPA parameter specified in pid was not yet created in the SAP Memory for the current user, the data object dobj is initialized and sy-subrc is set to 4.

In a program, only those SPA/GPA parameters can be read for which there is a name in the table TPARA. The extended program check reports an error, if it can be statically determined that an ID specified in pid is not in the table TPARA.

System fields

sy-subrc Meaning
0 The SPA/GPA parameter specified in pid exists for the current user in the SAP Memory and its value was transferred to the target field.
4 The SPA/GPA parameter specified in pid does not exist for the current user in the SAP Memory.

Notes

Example

In this example, the current value of the SPA/GPA parameter RID is read from the SAP Memory to the data object prog. In the screens of the ABAP Workbench, this parameter is linked with the input fields for a program name. When an ABAP Workbench tool, in which an ABAP program is processed, is first called, the parameter is created at the event PAI and assigned the name of the program specified there. If in the same user session, no screen is processed that set the parameter RID and no corresponding SET PARAMETER statement was executed beforehand, RID is not found in the SAP Memory.

DATA: para TYPE tpara-paramid VALUE 'RID',
      prog TYPE sy-repid.

GET PARAMETER ID para FIELD prog.

IF sy-subrc <> 0.
  MESSAGE 'Parameter not found' TYPE 'I'.
ENDIF.