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

Obtaining varaible from calling program

peter_atkin
Active Contributor
0 Likes
2,399

Guys,

Another basic question from a PM/CS guy trying to make a name as a programmer...

The user-exit I'm using (IWO10004) does not have the import/export parameters I require.

Therefore I'm using the following code in the user-exit to extract the data from the call-stack

field-symbols: <fs>. 
data: xclnot like sy-datar. 

* Retrieve values from calling program 
assign ('(SAPLCOIH)XCLNOT') to <fs>. 
xclnot = <fs>.

And it doesn't work. It seems to work OK for internal tables, but not for this single character field.

The next thing I would like to do is push it back to the calling program (yes I know this may cause problems - but I won't know till I try)

Any ideas?

Guys,

Another basic question from a PM/CS guy trying to make a name as a programmer...

The user-exit I'm using (IWO10004) does not have the import/export parameters I require.

Therefore I'm using the following code in the user-exit to extract the data from the call-stack

field-symbols: <fs>. 
data: xclnot like sy-datar. 

* Retrieve values from calling program 
assign ('(SAPLCOIH)XCLNOT') to <fs>. 
xclnot = <fs>.

And it doesn't work. It seems to work OK for internal tables, but not for this single character field.

The next thing I would like to do is push it back to the calling program (yes I know this may cause problems - but I won't know till I try)

Any ideas?

19 REPLIES 19
Read only

Former Member
0 Likes
2,367

u can chk out in debugging mode wat might be the reason for this.. just go to the place in the calling program where this user exit is being called.. n at that point of time c wat value this variable of urs is having...if it doesnt hold any value at that instant, then its obvious it ll be blank even in the user exit.

Hope it helps,

regards,

Bikash

Read only

Former Member
0 Likes
2,367

Hi peter,

1. first of all to check,

whether it will work or not,

2. go in debug mode,

and check the variable

(programname)variablename

3. If it shows the value there,

then we can proceed to check,

whats wrong in the code.

regards,

amit m.

Read only

0 Likes
2,367

check out this weblog.

<a href="/people/brad.williams/blog/2005/04/25/userexits--how-do-i-access-inaccessible-data">Userexits - how do I access inaccessible data?</a>

Regards

Raja

Read only

0 Likes
2,367

Thanks for the replies guys.

Just before I enter the user-exit in debug mode, if I enter (SAPLCOIH)XCLNOT then the current value is shown.

As soon as I enter the user-exit the above becomes inactive (yellow icon). After the user-exit it is OK again.

If I use (SAPLCOIH)caufvd, then everything is OK all the way through..

The only difference is that caufvd is a structure and xclnot is a single character field (not in structure or table).

Any help would be appreciated

PeteA

Read only

0 Likes
2,367

Hi again,

1. If this is the case,

then probably we cannot do much about it.

2. The reason may be that the

structure may have been defined globally in the program,

whereas the variable character field,

may have been defined some where locally.

3. Or may be what u are saying is true.

(but still i think there must be some other

reason)

(the program name for that variable may be different,

it may be in some include or etc etc.)

regards,

amit m.

Read only

0 Likes
2,367

Hi Pete,

instead of using field symbols,try this.. in fact SAP does the same thing right before the user exit is called..


IMPORT xclnot FROM MEMORY ID 'CLNOT'.

Regards,

Suresh Datti

Read only

0 Likes
2,367

Suresh,

Thanks..

The problem is that I want to change the value and send a blank back.

Hence the <b>assign</b> function

Message was edited by: Peter Atkin

Read only

0 Likes
2,367

Hi Peter,

In that case you can do this..


IMPORT xclnot FROM MEMORY ID 'CLNOT'.
clear xclnot.
EXPORT xclnot FROM MEMORY ID 'CLNOT'.

Regards,

Suresh Datti

Read only

0 Likes
2,367

Suresh,

The problem is that I cannot add the "IMPORT xclnot... to the SAP standard code (modification).

I've messed around with this option, but its too late in the process.

This is why I would like to use the <b>assign</b> function.

However, the XCLNOT is a local variable in include LCOIHFG8 and not SAPLCOIH. Unfortunately I cannot use this in the <b>assign</b> function

Read only

0 Likes
2,367

Peter,

Why is it a modification? Didn't you say it was in the User Exit IWO10004?.. You can put the IMPORT statement right there in place of the ASSIGN statement..

Regards,

Suresh Datti

Read only

0 Likes
2,367

Suresh,

Yes, but I want to change the value and send it back.

However it is not part of the import/export parameters of the FM.

If I use IMPORT.... to bring this value into the calling program (LCOIHFG7) then this would be a modification.

Read only

0 Likes
2,367

Peter,

If you want to change the value & send it back.. you can put the following code in the User Exit.. did you try it?


IMPORT xclnot FROM MEMORY ID 'CLNOT'.
clear xclnot.
EXPORT xclnot FROM MEMORY ID 'CLNOT'.

Regards,

Suresh Datti

Read only

0 Likes
2,367

Suresh,

I tried it before, and I've just tried it again and it doesn't work.

Correct me if I'm wrong..

But you need <b>something</b> at the other end to re-import the CLNOT memory value. And this is my problem since this "<b>something</b>" is in the SAP standard code.

Read only

0 Likes
2,367

OK now I see your point.. like you already said, there seems to be no other option except to modify the SAP code..

Regards,

Suresh Datti

Read only

0 Likes
2,367

Suresh,

So this where I thought the <b>assign</b> function may be useful.

But this is causing problems (read the above)

PeteA

Read only

0 Likes
2,367

Peter,

With the ASSIGN, you will only be able read the value of the variable from the other program into the exit, but you cannot change the value of the variable in the other program.

Regards,

Suresh Datti

Read only

0 Likes
2,367

Suresh,

Not according to this (which I picked up from <b>this</b> forum):

FIELD-SYMBOLS : <FS>.

IF CAUFVD_IMP-AUART = 'PM10'.

ASSIGN '(SAPLCOZF)EBAN_EXP-KNTTP' TO <FS>.

<FS> = 'F'.

ENDIF.

This is what I wanted to use to push the data back to the calling program. The first problem is that I can't get it <b>into</b> the user-exit in the first place.

NOTE: I have seen this technique several times before, always with a warning..

Read only

0 Likes
2,367

Peter,

the question if you can use the assign trick depends on where the variable is declared.

As for the question if it is a modification or not you are right from a formal point of view. You do not need any access key - hence it is not a modfication. SAP provides with their user-exit concept a defined interface and ensures that the parameters are stable even if after an Upgrade. The variable you try to change is not part of the interface which means SAP does not foresee that you can change it within the user-exit.

You cannot rely that your change is stable in regard to Upgrades. So what you were trying to do is to bypass the modification in a very obsucre way. If SAP changes the logic, your user-exit would not work anymore Or even worse could cause inconsistencies.

In my opinion it would be better not to use the user-exit but modify the SAP Code directly. In this case you would realize that the program was changed if you apply a Note or while upgrading and you can check if your logic still fits.

Just my 2cts

Read only

0 Likes
2,367

Thanks Christian,

I was trying to get a "simple" solution to a common problem.

This issue is repeatedly raised in the PM/CS on-line forums.

I get the impression I'm fighting a losing battle... I guess its back to the modification option.

PeteA