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

Get calling program name

prabhu_s2
Active Contributor
0 Likes
4,673

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
Read only

JerryWang
Product and Topic Expert
Product and Topic Expert
0 Likes
2,166

Hi Prabhu,

try FM SYSTEM_CALLSTACK.

Best Regards,

Jerry

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,166

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

Read only

Former Member
0 Likes
2,166

Thanks Suhas for correcting me.

Best Regards,

Nikhil Patil

Read only

Former Member
0 Likes
2,166

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

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,166

>

> 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

Read only

Former Member
0 Likes
2,166

Hi

Check the system variable sy-cprog.

Best Regards,

Nikhil Patil