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

Determine which validation step called the user exit, possible?

Former Member
0 Likes
1,699

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

5 REPLIES 5
Read only

Former Member
0 Likes
1,232

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.

Read only

ThomasZloch
Active Contributor
0 Likes
1,232

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

Read only

0 Likes
1,232

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).

Read only

0 Likes
1,232

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

Read only

0 Likes
1,232

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