Skip to Content
1
May 28, 2015 at 01:52 PM

Unusual behaviour on multiple function modules using the same include

292 Views

Hi,

This is a more general question, but I'm first going to explain what motivates it, you can skip it since it's related to how I found the bug.

I've been testing two standard function modules: WS_DELIVERY_UPDATE and WS_REVERSE_GOODS_ISSUE. These FM's are used to post a goods issue related to a delivery and reverse it respectively. They are really simple FM's, I think I am using 2 or 3 parameters on them.

The problem is when they are executed in succession.

If in the same session, a user POSTS a good issue and then tries to reverse it, the system gives me the error that the used delivery doesn't exist, if I re-start the session, ws_reverse_goods_issue works normally. If we search on SDN, there's several topics on these two FM's and this exact problem.

Now, why does this happen?

There are 3 programs involved:

-The first FM, WS_DELIVERY_UPDATE, is on the Function Group V50L, this FG utilizes the include vblkdata.

-The second FM, WS_REVERSE_GOODS_ISSUE, is on FG V51W, this FG also utilizes the include vblkdata.

-both FM's, utilize forms of the module pool SAPMV50A, this guy also utilizes the include vblkdata.


The include has a variable, LIKP.

For the sake of writing less stuff, i'm gonna call FM WS_DELIVERY_UPDATE = A, and WS_REVERSE_GOODS_ISSUE = B


If I call FM B, somewhere in the main code it updates the variable (B)LIKP-VBELN, this also changes the variable (SAPMV50A)LIKP-VBELN and the program works normally.

If I call FM A, and then B, then what happens is, when the variable (B)LIKP-VBELN is changed, (SAPMV50A)LIKP-VBELN doesn't change.

Somehow, it seems that the first function module that uses a perform of SAPMV50A will also share a memory area with it.

Also, the FM B was DESIGNED to use such a feature, it doesn't work if it doesn't get hold of such "shared memory area".

My question is: Is this an intended design by SAP? what is happening here? I'm trying to understand what's the logic of this, what are the expected behaviours, etc etc

I'm not trying to solve the problem here, I know a few ways to do so. I want to understand what is really happening

TL;DR: 3 programs(A,B,C) use the same include, programs A and B use C. if I B changes a variable declared in the include, it also changes the value on C. If I call program A then B, B stops changing values on C.