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: 

handle TCode in background

Former Member
0 Kudos
1,088

In my program , there is some logic based on the tcode running..

i write the logic based on tcode...

if sy-tcode = 'XXX'.

write : / 'XXX'.

else.

write : / ABC.

endif.

it is working fine in foreground.. but not able to handle the sy-tcode in background..

please guide me on this..

5 REPLIES 5

Former Member
172

What is the exact requirement ? system variable SY-CPROG may be helpful.

0 Kudos
172

Exact Requirement :

For one Executable program we are creating 4 trnasaction codes.

When the user run the trnasaction code and enter the selection screen parameters and run the program in background ( F9 ).

Based on the transaction code some text needs to be displayed in the log...

this is the requirement.

i write the code..

example...

if sy-tcode = 'TCODE_1'.

write : 'First Tcode'.

elseif sy-tcode = 'TCODE_2'.

write : 'Second Tcode'.

endif.

if is working fine in foreground.. but not in background..

please guide me on this....

0 Kudos
172

help required..........

0 Kudos
172

Hi,

Try the following:

Create 4 variables,say W_VAR1,W_VAR2,W_VAR3,W_VAR4.

Under SELECTION-SCREEN OUTPUT event set the flags based on your T.Code. Change your conditions from SY-TCODE to W_VAR1,W_VAR2,W_VAR3,W_VAR4.

Thanks & Regards,

Faheem.

0 Kudos
172

You'll not be able to know the tcode when executing in background. This is a SAP standard behaviour. Check the below threads for more information

[url]

[url]

Regards

Ranganath