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: 

How can i change SY-TCODE in runtime?

Former Member
0 Kudos

Hi All,

I have to copy standard transaction and i want to avoid copy all standard objects, my goal is just copy objects that are necessary but there is some standard function modules that are requesting for sy-tcode as i told you my transaction is 'Z' one. Then i would like to know if there is a way to change the sy-tcode value in runtime because i would like it contains standard transaction in stead of my 'Z' transaction.

Thank you in advance!

6 REPLIES 6

0 Kudos

Hi,

This is not possible.

There is no effect even if you assign some thing to SY-TCODE.

No use of SY-TCODE = 'ZTCODE'.

This will not overwrite the value of SY-TCODE.

Regards,

Sesh

Former Member
0 Kudos

Hi..

Just use SY-TCDE field of table SYST..

In PBO just write a case statement on SY-TCODE..

Nd u can easily change the YCODE at runtime..

If any doubt do let me know..

I will send u the code..

Reward points if useful..

Thanks

Arun

Former Member
0 Kudos

Hi it was SY-TCODE..

Hope it works..

former_member189059
Active Contributor
0 Kudos

If you have to pass sy-tcode to that transaction, then declare a new variable as follows

my_tcode like sy-tcode.
my_tcode = 'SE11'.

" or whatever u want to put in it

pass my_tcode to your program instead of sy-tcode

Former Member

I am copying transaction LM02 to ZLM02 this calls function modules from fuction group LMOB, y want to avoid copy function group LMOB then i want to set the sy-tcode with 'ZLM02' before call any function module from this group to avoid copy the function group and change the code of this.

I have found the reserved function

DATA xxxx LIKE SY-TCODE.

CALL 'GET_PARAM_TCOD' ID 'PTCOD' FIELD xxxx.

that return the real SY-TCODE

I think that could be there is one for set SY-TCODE.

Then my issue is still without a solution.

Thanks,

Thanks

0 Kudos

Hi

U can't change the value of SY-TCODE in runtime, the system'll replace again the current transaction if you try to change it.

If the std checks SY-TCODE you need to copy and change the includes of function group LMOB.

Max