2011 Mar 07 10:27 PM
Hello all,
We have a a validation with different steps that use the same user exit in their respective check.
My functional analyst asked me if there is a way to programmatically determine in the user exit which step is executing the user exit.
So I am asking the same question here.
As an example:
Validation FI100 has step 001, 002, and 003.
Each of these steps use the user exit U100 from module pool ZGGBR001 in their check.
I haven't found a way in the code of U100 to determine which step called U100.
Does anyone know if this can be done?
I have used the following technique to get a variable from the program's call stack.
data: var_name(30) type c value '(Z_CALLING)VARIABLE' .
field-symbols: <fs> type any.
*
assign (var_name) to <fs>.
write: / 'Variable from Z_CALLING', <fs>.But I'm not sure how this might work with validation steps/user exits.
Thanks
Bruce
Hello all,
We have a a validation with different steps that use the same user exit in their respective check.
My functional analyst asked me if there is a way to programmatically determine in the user exit which step is executing the user exit.
So I am asking the same question here.
As an example:
Validation FI100 has step 001, 002, and 003.
Each of these steps use the user exit U100 from module pool ZGGBR001 in their check.
I haven't found a way in the code of U100 to determine which step called U100.
Does anyone know if this can be done?
I have used the following technique to get a variable from the program's call stack.
data: var_name(30) type c value '(Z_CALLING)VARIABLE' .
field-symbols: <fs> type any.
*
assign (var_name) to <fs>.
write: / 'Variable from Z_CALLING', <fs>.But I'm not sure how this might work with validation steps/user exits.
Thanks
Bruce
2011 Mar 08 5:05 AM
Use the function module SYSTEM_CALLSTACK to get the ABAP Call stack. Search for the record where PROGNAME = 'GBTLEFI0' which will give the details of Validation ID and Step Number involved in the call.
2011 Mar 08 8:29 AM
I just tried your idea with
DATA: var_name(30) TYPE c VALUE '(GBTC2FI0)G_STEP' .and that worked for me.
I would be careful with calling function modules like SYSTEM_CALLSTACK inside validation exits, as this code potentially runs for tens of thousands of transactions in a short time (in case of interfaces), which might cause runtime or system load issues.
Thomas
2011 Mar 08 8:47 AM
Thomas, Thanks for correcting me. But when i checked the call stack program GBTLEFI0 is appearing instead of GBTC2FI0 (i am getting the validation step G_STEP from the program GBTLEFI0). Is the difference specific to SAP version/configuration in which I am working ? (I am on ECC 5.0).
2011 Mar 08 9:03 AM
I'm working with ECC 6.0, and analysed the FI validations as maintained via OB28.
This shows that both our approaches might not be very stable, as a release upgrade might well cause changes in the call stack.
Another way would be to create a "wrapper exit" for each step, which just assigns a step number and passes it to the central exit.
Thomas
2011 Mar 08 10:04 PM
Vinod,
I did some debugging after I posted my question. I came to the same solution, use FM 'SYSTEM_CALLSTACK'.
*
VALCHCK_2FI100##001
loop at i_callstack into w_callstack
where EVENTNAME+0(9) = 'VALCHCK_2'.FI110 is the validation
001 is the step
Thomas,
Thanks for the caveats.
Bruce
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |