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

How to get TcodeA when TcodeA calls TcodeB

former_member425121
Participant
0 Likes
1,995

Hi

I need to get the initial tcode from a second called tcode.

That is , F-43 calls FB01 ; i'm doing some enhancement where i need to detect wich tcode is being executed , but i need the initial tcode F-43 not FB01.

Does somebody knws how can i get that initial tcode executed by user from the second tcode called ?

Thanks

Frank

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,616

Hi,

I guess you can determine this with the help of call stack. Use FM SYSTEM_CALLSTACK to get the current call stack and try to find the called tcode from this.

I hope this may be useful.

Regards

Karthik D

10 REPLIES 10
Read only

former_member156446
Active Contributor
0 Likes
1,616

try getting the sy-cprog and use that to hit TSTC table to get the T code of it.

Read only

0 Likes
1,616

use sy-cprog.....it will always have the Root Program name.

Read only

0 Likes
1,616

Thanks Joy

The point is that both Tcodes call the same program SAPMF05A .

There are several FI tcodes wich calls the FB01 tcode , the 'alternate' tcodes like F-43 are for post documents for specific posting keys then calls FB01 (wich are for all differents posting keys) restricting the posting key values.

Do you know if there is a way for get the initial Tcode executed by user from the second tcode called ?

Regards

Frank

Read only

0 Likes
1,616

if u know the first possible tcodes, u can store the value from them into a parameter id in SAP memory and retrieve them in the second tcode exits.

Read only

0 Likes
1,616

Thanks Soumya

How can i store the inital Tcode in the parameter id ? , since i execute F-43 i'm inside FB01 because

F-43 (and the others possible tcodes) are just tcodes for call FB01.

And the purposse is when the enhancement is executed i can filter the desired users tcodes.

So i need , being in FB01, to get the initial tcode F-43 (or others) executed by user for can filter this.

Best Regards

Frank

Read only

0 Likes
1,616

frank,

jsut check if any exit exist in these initial tcodes... u can check them by keeping a break point in

cl_exithandler->get_instance method.

after keeping this break point, run ur tcode..u will definitely come across a exit.(i am not in front of SAP system, else i cud have checked for u). if u get an exit. write the code to store the tcode id in a paramater

will this do??

Read only

0 Likes
1,616

Thanks Soumya

I got already the exit but this exit is called inside FB01 , there are several FI tcodes wich calls FB01:

F-43 -> FB01 -> program SAPMF05A

F-02 -> FB01 -> program SAPMF05A

FB05 -> FB01 -> program SAPMF05A

FB22 -> FB01 -> program SAPMF05A

etc.

(being in SAPMF05A i need to know wich initial tcode F-43/F-02/FB05/etc. was executed)

In all exits, badis or enhancements executed wherever i access sy-tcode it contains 'FB01' ; but i need to get the initial tcode executed by the user (F-43 or others) and not FB01 , because i need execute the enhancement just for some of those tcodes not for all , so in need to filter the tcodes inside it.

I hope i give the explanation well.

Best Regards

Frank

Read only

0 Likes
1,616

>

> F-43 -> FB01 -> program SAPMF05A

> F-02 -> FB01 -> program SAPMF05A

> FB05 -> FB01 -> program SAPMF05A

> FB22 -> FB01 -> program SAPMF05A

> etc.

Frank,

i am not sure, but all these initial tcodes such as F-43, F-02, etc must be having different screen exits atleast as each of them must be having different screen numbers. in that case there must be having different PBO's atleast in the includes of SAPMF05A.

can these screen numbers and screen exits give any light on what u need?

Edited by: soumya prakash mishra on Jun 16, 2009 12:11 AM

Read only

Former Member
0 Likes
1,618

Hi,

I guess you can determine this with the help of call stack. Use FM SYSTEM_CALLSTACK to get the current call stack and try to find the called tcode from this.

I hope this may be useful.

Regards

Karthik D

Read only

0 Likes
1,616

Please using as below

CALL 'GET_PARAM_TCOD' ID 'PTCOD' FIELD tcode.