‎2007 Nov 23 8:16 AM
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
‎2007 Nov 23 8:20 AM
Hi,
Change here for 'YTC2' : select-options s_matnr for mara-matnr.
As matnr is alsready declared when 'YTC1'.
*reward if helps.
‎2007 Nov 23 8:21 AM
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.
‎2007 Nov 23 8:22 AM
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
‎2007 Nov 23 8:25 AM
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
‎2007 Nov 23 8:50 AM
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.
‎2007 Nov 23 9:00 AM
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