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: 

SAP Memory

Former Member
0 Kudos

hi all,

Please tell me the code for passing a particular flag value to a SAP memory . Then calling the memory at any other location and freeing the memory thereafter.

Also please let me know the code for disabling/enabling a particular screen field .

Thanks ,

Paul

4 REPLIES 4

andreas_mann3
Active Contributor
0 Kudos

hi,

try that:

Report Z1:

flag = 'X'.

EXPORT flag TO MEMORY ID 'ZZ1'.

...

Report Z2:

Import flag from MEMORY ID 'ZZ1'.

...

free memory id 'ZZ1'.

Andreas

0 Kudos

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

SAP Memmory - use to acess memmory area between session

eg:- when u call a transaction or report ( within ur program) want the value of the prticular field should have value define by U.

Then u use GET and SET parameter command

field u set or get should have parameter ID

Set

http://www.geocities.com/SiliconValley/Campus/6345/set_para.htm

GET

http://www.geocities.com/SiliconValley/Campus/6345/get_para.htm

EXPORT

http://www.geocities.com/SiliconValley/Campus/6345/export01.htm

<b>2) Enabling/disabling a parameter based on radiobutton </b>

Parameters: rd1 RADIOBUTTON group g1 default 'X' user-command ch ,

rd2 RADIOBUTTON group g1 ,

rd3 RADIOBUTTON group g1 ,

kishan1(10) type c modif id ID1.

AT SELECTION-SCREEN.

check sy-ucomm = 'CH'.

AT SELECTION-SCREEN output.

IF rd1 = 'X' or rd2 = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'ID1' .

screen-active = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

IF RD3 = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'ID1' .

screen-active = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Message was edited by: kishan negi

vinod_gunaware2
Active Contributor
0 Kudos

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

<b>SPA/GPA Parameters as Default Values</b>

The SPA/GPA Parameter Technique is a general procedure for filling the initial screen when a program is called. To use this technique for parameters on selection screens, you must link the parameter to an SPA/GPA parameter from the SAP memory as follows:

PARAMETERS <p> ...... MEMORY ID <pid>......

If you use this addition, the current value of SPA/GPA parameter <pid> from the global user-related SAP memory is assigned to parameter <p> as a default value. Description <pid> can contain a maximum of twenty characters and must not be enclosed in quotation marks.

REPORT DEMO.

<b>PARAMETERS TEST(16) MEMORY ID RID.</b>

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>

<b>Passing Data Between Programs</b>

There are two ways of passing data to a called program:

Passing Data Using Internal Memory Areas

There are two cross-program memory areas to which ABAP programs have access (refer to the diagram in Memory Structures of an ABAP Program) that you can use to pass data between programs.

<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 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 (see below).

<b>ABAP Memory</b>

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. For further information, refer to Data Clusters in ABAP Memory.

Filling Input Fields on an Initial Screen

Most programs that you call from other programs have their own initial screen that the user must fill with values. For an executable program, this is normally the selection screen. The SUBMIT statement has a series of additions that you can use to fill the input fields of the called program:

Filling the Selection Screen of a Called Program

You cannot fill the input fields of a screen using additions in the calling statement. Instead, you can use SPA/GPA parameters. For further information, refer to Filling an Initial Screen Using SPA/GPA Parameters.

regards

vinod

Former Member
0 Kudos

Hi,

For sap memory it would be:

data : matnr type mara-matnr value '100'.

SET PARAMETER ID 'MAT' VALUE MATNR.

So the value of screen field MATNR having parameter id 'MAT' will be set with value '100' in any transaction, opened in any session.

for disabling/enabling a particular screen field.

LOOP AT SCREEN.

if screen-name = <screen field name>.

screen-input = 0 (input disable).

or

screen-input = 1 ( input enable).

modify screen.

endif.

ENDLOOP.