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

Toggling selection screen

Former Member
0 Likes
2,563

I need to create a toggling screen or perhaps tabbed not sure

One screen should contain matnr, plant, sold to party, inspection characteristics, result range

The other screen should contain delivery, sales order, inspection characteristics, result range.

Only one screen values should be filled and not both. Also in the second screen either sales order should be filled or delivery note and not both. Any ideas. Not sure if I want a tabbed screen or perhaps a button that toggles the screen and changes the input.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,120

In my START-OF-SELECTION event

how will I use my parameters. do I need to check if there are initial or not?

Can I do something like screen-group1 = 'SC1' then use parameters test

elseif screen-group2 = 'SC2' then use parameters test1

how do i break my logic so I dont have to check each time if the parameter is blank or not

16 REPLIES 16
Read only

Former Member
0 Likes
2,120

This code might help you -:)


REPORT  Z_DUMMY_ATG_3.

type-pools: icon.

data: switch.

selection-screen begin of block b2 with frame title text-001.
parameters: radio radiobutton group rnd user-command test default 'X',
            radio2 radiobutton group rnd.
selection-screen end of block b2.

selection-screen begin of block b1 with frame title text-001.
parameters:
           test type bkpf-belnr modif id sc1.
selection-screen end of block b1.

selection-screen begin of block b3 with frame title text-001.
parameters:
           test1 type bkpf-belnr modif id sc2.
selection-screen end of block b3.

AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
  IF SCREEN-GROUP1 = 'SC1' AND RADIO EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ELSEIF SCREEN-GROUP1 = 'SC2' AND RADIO2 EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ENDIF.
ENDLOOP.

start-of-selection.

But I don't remember if it's mine or from Rich Heilman... -:(

Greetings,

Blag.

Read only

Former Member
0 Likes
2,120

SELECTION-SCREEN BEGIN OF TABBED BLOCK tabb1 FOR 24 LINES.

SELECTION-SCREEN TAB (15) tabs1 USER-COMMAND ucomm1

DEFAULT SCREEN 100.

SELECTION-SCREEN TAB (15) tabs2 USER-COMMAND ucomm2

DEFAULT SCREEN 200.

SELECTION-SCREEN END OF BLOCK tabb1.

INITIALIZATION.

tabs1 = TEXT-001.

tabs2 = TEXT-002.

AT SELECTION-SCREEN.

CASE SY-UCOMM.

WHEN 'UCOMM1'.

tabb1-prog = 'ZCHECKS_RR'.

tabb1-dynnr = 100.

tabb1-activetab = 'TABS1'.

WHEN 'UCOMM1'.

tabb1-prog = 'ZCHECKS_RR'.

tabb1-dynnr = 200.

tabb1-activetab = 'TABS2'.

ENDCASE.

Read only

Former Member
0 Likes
2,120

See the example one :

----


  • Selection Screen *

----


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_werks LIKE marc-werks DEFAULT '1000' OBLIGATORY.

SELECT-OPTIONS s_stlal FOR mast-stlal .

SELECT-OPTIONS s_stlan FOR mast-stlan DEFAULT '1'.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

SELECTION-SCREEN SKIP.

PARAMETERS: p_bomlst RADIOBUTTON GROUP g1 DEFAULT 'X'.

SELECT-OPTIONS s_matnr FOR mast-matnr.

SELECTION-SCREEN SKIP.

PARAMETERS: p_compon RADIOBUTTON GROUP g1.

SELECT-OPTIONS: s_idnrk FOR stpo-idnrk.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN END OF BLOCK b1.

selection-screen begin of block b03 with frame title text-b03.

selection-screen begin of line.

selection-screen comment 1(40) text-005.

parameters: p_all radiobutton group r1 default 'X'.

selection-screen end of line.

selection-screen begin of line.

selection-screen comment 1(40) text-006.

parameters: p_one radiobutton group r1 .

selection-screen end of line.

selection-screen end of block b03.

Try to use Screen internal table to get your functionality.

at selection-screen output.

loop at screen.

write your logic.

endloop.

Thanks

Seshu

Read only

Former Member
0 Likes
2,120

Alavaro

I like your solution and would like to implement it. But I do not quite follow what you are doing here. Can you explain to me what you are doing in loop at screen?

Read only

0 Likes
2,120

Sure -:)

