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

regarding the selection screen

Former Member
0 Likes
676

hi,

iam using the code like as below.

case sy-tcode.

when 'YTC1'.

selection-screen begin of screen 0100.

selection-screen begin of block b1 with frame title text-001.

select-options matnr for mara-matnr.

select-options lifnr for lfa1-lifnr no intervals.

selection-screen end of block b1.

selection-screen begin of block b2 with frame title text-002.

parameters r1 radiobutton group g.

parameters r2 radiobutton group g.

parameters r3 radiobutton group g.

selection-screen end of block b2.

selection-screen end of screen 0100.

when 'YTC2'.

selection-screen begin of screen 0200.

selection-screen begin of block b3 with frame title text-003.

select-options matnr for mara-matnr.

selection-screen end of block b3.

selection-screen begin of block b4 with frametitle text-004.

parameters r1 radiobutton group g.

selection-screen end of block b4.

selection-screen end of screen 0200.

endcase.

it is throwing the error as already matnr is defined.but i require this because i have to use to transaction codes for the same program and i have to display each screen for one transaction.

please correct me.

thanks in advance

6 REPLIES 6
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
647

Hi,

Change here for 'YTC2' : select-options s_matnr for mara-matnr.

As matnr is alsready declared when 'YTC1'.

*reward if helps.

Read only

Former Member
0 Likes
647

since it is the same program, you will have to rename your variables...you can still have the same type so that you are not affected.

case sy-tcode.

when 'YTC1'.

selection-screen begin of screen 0100.

selection-screen begin of block b1 with frame title text-001.

select-options matnr for mara-matnr.

select-options lifnr for lfa1-lifnr no intervals.

selection-screen end of block b1.

selection-screen begin of block b2 with frame title text-002.

parameters r1 radiobutton group g.

parameters r2 radiobutton group g.

parameters r3 radiobutton group g.

selection-screen end of block b2.

selection-screen end of screen 0100.

when 'YTC2'.

selection-screen begin of screen 0200.

selection-screen begin of block b3 with frame title text-003.

select-options <b>s_matnr</b> for mara-matnr.

selection-screen end of block b3.

selection-screen begin of block b4 with frametitle text-004.

parameters <b>r4</b> radiobutton group <b>g1</b>.

selection-screen end of block b4.

selection-screen end of screen 0200.

endcase.

Read only

Former Member
0 Likes
647

Hi,

Write all the parameters and selection-screen.

use selection-screen output event

ie select-options : matnr for mara-matnr modif id 'MRN'.

at selection-screen output.

if sy-tcode = 'YTC1'.

loop at screen.

if screen-group1 = 'MRN'.

screen-active = '0'.

modify screen.

endif.

endloop.

endif.

regards,

Santosh Thorat

Read only

Former Member
0 Likes
647

hi surya ,

i think u have to handle this by using at selection screen output .

under this event u have to check for ur tcode and then make the screen elements invisible or in display mode .

Thanks

ROhit

Read only

Former Member
0 Likes
647

The program will not allow to declare same variable twice. so you need to change the matnr with a cnange (i.e.<b> s_matnr</b>) in 'YTC2'.

when 'YTC2'.

selection-screen begin of screen 0200.

selection-screen begin of block b3 with frame title text-003.

select-options s_matnr for mara-matnr.

selection-screen end of block b3.

selection-screen begin of block b4 with frametitle text-004.

parameters r4 radiobutton group g1.

selection-screen end of block b4.

selection-screen end of screen 0200

Rewards if useful.

Read only

matt
Active Contributor
0 Likes
647

Selection-screen, parameters and select-options define the screen for the abap interpreter. They are NOT executed ABAP commands, and as such will ignore any control structures.

e.g.

IF 1 EQ 1.
  PARAMETERS p_1 TYPE c.
ELSE.
  PARAMETERS p_2 TYPE c.
ENDIF.

Will produce a selection screen with <b>two</b> parameters - p_1 and p_2.

So, your "WHEN" structure is useless. You have to define both screens. You can't make it conditional.

matt