Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SET PARAMETER AND GET PARAMETER

Former Member
0 Kudos

Hi Everyone,

What is SET PARAMETER AND GET PARAMETER?Where can we user this?

Looking forward for your reply.

Regards,

Ansar

6 REPLIES 6

Former Member
0 Kudos

Hi,

I searched the forum using the terms "get set parameter" and found loads of answers.

You may want to do the same.

Regards,

Nick

Former Member
0 Kudos

Hi,

GET

GET PARAMETER ID key FIELD f.

Effect

Transfers the value stored under the key pid from the global user-related SAP memory memory to the field f .

The key pid must consist of three characters. For an overview of the keys (parameters) used, refer to the SAP system description or the appropriate function in the ABAP/4 Development Workbench.

The return code value is set as follows:

SY-SUBRC = 0 A value was read from SAP memory.

SY_SUBRC = 4 No value was found in SAP memory under the specified key

Notes

The global user-related SAP memory is available to each user for the entire duration of a terminal session. For this reason, set values are retained when you leave a program.

The SAP memory should not be used for intermediate storage, since a user's parallel sessions use the same global memory.

Example

Read the program name from SAP memory:

DATA : REPID(8).

GET PARAMETER ID 'RID' FIELD REPID.

SET

SET PARAMETER ID pid FIELD f.

Effect

Writes the contents of the field f to the global SAP memory under the key pid . If the key already contains a value, it is overwritten.

The key pid must consist of three characters. You can find a list of the keys (parameters) used in the SAP system description or in the ABAP/4 Development Workbench.

Notes

The global SAP memory remains available to the user during the entire terminal session. This means that set values are retained when you leave a program.

You should not use the SAP memory for temporary storage of values because other modes use the same global memory.

If you need a new key (parameter), you can create this in the ABAP/4 Development Workbench.

Example

DATA: REPID(8) VALUE 'RFSCHU01'.

SET PARAMETER ID 'RID' FIELD REPID.

Sets the program name, e.g. for transfer to another program.

Notes

Runtime errors

SET_PARAMETER_ID_TOO_LONG : Key longer than 3 characters.

SET_PARAMETER_ID_WRONG_TYPE : Key neither type C nor type N.

SET_PARAMETER_VALUE_TOO_LONG : Value longer than 250 characters.

Reward if helpfull,

Naresh.

Former Member
0 Kudos

Hi

SET PARAMETER

Syntax

SET PARAMETER ID pid FIELD dobj.

Effect:

This statement sets the content of the SPA/GPA parameter specified in pid to the content of the data object dobj. For pid, a flat character-type field is expected that can contain a maximum of 20 characters, which cannot be exclusively blank characters. pid is case-sensitive. For dobj, a flat, (as of release 6.10 character-type) field is expected, whose binary content is transferred in an unconverted format.

If the SPA/GPA parameter specified for the current user in pid does not yet exist in the SAP 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. The extended program check reports an error if it can statically determine that a name specified in pid is not contained in the database table TPARA. ist.

Note:

For a SPA/GPA parameter specified in pid to match a name in the database table TPARA, it must be entered in upper case.

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 screen of the transaction DEMO_TRANSACTION, two input fields are linked with SPA/GPA these 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'.

*******************************************************************************************************

GET PARAMETER

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

An SPA/GPA parameter that is readable with GET PARAMETER can previously have been created in the SAP Memory using the SET PARAMETER statement or automatically during the event PAI of a screen or selection screen.

For an SPA/GPA parameter specified in pid to match a name in the database table TPARA, it must be specified in uppercase.

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.

regards,

VIpul

Former Member
0 Kudos

Hi Ansar,

SET PARAMETER & GET PARAMTER are use to transfer data between different programs in different sessions i.e. to user's SAP memory.

Hashir Ahmed.

Former Member
0 Kudos

hi,

To fill the input fields of a called transaction with data from the calling program, you can use the SPA/GPA technique. SPA/GPA parameters are values that the system stores in the global, user-related SAP memory. You use the SAP memory to transfer values between programs beyond the borders of transactions. A user can access the values stored in the SAP memory during one terminal session for all modes used in parallel. To fill an SPA/GPA parameter, use: Syntax SET PARAMETER ID FIELD .

To read an SPA/GPA parameter into an ABAP program, use: Syntax GET PARAMETER ID FIELD .

vamsilakshman_pendurti
Active Participant
0 Kudos

Hi

In SAP we have two types of memories...

1) ABAP Memory

2) SAP Momory

For this

SAP-Memory irrespective of session we can transfer the data

while in the case of

ABAP-Memory within the sessions only we can transfer the data.

For that SAP provide keywords to transfer the data Using SET and GET parameters...

---> For every field sap provides Technical information with in that we will get PARAMETER ID

information By using that we can transfer the value to that particular field with skipping the first screen


Statement like as below..mentioned :

Set parameter id <PID> field F1.

Regards,

Vamsi.