As you can see here...


selection-screen begin of block b1 with frame title text-001.
parameters:
           test type bkpf-belnr modif id sc1.
selection-screen end of block b1.

This selection-screen is defined as <b>sc1</b>

So in the LOOP...


AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
  IF SCREEN-GROUP1 = 'SC1' AND RADIO EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ELSEIF SCREEN-GROUP1 = 'SC2' AND RADIO2 EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    CONTINUE.
  ENDIF.
ENDLOOP.

If the SCREEN-GROUP is <b>sc1</b>, the we make the whole Selection-Screen invisible and the selection screen <b>sc2</b> visible -:)

That way, depending on the selected radiobutton, we show selection screen sc1 or sc2...

Greetings,

Blag.

Read only

Former Member
0 Likes
2,120

Alvaro

What is the user-command for? I dont see a definition of test in the program. But if I remove it, then the toggle does not work.

selection-screen begin of block b2 with frame title text-001.
parameters: radio1 radiobutton group rnd USER-COMMAND test default 'X',
            radio2 radiobutton group rnd.
selection-screen end of block b2.

so if screen-group = SC2 and radio2 is X, then sc1 will be displayed? Am i understanding this correctly.

Read only

0 Likes
2,120

Hello Megan,

See the below code :

REPORT ZJOINS .

tables : ekko,

ekpo,

marc,

t685b,

t000md.

----


  • Parameter und Select-Options

*

----


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

select-options:

s_ebeln for ekko-ebeln matchcode object mekk,

s_lifnr for ekko-lifnr matchcode object kred,

s_ekorg for ekko-ekorg memory id eko,

s_ekgrp for ekko-ekgrp memory id ekg,

s_bsart for ekko-bsart,

s_bedat for ekko-bedat.

selection-screen end of block po_document.

selection-screen skip 1.

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

parameters : p_werks like ekpo-werks modif id rel.

select-options: s_berid for ekpo-berid modif id ber,

s_dispo for marc-dispo modif id rel.

parameters : p_abart like ekek-abart modif id rel,

p_reduc type me_reduc modif id rel,

p_norel type me_norel modif id rel.

selection-screen end of block release.

selection-screen skip 1.

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

parameters : p_kappl like t681a-kappl modif id apl.

select-options: s_kschl for t685b-kschl.

parameters: p_vsztp like nast-vsztp,

p_vstat like nast-vstat default '0',

p_erdat like nast-erdat,

p_eruhr like nast-eruhr.

selection-screen end of block message.

at selection-screen output.

select single * from t000md. " WHERE DISFG EQ 'X'.

loop at screen.

case screen-group1.

when 'REL'.

if p_kappl ne 'EL' and p_kappl eq space.

screen-input = '0'.

screen-required = '0'.

screen-invisible = '1'.

else.

if screen-name eq 'P_WERKS'.

  • screen-required = '1'.

endif.

endif.

modify screen.

when 'BER'.

if t000md-disfg is initial or

( p_kappl ne 'EL' and p_kappl ne space ).

screen-active = 0.

screen-invisible = 1.

modify screen.

endif.

endcase.

endloop.

Please enter EL value in p_kappl and hit enter and see the diffrence

Thanks

Seshu

Read only

0 Likes
2,120

The <b>User-command</b> is used to assign an event to the radio buttons...So, when you press any of them, you can perform an action...In the AT SELECTION-SCREEN OUTPUT.

<i>

so if screen-group = SC2 and radio2 is X, then sc1 will be displayed? Am i understanding this correctly.

</i>

Exactly -:) Your right -;)

Greetings,

Blag.

Read only

Former Member
0 Likes
2,120

But you are not using user-command test?

Read only

