Application Development 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: 

Get calling program name

prabhu_s2
Active Contributor
0 Kudos

hi

i have programB which is calling the programA. Inside programA how i can get the name of the calling program i.e. programB? I have no access to prgramB code to make changes for importing and exporting so looking for any other standard way of doing it? any hints pls?

thanks

prabhu

6 REPLIES 6

JerryWang
Employee
Employee
0 Kudos

Hi Prabhu,

try FM SYSTEM_CALLSTACK.

Best Regards,

Jerry

0 Kudos

Hello Jerry,

When a program is called using SUBMIT, the internal session of the calling program is replaced by that of the called program. So SYSTEM_CALLSTACK won't be of use!

@Nikhil: SY-CPROG will hold the name of the calling program for externally called procedures viz., CALL FUNCTION, PERFORM form IN PROGRAM program IF FOUND etc. Don't think it'll contain the value of the calling program for SUBMIT.

@OP: Can you confirm if program A is called by program B only? Or are there other programs which might be calling A?

BR,

Suhas

Former Member
0 Kudos

Thanks Suhas for correcting me.

Best Regards,

Nikhil Patil

0 Kudos

Hi Suhas,

it depends on the SUBMIT option "AND RETURN" whether the internal mode is replaced or not. Without it will be replaced.

Regards,

Klaus

0 Kudos

>

> it depends on the SUBMIT option "AND RETURN" whether the internal mode is replaced or not. Without it will be replaced.

Hello Klaus,

My bad! But if you check the ABAP stack in the called program you won't find the reference of the calling program.

Thanks for correcting my statement.

BR,

Suhas

Former Member
0 Kudos

Hi

Check the system variable sy-cprog.

Best Regards,

Nikhil Patil