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

Selection screen

Former Member
0 Likes
773

I have two selection screen blocks b1 and b2 , b1 has 3 select options and b2 has 3 . At any time user should enter values in any one of the blocks only , how to achieve this.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
737

Hi,

Try this code :

REPORT ZTEST_SELECTION_BLOCK.

data : count type i value 0.

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME.

PARAMETERS: number1 TYPE i,

number2 TYPE i,

number3 TYPE i.

SELECTION-SCREEN END OF BLOCK part1.

SELECTION-SCREEN BEGIN OF BLOCK part2 WITH FRAME.

PARAMETERS: number4 TYPE i,

number5 TYPE i,

number6 TYPE i.

SELECTION-SCREEN END OF BLOCK part2.

AT SELECTION-SCREEN.

if not number1 is initial or

not number2 is initial or

not number3 is initial.

count = count + 1.

endif.

if not number4 is initial or

not number5 is initial or

not number6 is initial.

count = count + 1.

endif.

if count GT 1.

message 'Any selection block has to be selected not both'(001) type 'E'.

endif.

START-OF-SELECTION.

write : 'Success'.

Thanks,

Sriram Ponna.

Message was edited by:

Sriram Ponna

6 REPLIES 6
Read only

Former Member
0 Likes
737

hi

i think u can go for a radio button option.

if not check for if any of the fields in block 1 iare not initial then deactivate block2

Read only

Former Member
0 Likes
737

May be you can use below logic :

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.

Enter p_kappl as EL and see the results or you can modify the code as you required

Thanks

Seshu

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
737

Couple ways to do this, here is one. You can have a radiobutton group which will determine which set of select-options will be shown. See this program.



report zrich_0001 .

parameters: p_b1 radiobutton group grp1 default 'X'
                            user-command switch,
            p_b2 radiobutton group grp1.

selection-screen begin of block b1 with frame.
select-options: s_datum1 for sy-datum modif id B1.
select-options: s_datum2 for sy-datum modif id B1.
select-options: s_datum3 for sy-datum modif id B1.
selection-screen end of block b1.

selection-screen begin of block b2 with frame.
select-options: s_datum4 for sy-datum modif id B2.
select-options: s_datum5 for sy-datum modif id B2.
select-options: s_datum6 for sy-datum modif id B2.
selection-screen end of block b2.


at selection-screen output.

loop at screen.
   if p_b1 = 'X'
      and screen-group1 = 'B2'.
   screen-active = 0.
   modify screen.
   endif.
   if p_b2 = 'X'
      and screen-group1 = 'B1'.
   screen-active = 0.
   modify screen.
   endif.

endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
737

Hi,

you can go with two options..

one put radio buttions for each block.. if first radio button is selected it should enable the block b1 else b2.

if you dont want this.. then you have to do it manually.say s1,s2s3 are select options in b1 and s4 s5 s6 are select options in b2

at selection-screen.

clear lv_count.

if s1 is NOT initial OR s2 is NOT initial OR s3 is NOT initial.

lv_COUNT = 1.

ENDIF.

IF S4 IS NOT INITIAL OR S5 IS NOT INITIAL OR S6 IS NOT INITIAL.

LV_COUNT = LV_COUNT + 1.

ENDIF.

IF LV_COUNT > 1.

MESSAGE E000 (MSGCLAS) WITH 'Enter values in any one block only.

endif.

Read only

Former Member
0 Likes
737

Hi,

You can use the below logic.lets say PAR1, PAR2 and PAR3 is the first block and PAR4,PAR5 and PAR6 si for second block elements

In the At sclection screen event.

If not PAR1 is intial or

not PAR2 is initial or

not PAR3 is intiai.

If not PAR4 is intial or

not PAR5 is initial or

not PAR6 is intiai.

  • raise an error message

endif.

endif.

Regards

Sudheer

Read only

Former Member
0 Likes
738

Hi,

Try this code :

REPORT ZTEST_SELECTION_BLOCK.

data : count type i value 0.

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME.

PARAMETERS: number1 TYPE i,

number2 TYPE i,

number3 TYPE i.

SELECTION-SCREEN END OF BLOCK part1.

SELECTION-SCREEN BEGIN OF BLOCK part2 WITH FRAME.

PARAMETERS: number4 TYPE i,

number5 TYPE i,

number6 TYPE i.

SELECTION-SCREEN END OF BLOCK part2.

AT SELECTION-SCREEN.

if not number1 is initial or

not number2 is initial or

not number3 is initial.

count = count + 1.

endif.

if not number4 is initial or

not number5 is initial or

not number6 is initial.

count = count + 1.

endif.

if count GT 1.

message 'Any selection block has to be selected not both'(001) type 'E'.

endif.

START-OF-SELECTION.

write : 'Success'.

Thanks,

Sriram Ponna.

Message was edited by:

Sriram Ponna