SAP ABAP GET PARAMETER

Syntax:

GET PARAMETER ID pid FIELD <f>.

This will set the  content of the object value <f> to the parameter id 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.

if sy-subrc = 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

if sy-subrc = 4 

The SPA/GPA parameter specified in pid does not exist for the current user in the SAP Memory.

 

Example:

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.

 

Here the value(RID) of  the parameter id para is assigned to the variable prog.

 

 

0 Comments

Leave A Reply