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

SAP Memory, Set and Get parameter

Former Member
0 Likes
5,819

Hi All,

I am running two programs in background from program1

Eq: Program1 --> Calls 2 programs

Program1_01.(First Program)

Program2_01(Second Program).

Programs1 schedules Program1_01 and Program1_02 in background. These two programs are interdependent.

Program1_01 extracts data, evaluates and sets the Flag. This Flag is exported to SAP Memory using

Set parameter id 'p_id_flag' field Flag.

Program1_02 checks for Program1_01 is completed in background. If complted gets the Flag value from SAP Memory using "Get paramter id 'p_id_flag' field Flag.

When i checked this is not happning. When saw Flag in Program1_01 is set as Flag = 'X'.

When I came and checked in Program1_02 after Get Parameter statement Falg value is SPACE.

Cn hlp on this?

Hi All,

I am running two programs in background from program1

Eq: Program1 --> Calls 2 programs

Program1_01.(First Program)

Program2_01(Second Program).

Programs1 schedules Program1_01 and Program1_02 in background. These two programs are interdependent.

Program1_01 extracts data, evaluates and sets the Flag. This Flag is exported to SAP Memory using

Set parameter id 'p_id_flag' field Flag.

Program1_02 checks for Program1_01 is completed in background. If complted gets the Flag value from SAP Memory using "Get paramter id 'p_id_flag' field Flag.

When i checked this is not happning. When saw Flag in Program1_01 is set as Flag = 'X'.

When I came and checked in Program1_02 after Get Parameter statement Falg value is SPACE.

Cn hlp on this?

18 REPLIES 18
Read only

Former Member
0 Likes
3,676

Hi,

Set parameter id 'p_id_flag' field Flag.

Check if the parameter id 'P_ID_FLAG' is defined the data element.

Use export and import otherwise.

regards,

Advait

Read only

0 Likes
3,676

parameter id 'P_FLAG_ID' is my own id.

How to check the id in data element level.

Read only

0 Likes
3,676

Hi,

you can get memory id of corresponding data element

from DD04L table.

Read only

0 Likes
3,676

parameter id 'P_FLAG_ID' is my own id.

You mean you have just defined it in the program? Then this will not work. GET/SET parameters should be defined in the data element only.

As I said earlier, use Export and Import instead.

regards,

Advait

Read only

Former Member
0 Likes
3,676

and there is absolute certainty that nothing resets the flag in between ?

To ensure could you SET some standard parameter ID and check the results in your second program..

Read only

Pawan_Kesari
Active Contributor
3,676

Create new parameter id first using SM30 for table TPARA.

Read only

0 Likes
3,676

could please tell me y is it required to create in TPARA.

Read only

0 Likes
3,676

could please tell me y is it required to create in TPARA

This is copied from SAP help

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.

But I checked, even without creating parameter id in TPARA table SET/ GET statement works...

I think its good practice to create a parameter id and then use it.

coming to your problem....

I suppose you are creating two different job for each program. Try with single job with multiple steps in it. With multiple steps (program) in single job your SET/GET will work.

Read only

0 Likes
3,676

HI Praveen,

Parameter IDs have to be declared and defined in TPARA..only then can u use them..

If it has been used in your program then someone must have already done it..

however cross check and confirm it.

Also ensure that in SET & GET stmnts parameter id 'p_...'is mentioned in CAPS..

Read only

0 Likes
3,676

Could u please tell me how to create in TPARA table.

Read only

0 Likes
3,676

Goto trsansction SM30, enter TPARA and press maintain.. ignore the information message... on next screen put the PID name and press enter.. then follow few more screens ..

Read only

0 Likes
3,676

How to free the memory set using Set/Get statement.

I have used

Free Memory id 'P_FLAG_ID'.

Read only

0 Likes
3,676

Hi,

The problem simply lies in fact that pid was provided in lowercase.

Use:


SET PARAMETER ID 'P_ID_FLAG' FIELD flag.

...
GET PARAMETER ID 'P_ID_FLAG' FIELD flag.

It works fine then.

Note!

Though SAP claims it is mandatory to create pid in TPARA table, in fact this is not required. Each time SET PARAMETER is executed, system checks if data object P_ID_FLAG was defined in SAP memory. If not it will automatically create it for us. But be carefull here. If there is such data object, its value will be overwritten.

As for your last question, your statement (FREE MEMORY ....) is ok.

Regards

Marcin

Edited by: Marcin Pciak on Jan 22, 2009 1:14 PM

Read only

0 Likes
3,676

to clear th memory value i use SET command with blank value

CLEAR LV_FELD.
SET PARAMETER ID 'ZXXX' FIELD LV_FELD .

Read only

0 Likes
3,676

How to Free the memory

Read only

0 Likes
3,676

Hi,

I have created YFLG memory id in TPARA.

But still i am not get the values in Program2_01.

Read only

0 Likes
3,676

Hi,

Pardon my comments about the creation of memory ID. I always thought that the memory ID should be crated. But it seems that is not the case.

This code is working fine even without creating the memory id.


DATA flag TYPE c VALUE 'X'.
SET PARAMETER ID 'YFLG' FIELD flag.
CLEAR flag.

GET PARAMETER ID 'YFLG' FIELD flag.
WRITE flag.

So what you can do is to check if the memory id is getting set at all.

Set a break point on the statement SET PARAMETER of your program. once the break-point is reached, press F5, then in the menu GOTO>System Area>SAP Memory.

Area : SMEM and see the value of memory id 'YFLG'

regards,

Advait

Read only

Former Member
0 Likes
3,676

HI Praveen,

Are you refreshing the memory before doing your validations and changing the value of flag?

If not then you have to refresh it by using

FREE MEMORY ID 'p_id_flag' .

Otherwise it will not refresh value and you will get the last stored value by GET statement.

Try using it, I had also experienced this type of problem which was resolved by refreshing the memory.