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 & get parameter

Former Member
0 Likes
2,541

What is the use of Set Parameter and Get Parameter id. What is the usage

and how it's used in calling a transaction code.Give me the codings also.

Plz help me.

5 REPLIES 5
Read only

abdulazeez12
Active Contributor
0 Likes
1,479

SAP allows you to make use of SPA/GPA technique to fill the input fields of a called transaction with data from the calling program.SPA/GPA parameters are values that the system stores in the global, user-specific SAP memory. SAP memory allows you to pass values between programs. A user can access the values stored in the SAP memory during one terminal session for all parallel sessions. Each SPA/GPA parameter is identified by a 20-character code. You can maintain them in the Repository Browser in the ABAP Workbench. The values in SPA/GPA parameters are user-specific.

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

To fill one, use:

SET PARAMETER ID <pid> FIELD <f>.

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:

GET PARAMETER ID <pid> FIELD <f>.

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.

On a screen, you link fields to parameters in the Screen Painter. When you define the field attributes of an input field, you can enter the name of an SPA/GPA parameter in the Parameter ID field in the screen attributes. The SET parameter and GET parameter checkboxes allow you to specify whether the field should be filled from the corresponding SPA/GPA parameter in the PBO event, and whether the SPA/GPA parameter should be filled with the value from the screen in the PAI event.

When an input field is linked to an SPA/GPA parameter, it is initialized with the current value of the parameter each time the screen is displayed. This is the reason why fields on screens in the R/3 System often already contain values when you call them more than once.

When you call programs, you can use SPA/GPA parameters with no additional programming overhead if, for example, you need to fill obligatory fields on the initial screen of the called program. The system simply transfers the values from the parameters into the input fields of the called program.

However, you can control the contents of the parameters from your program by using the SET PARAMETER statement before the actual program call. This technique is particularly useful if you want to skip the initial screen of the called program and that screen contains obligatory fields.

If you want to set SPA/GPA parameters before a program call, you need to know which parameters are linked to which fields on the initial screen. A simple way of doing this is to start the program that you want to call, place the cursor on the input fields, and choose F1 followed by Technical info. The Parameter ID field contains the name of the corresponding SPA/GPA parameter. Alternatively, you can look at the screen definition in the Screen Painter.

The SPA/GPA parameter for the input field Company has the ID CAR. Use this method to find the IDs CON, DAY, and BOK for the other input fields.

The following executable program is connected to the logical database F1S and calls an update transaction:

REPORT BOOKINGS NO STANDARD PAGE HEADING.

TABLES SBOOK.

START-OF-SELECTION.

WRITE: 'Select a booking',

/ '----


'.

SKIP.

GET SBOOK.

WRITE: SBOOK-CARRID, SBOOK-CONNID,

SBOOK-FLDATE, SBOOK-BOOKID.

HIDE: SBOOK-CARRID, SBOOK-CONNID,

SBOOK-FLDATE, SBOOK-BOOKID.

AT LINE-SELECTION.

SET PARAMETER ID: 'CAR' FIELD SBOOK-CARRID,

'CON' FIELD SBOOK-CONNID,

'DAY' FIELD SBOOK-FLDATE,

'BOK' FIELD SBOOK-BOOKID.

CALL TRANSACTION 'BOOK'.

The basic list of the program shows fields from the database table SBOOK according to the user entries on the selection screen. These data are also stored in the HIDE areas of each line.

Read only

Former Member
0 Likes
1,479

Hello Veera,

SET and GET is used to set value to fields and then get the values into other transaction....

SET parameter id 'RID' field 'ZABC1'

CALL transaction SA38. will call the transaction SA38 with program name populated as ZABC1.

Read only

Former Member
0 Likes
1,479

Hi,

SAP Memory

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

ABAP/4 Memory

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.

SAP memory

The SAP memory, otherwise known as the global memory, is available to a user during the entire duration of a terminal session. Its contents are retained across transaction boundaries as well as external and internal sessions. The SET PARAMETER and GET PARAMETER statements allow you to write to, or read from, the SAP memory.

Regards,

Sangeetha.A

Read only

Former Member
0 Likes
1,479

Sample part of code....

  • Sales order.

WHEN 'VBELN' OR 'POSNR'.

SET PARAMETER ID 'AUN' FIELD itg_data-vbeln.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

  • Delivery.

WHEN 'VBELL' OR 'POSNL'.

SET PARAMETER ID 'VL' FIELD itg_data-vbell.

CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.

  • Invoice.

WHEN 'VBELF' OR 'POSNF'.

SET PARAMETER ID 'VF' FIELD itg_data-vbelf.

CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.

Regards

Vasu

Read only

meikandan_krishnan2
Participant
0 Likes
1,479

Hi ,

SET / GET parameters are used to transfer data <b>between two sessions of a login</b>.

It uses SAP memory.

<b>Example :</b>

U r displaying a report related to material. If the user clicks on the material number you should go the screen MM02 or MM03.

In this case you will pass this material number to that transaction.

<b>

How to pass ?</b>

Set parameter id 'MAT' field <<<Material Number>>>

<b>From where you will get the value 'MAT'.??</b>

goto MM01 / MM02 /MM03 ....take F1 help on the material field -


there click the Technical info icon...there u can see this parameter ID...

<b>What will it do ???</b> Set parameter id 'MAT' field <<<Material Number>>>

The material number will be saved in the parameter ID and will be assigned to that field matnr..

<b>How to call the transaction.</b>

Call transaction 'MM03' and skip first screen..

Hope its clear for u now..

Reward it is helps you.

Regards

Meikandan.