Application Development and Automation 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: 
Read only

SET PARAMETER

Former Member
0 Likes
2,352

HI ,

when we use SET PARAMETER and GET PARAMETER

regards,

kiran

10 REPLIES 10
Read only

Former Member
0 Likes
1,440

hi

see this

SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens

SAP global memory retains field value through out session.

set parameter id 'MAT' field v_matnr.

get parameter id 'MAT' field v_matnr.

They are stored in table TPARA.

ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data

to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse.

ABAP memory is temporary and values are retained in same LUW.

export itab to memory id 'TEST'.

import itab from memory Id 'TEST'.

Here itab should be declared of same type and length.

http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm

ABAP Memmory & SAP Memmory

http://www.sap-img.com/abap/difference-between-sap-and-abap-memory.htm

http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

Former Member
0 Likes
1,440

Hi Kiran,

When we call some transaction using

CALL TRANSACTION then we may require to pass some values for the selection screen of that transaction ..at that time we pass values using SET..GET.

Regards,

Atish

Read only

Former Member
0 Likes
1,440

Hi,

using the get parameter and set parameter, one can get the value of one field and save it into temporary memory..... and that memory can be used to get that value back on any other screen

regards,

shadul shah

Read only

mohammed_moqeeth
Active Participant
0 Likes
1,440

Hi Kiran,

SAP Memory is a user-specific memory area of the application server, which is accessed by all main sessions of a user session at once. ABAP programs have access to SPA/GPA parameters stored in the SAP Memory (also called SET/GET parameters).

Example:

Using Set parameter you can give value of variable (dobj) to parameter ID 'pid'. This will store value in SAP memory SET PARAMETER ID pid FIELD dobj.

When you want to use that value stored in SAP memory you can use GET parameter.

GET PARAMETER ID pid FIELD dobj.

Memory-ID is used to save and retrieve the last entered data in the field.

Eg: PARAMETERS p_vbeln for vbak-vbeln memory-id pid

Shared memory is the area that can be used to share data between different processes.

Reward points for helpful answers..

Regards,

Moqeeth.

Read only

varma_narayana
Active Contributor
0 Likes
1,440

Hi ,

We can use the SET PARAMETER statement to pass the data to the Screen fields and GET PARAMETER statement to read the data of Screen fields.

For Example:

In a report when u select the Customer ID (KNA1-KUNNR) in Basic list,

You want to call the transaction XD02 to change the Customer details.

Here we can Use SET PARAMETER to pass the data to XD01.

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

START-OF-SELECTION.

LOOT AT T_KNA1 INTO WA_KNA1.

WRITE:/ WA_KNA1-KUNNR,

WA_KNA1-Name1.

hide WA_KNA1-KUNNR.

ENDLOOP.

Clear wa_kna1.

AT LINE-SELECTION.

CASE SY-LSIND.

WHEN 1.

IF WA_KNA1-KUNNR IS NOT INITIAL .

SET PARAMETER ID 'KUN' FIELD WA_KNA1-KUNNR.

CALL TRANSACTION 'XD01' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

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

here the parameter ID 'KUN' can be found when you press F1(Technical info) on Customer no field in XD02 transaction.

Reward if useful.

Read only

Former Member
0 Likes
1,440

<b>SAP Memory</b>

SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as <b>SET/GET</b> parameters). These parameters can be set either for a particular user or for a particular program using the <b>SET PARAMETER</b> statement. Other ABAP programs can then retrieve the set parameters using the<b> GET PARAMETER</b> statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens

reward points if it is usefulll.....

Girish

Read only

Former Member
0 Likes
1,440

<b>SET PARAMETER

Syntax

SET PARAMETER ID pid FIELD dobj.</b>


Example

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'. 

<b>
GET PARAMETER 

Syntax 
GET PARAMETER ID pid FIELD dobj.</b> 


[code]
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.

[/code]

reward points if it is usefull ...

Girish

Read only

Former Member
0 Likes
1,440
Read only

Former Member
0 Likes
1,440

Hi,

To use parameter IDs, you need to “set” (store) values in the global memory area and then “get” (retrieve) values from this parameter ID memory area. In the case of an online program, you will “set” values from screen fields and you will “get” these values for screen fields. You can perform this “set/get” function two ways: Use the ABAP statements “SET PARAMETER ID” and “GET PARAMETER ID”. Use the field attributes “SPA” and “GPA” . Remember that parameter IDs can only be used with ABAP Dictionary fields because parameter IDs are linked to data elements. The appropriate data elements must have a parameter IDs for this “set/get” function to work.

pls reward points.

Regards,

Ameet

Read only

Former Member
0 Likes
1,440

hi,

ABAP programs can access the parameters using the SET PARAMETER and GET PARAMETER statements.

To fill one, use:

<b>SET PARAMETER ID <pid> FIELD <f>.</b>

This statement saves the contents of field <f> under the ID <pid> in the SAP memory. The code <pid> can be up to 20 characters long. If there was already a value stored under <pid>, this statement overwrites it. If the ID <pid> does not exist, double-click <pid> in the ABAP Editor to create a new parameter object.

To read an SPA/GPA parameter, use:

<b>GET PARAMETER ID <pid> FIELD <f>.</b>

This statement fills the value stored under the ID <pid> into the variable <f>. If the system does not find a value for <pid> in the SAP memory, it sets SY-SUBRC to 4, otherwise to 0.

To fill the initial screen of a program using SPA/GPA parameters, you normally only need the SET PARAMETER statement.

The relevant fields must each be linked to an SPA/GPA parameter.

On a selection screen, you link fields to parameters using the MEMORY ID addition in the PARAMETERS or SELECT-OPTIONS statement. If you specify an SPA/GPA parameter ID when you declare a parameter or selection option, the corresponding input field is linked to that input field.

regards,

Ashok Reddy