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

different selection screen for different tcode, but using the same program

former_member220801
Participant
0 Likes
2,949

I have written a program zreport, and created 2 tcode for it, zreport1 and zreport2.

I would like to have my selection screen differ when using different tcode to call the program.

for example:

when using zreport1 to call zreport

there are selection criteria A, B, C

while there are B, C, D, E when using zreport2.

I am now using a subroutine which loop through the screen and suppress unused fields by referencing sy-tcode during initization.

Is there any better method as I think I am using a very stupid method.... Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,318

Hi,

You can suppress the screen fields by looping thro' the screen in AT SELECTION-SCREEN OUTPUT event,

Rgds,

5 REPLIES 5
Read only

Former Member
0 Likes
1,319

Hi,

You can suppress the screen fields by looping thro' the screen in AT SELECTION-SCREEN OUTPUT event,

Rgds,

Read only

Former Member
0 Likes
1,318

Hi,

If you would like to differentiate between the two transactions, you can better define two different selection screens and call them using different transacations. This`ll help you bcoz when calling one tcode, only one selection screen is generated and the processing of the same happens.

Reward if helpful.

Regards

Read only

dani_mn
Active Contributor
0 Likes
1,318

HI,

define two selection-screen and call one depending on tcode.

try this report.

<b>

REPORT zwa_test2.
TABLES: spfli.

start-of-selection.


  If sy-tcode = 'ZREPORT1'.
    call selection-screen '123'.
  elseif sy-tcode = 'ZREPORT2'.
    call selection-screen '99'.
  endif.




  SELECTION-SCREEN BEGIN OF SCREEN 123 AS WINDOW TITLE TEXT-456.
  SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1
                                      NO INTERVALS.
  SELECT-OPTIONS SEL1 FOR SY-SUBRC.
  PARAMETERS     PAR1 LIKE SPFLI-CARRID.
  SELECTION-SCREEN COMMENT /10(20) TEXT-COM.
  SELECTION-SCREEN END OF BLOCK BL1.
  SELECTION-SCREEN END OF SCREEN 123.





  SELECTION-SCREEN BEGIN OF SCREEN 99.
  SELECTION-SCREEN PUSHBUTTON 15(25) PUBU
                   USER-COMMAND US01.
  SELECT-OPTIONS SEL2 FOR SPFLI-CONNID.
  PARAMETERS     PAR2 TYPE I.
  SELECTION-SCREEN END OF SCREEN 99.

</b>

Regards,

Read only

Former Member
0 Likes
1,318

i think, you have to define 2 selection screen say 1000 and 1001 and while create the transaction code for that program give them.

Regards

srikanth

Read only

Former Member
0 Likes
1,318

Hi gundam,

1. another option is of using

SELECTION SCREENS

(two different selection screens,

in the same program,

defined using

SELECTION-SCREEN BEGIN OF SCREEN 2000.

PARAMETERS : A(10) TYPE C.

SELECTION-SCREEN END OF SCREEN 2000.

SELECTION-SCREEN BEGIN OF SCREEN 3000.

PARAMETERS : B(20) TYPE C.

SELECTION-SCREEN END OF SCREEN 3000.

2. then in INITIALIZATION EVENT,

we can detect the tcode,

and CALL the selection screen.

3. just copy paste to get a taste of it.

( u may change the TCODE in the program code)

4.

report abc.

*----


SELECTION-SCREEN BEGIN OF SCREEN 2000.

PARAMETERS : A(10) TYPE C.

SELECTION-SCREEN END OF SCREEN 2000.

SELECTION-SCREEN BEGIN OF SCREEN 3000.

PARAMETERS : B(20) TYPE C.

SELECTION-SCREEN END OF SCREEN 3000.

*----


initialization.

IF SY-TCODE = 'SE38' or sy-tcode = 'ZTR01'.

CALL SELECTION-SCREEN 2000.

ENDIF.

IF SY-TCODE = 'ZTR02'.

CALL SELECTION-SCREEN 3000.

ENDIF.

*----


start-of-selection.

WRITE 😕 'AMIT'.

regards,

amit m.