cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the calling program?

0 Kudos

Hi,

I have been using a function module for a long time which is called by quite a number of programs. Now I want it to react differently dependent on the calling program.

I could use a new optional parameter of course transferring the program id. In that case I have to change quite a number of programs.

I was just wondering if there is a possibility to get the information of the calling program on the fly. (In the debugger you can find your calling program easily in the 'call stacks'). Does anyone know how to retrieve this information?

Thanks in advance.

Regards Johannes

Accepted Solutions (1)

Accepted Solutions (1)

former_member188685
Active Contributor
0 Kudos

hi,

use this function module

<b>RS_EU_CROSSREF</b>

for this Function

I_FIND_OBJ_CLS = 'FUNC'

NO_DIALOG = 'X'

EXPAND_SOURCE_IN_BATCH_MODE = 'X'

and table parameter

I_FINDSTRINGS = 'FUNCTION MODULE NAME'

will list all the calling programs

the table paramter <b>I_FINDSTRINGS</b> all the calling program names.

regards

vijay

Answers (4)

Answers (4)

0 Kudos

Hi,

while searching the sdn archive I found the solution. You can retrieve the calling program using the fm 'SYSTEM_CALLSTACK'

Thank you very much for any help.

Regards Johannes

0 Kudos

Hi,

I am quite overwhelmed by the amount of answers.

Actually ufortunately neither of the solutions offered solve my problem.

1.) sy-cprog gives the name of the main program and not the name of the module/include/method that has called my function.

2.) The function 'RS_EU_CROSSREF' was unknown to me. It is very interesting but it is a cross reference und shows all calling programs and not the one that was actually calling the function.

Does anyone has got any other ideas?

Regard Johannes

Former Member
0 Kudos

HI

you can get the external called program name in the

SY-CPROG field

Former Member
0 Kudos

> HI

>

> you can get the external called program name in the

>

> SY-CPROG field

Plz read previous answer!

former_member188685
Active Contributor
0 Kudos

Hi,

you can also imitate the <b>where used list</b> functionality.

regards

vijay

Former Member
0 Kudos

use sy-cprog !!

<b>If it helped don't forget the reward ! :)</b>

Former Member
0 Kudos

CPROG

SYCPROG

CHAR 40

ABAP program, caller in external procedures