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

How Read-only flag for variable set in a function (debug)?

Former Member
0 Likes
3,937

Hello:

While debugging a function module I noticed that (none of) the input parameters were NOT CHANGEABLE. I was under the impression that read-only attribute could be set only in methods. Could somebody throw some light on this.

The function FM_COM_ITEM_READ_SINGLE_DATA (Funds Management Module) has six import parameters, FMArea, CItem, Year, etc and *none of these parameters can be changed during debug. However another function in the same group FM_COM_ITEM_READ_MULTIPLE_DATA has similar import parameters, and all of them are changeable.

How does that happen? I would like to write such functions that end users cannot manipulate using debug.

Thank you,

Fred.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,128

I hope it depends on the pass by value and pass by reference only make the difference.

pass by value it will be a copy of the variable which you are passing from the program so it can be changable because you are actually accessing the local copy inside the fm.

But pass by reference it will not copy the variable which you are passing from the program but it acutually pointing to the same memory area of the variable of the program. So if you are trying to change the parameter pass by reference, actually you are trying to change the variable of the program which is beyond of your scope inside the fm. So it wont be in changable mode.

I hope this will be the only difference but let us check for other relevant answer also.

Since the fm FM_COM_ITEM_READ_SINGLE_DATA is having all parameters as reference parameters so you are not able to change it but FM_COM_ITEM_READ_MULTIPLE_DATA is having all the parameters as pass by value so you can able to change it.

Regards

Shiba Prasad Dutta

9 REPLIES 9
Read only

mvoros
Active Contributor
0 Likes
2,128

Hi,

just my guess. Did you test those FMs in same system and with users with same authorizations. You can restrict debugger to read only mode using authorization object S_DEVELOP.

Cheers

Read only

Former Member
0 Likes
2,128

Hi,

Martin is right.

In production system no user will be given debug rights and even if given they will not have the debug change access.

Verify with basis and have proper roles set up.

Regards,

Subramanian

Read only

Clemenss
Active Contributor
0 Likes
2,128

Hi Fred,

your basis can set the system so that in debugger chages are not allowed. The trick with read-onlx import parameters is useless: You can jump upwards in the call hierarchy and change the variables there - as the values are passed by reference, the change is effective immediately.

Regards,

Clemens

Read only

Former Member
0 Likes
2,128

Hi Martin, Subramanian, Clemens:

Thank you all very much.

No, I don't believe it is user authorization related. I was trying to debug in development. Also as I said in the first post, I am not able to change the import parameters of FM_COM_ITEM_READ_SINGLE_DATA but can change parameters of FM_COM_ITEM_READ_MULTIPLE_DATA. And there was no difference between the attributes of the functions or parameters. If you have the same functions in your installations you probably can verify and let me know.

Clemens, you are right, one can go up a step and change the parameters there, but the function as stand alone stays stable.

Thank you,

Fred.

Read only

0 Likes
2,128

>

> Hi Martin, Subramanian, Clemens:

>

> No, I don't believe it is user authorization related.

> Fred.

Just make sure it isnt, dont assume. after debugging session call SU53 and check if there were failures due to authorizations.

Read only

Former Member
0 Likes
2,129

I hope it depends on the pass by value and pass by reference only make the difference.

pass by value it will be a copy of the variable which you are passing from the program so it can be changable because you are actually accessing the local copy inside the fm.

But pass by reference it will not copy the variable which you are passing from the program but it acutually pointing to the same memory area of the variable of the program. So if you are trying to change the parameter pass by reference, actually you are trying to change the variable of the program which is beyond of your scope inside the fm. So it wont be in changable mode.

I hope this will be the only difference but let us check for other relevant answer also.

Since the fm FM_COM_ITEM_READ_SINGLE_DATA is having all parameters as reference parameters so you are not able to change it but FM_COM_ITEM_READ_MULTIPLE_DATA is having all the parameters as pass by value so you can able to change it.

Regards

Shiba Prasad Dutta

Read only

Clemenss
Active Contributor
0 Likes
2,128

Hi Fred,

if you lookm at the function modules, you will see that

FM_COM_ITEM_READ_MULTIPLE_DATA hast the IMPORT parameters defined as Call by value, that means that the actual parameters value is copied and can be changed internally.

For FM_COM_ITEM_READ_SINGLE_DATA, the import parameters are passed by reference. Because only the reference is passed, the value can not be changed inside the function module.

As I alread said: You can change those values in debugger going up through the call stack.

This is nothing about authorization, those are pure basics.

If you do not want people to change values in debugger, you can read the sys log and find who when changed what and then rap the user on the knuckles.

Transaction SM21 will show you errors like

14:41:44 DIA  001 100 USERXYZ SEU_           A1  9 Field contents changed: I_GJAHR -> 0001
14:41:44 DIA  001 100 USERXYZ SEU_           A1  4 > in program LFMCI1U07 , line 0029, event FM_COM_ITEM_READ_M

Responsible companies use to switch off the ability to change values in debugger in production systems.

Regards,

Clemens

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,128

Hello Clemens,

My first doubt was the params were "passed by value", but anyways you have explained it in a very lucid way

BTW in my prod we dont have any debugging access.

BR,

Suhas

Read only

Former Member
0 Likes
2,128

Thank you all very much, thanks Shiba Prasad Dutta, Clemens for pointing that out.

Fred.