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: 

Provide Input Parameters when called only from a TCODE

Former Member
0 Kudos

Hi Experts,

I have a requirement where in we need to provide a input parameters for a report when it is triggered from a TCODE.

When this program is executed in SE38, the input parameters should not be available. The report takes a default value which is

defined in the program.

We need use the same program when called using the TCODE, as well as from SE38.

Looking for a early response.

Thanks in advance.

Regards,

Kumar.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Suhas Saha,

The program willl be scheduled everyday which will take the default date.

For retriving data for a particular date i need to provide user input screen. This will be done through ZTCODE.

Regards,

Kumar.

13 REPLIES 13

MarcinPciak
Active Contributor
0 Kudos

You can use [Parameter Transaction|http://help.sap.com/saphelp_nw04/helpdata/en/eb/5fab44d79b11d296190000e82de14a/frameset.htm] in order to pass data to the report once called by this tcode.

Regards

Marcin

royolav_johansen
Explorer
0 Kudos

Use event INITIALIZATION.

And check if sy-tcode <> 'SA38' and <> 'SE38'.

Then set the value for the parameter.

Regards

Roy

Edited by: Roy Olav Johansen on Oct 10, 2010 2:14 PM

Former Member
0 Kudos

Thanks for your response.

But the requirement is, the parameter screen itself should not available if i trigger the code from SE38.

And the parameter screen should be available if i come through the TCODE.

Regards,

Kumar

0 Kudos

Hello,

Does this fit the bill:

PARAMETERS: p_bukrs TYPE bukrs.

INITIALIZATION.
  IF sy-tcode NE 'ZTEST'. "Name of the T-Code assigned to the report
    MESSAGE 'Cannot use SE38 to run the report' TYPE 'E'.
  ENDIF.

BR,

Suhas

0 Kudos

So simply hide it if called via SE38


at selection-screen output.
   if sy-tcode NE 'your_tcode'. 
     loop at screen.
        if screen-name = 'SOME_PARAMETER'.
            screen-active = 0.
            modify screen.
        endif.
     endloop.
   endif.

Regards

Marcin

Former Member
0 Kudos

Dear Marcin,

Thanks for ur comment.

If i do as suggested by you,

Screen parameters are inactive, this is ok, but it stops at a empty screen.

I need to press the execute button again to run the program. This is should not happen. The program should run without any manual interventions or any error message popping out if run through SE38. If i run from TCODE it should show the input parameters.

Regards,

Kumar

0 Kudos

If you want to suppress this empty screen, simply create another program where you use


report z_addit_program.

submit z_original_program. 

This will run the program and will not show the selection screen anymore (so even no need to hide the parameters). Then create a ZTCODE for z_original_program .

This way when you run it via se38, use Z_ADDIT_PROGRAM, and when run via ZTCODE it will run Z_ORIGINAL_PROGRAM. In first case no parameters will come at all, in the secod case entire selection screen will be shown.

Regards

Marcin

0 Kudos

>

> I need to press the execute button again to run the program. This is should not happen. The program should run without any manual interventions or any error message popping out if run through SE38. If i run from TCODE it should show the input parameters.

I don't get why do you want this functionality. Do your users have authority for SE38 in Production?

Former Member
0 Kudos

Suhas Saha,

The program willl be scheduled everyday which will take the default date.

For retriving data for a particular date i need to provide user input screen. This will be done through ZTCODE.

Regards,

Kumar.

0 Kudos

In this way I don't know how you want to schedule the ZTCODE. In my opinion you should be using same program and checking if sy-batch = 'X' so you know whether it was run in frontend or in the background.


report z_addit_program.

if sy-batch = 'X'.
   submit z_original_program with parameter1 = sy-datum.
else.
   submit z_original_program.
endif.

Then forbid the access to Z_ORIGINAL_PROGRAM

Regards

Marcin

0 Kudos

Hello,

Create a parameter transaction and give screeb names from se93.

Thanks.

Ramya.

0 Kudos

>

> The program willl be scheduled everyday which will take the default date.

In case of Background processing SELECTION-SCREEN will not be displayed so you don't have to worry about it.

For retriving data for a particular date i need to provide user input screen. This will be done through ZTCODE.

You would schedule the job on a daily basis in SM36 & for individual dates you'll access the report via the T-Code. So where does SE38 come into the picture?

@Marcin: If SY-BATCH = 'X', i don't think SELECTION-SCREEN will be available

BR,

SUhas

Former Member
0 Kudos

Hi all,

Thanks for the response.

Got the Solution.

Regards,

Kumar.