0 Likes
2,120

Of course I'm using it -;) at


AT SELECTION-SCREEN OUTPUT.

We have only one user-command, so we don't need to pass it's name...

Greetings,

Blag.

Read only

0 Likes
2,120

The purpose of user-command in a radiobutton is just to raise the event AT SELECTION-SCREEN OUTPUT. It is similar to triggering PROCESS BEFORE OUTPUT in dialog module programs.

If you have more than one radiobutton groups defined in your screen, then you can use those user-commands for some specific processing.

Read only

Former Member
0 Likes
2,121

In my START-OF-SELECTION event

how will I use my parameters. do I need to check if there are initial or not?

Can I do something like screen-group1 = 'SC1' then use parameters test

elseif screen-group2 = 'SC2' then use parameters test1

how do i break my logic so I dont have to check each time if the parameter is blank or not

Read only

0 Likes
2,120

No, in your start of selection, you have to check each individual parameter if they are initial or not. Screen-group1 is useful only in the context of AT SELECTION-SCREEN OUTPUT.

Read only

0 Likes
2,120

Please post your current selection screen definition to refer to it in our discussions. In AT SELECTION-SCREEN OUTPUT, when radiobutton one is 'X', you can disable all the parameters that have SC2 in their SCREEN-GROUP1 field and if radiobutton 2 is selected (= 'X'), then you can make all the parameters with SCREEN-GROUP1 = 'SC1' disabled.

Read only

0 Likes
2,120

Maybe you can do something like this...


DATA: P_SEL TYPE C.

AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
  IF SCREEN-GROUP1 = 'SC1' AND RADIO EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    P_SEL = 2.
    CONTINUE.
  ELSEIF SCREEN-GROUP1 = 'SC2' AND RADIO2 EQ 'X'.
    SCREEN-ACTIVE = '0'.
    MODIFY SCREEN.
    P_SEL = 1.
    CONTINUE.
  ENDIF.
ENDLOOP.

Then, you can just read the value of P_SEL, if it's 2, then you know that you are using parameters from SELECTION-SCREEN SC2, if it's 1 then you use the parameters from SELECTION-SCREEN SC1.

Greetings,

Blag.

Read only

0 Likes
2,120

Just to give you an idea.


REPORT  zakstest1 NO STANDARD PAGE HEADING.

TABLES: vbak.

SELECTION-SCREEN BEGIN OF BLOCK buttons WITH FRAME TITLE v_box1.
PARAMETERS: p_rad1 RADIOBUTTON GROUP rad DEFAULT 'X' USER-COMMAND usr,
            p_rad2 RADIOBUTTON GROUP rad.
SELECTION-SCREEN END OF BLOCK buttons.

SELECTION-SCREEN BEGIN OF BLOCK screen1 WITH FRAME TITLE v_box2.
PARAMETERS: p_matnr LIKE mara-matnr MODIF ID sc1,
            p_werks LIKE marc-werks MODIF ID sc1.
SELECT-OPTIONS: s_kunnr FOR vbak-kunnr MODIF ID sc1.
SELECTION-SCREEN END OF BLOCK screen1.

SELECTION-SCREEN BEGIN OF BLOCK screen2 WITH FRAME TITLE v_box3.
PARAMETERS: p_slsord LIKE vbak-vbeln MODIF ID sc2,
            p_delvry LIKE likp-vbeln MODIF ID sc2.
SELECTION-SCREEN END OF BLOCK screen2.

INITIALIZATION.
  v_box1 = 'Select One'.
  v_box2 = 'Screen1'.
  v_box3 = 'Screen2'.

AT SELECTION-SCREEN OUTPUT.

  IF p_rad1 = 'X'.
    LOOP AT SCREEN.
      CHECK screen-group1 = 'SC2'.
      screen-active = 0.
      MODIFY SCREEN.
    ENDLOOP.
  ELSEIF p_rad2 = 'X'.
    LOOP AT SCREEN.
      CHECK screen-group1 = 'SC1'.
      screen-active = 0.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.