SAP GET PARAMETER ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID GET-PARAMETER
• GET PARAMETER ABAP Statement
• ID GET PARAMETER
• FIELD GET PARAMETER

GET PARAMETER
Short Reference

ABAP_SYNTAX
GET PARAMETER ID pid FIELD dobj.

What does it do?
This statement sets the content of the data object dobj to the content of the SPA/GPA parameter specified in pid in the user memory . The ID pid expects a flat character-like field that contains a maximum of 20 characters and not only blanks. The field is case-sensitive. The binary content of the SPA/GPA parameter is passed to dobj without being converted. The following can be specified for dobj:
An existing flat character-like variable.
An inline declaration DATA(var) or FINAL(var), where a variable of type XUVALUE is declared.
The statement GET PARAMETER does not access the user memory directly. Instead, it accesses a local mapping of the SPA/GPA parameter in the session memory, which is loaded during roll-in and saved in the user memory when rolled out (see SPA/GPA Parameters and ABAP Programs). If the SPA/GPA parameter specified in pid does not yet exist in the user memory for the current user, the data object dobj is initialized and sy-subrc is set to 4.
A program can only read those SPA/GPA parameters for which there is a name in the table TPARA. If it is possible to statically determine that an ID specified pid is not in the database table TPARA, the extended program check reports an error.
System Fields sy-subrcMeaning 0The SPA/GPA parameter specified in pid exists for the current user in the user memory and its value was passed to the target field. 4The SPA/GPA parameter specified in pid does not exist for the current user in the user memory.



Latest notes:

An SPA/GPA parameter that can be read using GET PARAMETER can either have been created previously using the statement SET PARAMETER or created automatically in the PAI event of a dynpro or selection screen in the user memory.
An SPA/GPA parameter specified in pid must be entered in uppercase to match a name in the database table TPARA.
Since the statements SET PARAMETER and GET PARAMETER do not work directly with the SPA/GPA parameters of the user memory, they are only suitable for passing data within an ABAP session and not for passing data between parallel ABAP sessions because programs that run in parallel can affect the state of the parameters in an uncontrolled manner.
ABAP_HINT_END



Example ABAP Coding

In this example, the current value of the SPA/GPA parameter RID is read from the user memory to the data object prog. In the dynpros in the ABAP Workbench, this parameter is linked to 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 in the event PAI and assigned the name of the program specified there. If, in the same user session, no dynpro was processed that sets the parameter RID and no corresponding SET PARAMETER statement was executed beforehand, RID is not found in the user memory.
ABEXA 00302
ABAP_EXAMPLE_END

Return to menu