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: 

Can we submit a "T-CODE" in backgroun job

Former Member
0 Kudos

Hi,

I wish to manually submit a Z* T-code in Background job.

When I look at Sm36 it asks for the program name, but I want a way where I can enter T-CODE and not program name.

Reason for above requirement is because the underlying Zprogram is called by 5 different Z t-codes and each T-code invokes a different selection screen. If I use program name in SM36 it uses all the selection-screen fields and not transaction specific selection-screen fields.

So I want to run the background job for a single t-code and expect its relavent selection-screen fields to be used. Is there a way or I will need to create a new Z*program for every T-code so that they can be run in background.

Any clues Gurus. Apprecaite your advise.

Many Thanks

RK

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Rajiv,

Try creating 5 separate variants for your programme and define then along with the program in SM36.

I understand only the selection-screen changes for each t-code. I assume you do not check your t-code for any further program logic after the start-of-selection.

Hope this helps.

Regards.

6 REPLIES 6

uwe_schieferstein
Active Contributor
0 Kudos

Hello Rajiv

I do not see where the problem lies if you are using the report name. For submitting the background job you have to provide your report and a variant which, I suppose, should be specific for each different selection screen.

Regards

Uwe

Former Member
0 Kudos

Hi Rajiv,

Try creating 5 separate variants for your programme and define then along with the program in SM36.

I understand only the selection-screen changes for each t-code. I assume you do not check your t-code for any further program logic after the start-of-selection.

Hope this helps.

Regards.

0 Kudos

Hi All,

Each transaction calls a separate group of fields and some of them are mandatory.

Once I submit background job with the variant specific to a T-Code, it errors with amessage 'Fill all MANDATORY fields'.

When I analysed I saw the underlying program has 20 selection fields of whick 7 are mandatory.

When I call my Z T-code, it shows only 5 selection fields of which 2 are mandatory. So when I run my background job for this variant it points to the Zprogram and not Z Tcode and expects data in all 7 mandatory fields.

So what should I do ?

Thanks

RK

0 Kudos

Unfortunately, in that case creating another Z-program is the best alternative OR another soln is to modify the Z-prg so as to remove the manditory variation from parameters and validate them at at selection-screen depending on the transaction code OR create a variant and populate dummy values to the other mandatory fields(though it depends on how do you use that fields in the pgm)

0 Kudos

Hello Rajiv

You could add an additional parameter <b>p_tcode</b> that is not displayed if your report is started by one of your 5 transactions (modify SCREEN at event AT SELECTION-SCREEN OUTPUT for this parameter):

PARAMETERS:
  p_tcode     TYPE tcode  DEFAULT syst-tcode.

Also, depending on p_tcode you define the mandatory fields for your selection-screens (SCREEN-REQUIRED = 1). Thus, omit the option OBLIGATORY at the parameters and select-options.

Now, instead of checking for syst-tcode you check for p_tcode which you can add to your variants.

Regards

Uwe

Former Member
0 Kudos

You can submit the job with that perticular variant ....