Application Development 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: 

Dynamic selection screen.

Former Member
0 Kudos
137

Hi Gurus,

My requirement as follows...

Block 1 contains 2 radio buttons.

Block 2 contains couple of select options.

Block 3 contains couple of different select options.

First radio button is set as default. so Block 2 should appear below block 1 as default.

If second radio button is selected Block 2 should be hidden and Block 3 should appear in the place of

Block 2.

Depending upon the Select options the report continues.

Please Help me out on this issue.

(I found few questions same as this previously posted but didnt exactly the same).

Awaiting for early replies.

regards,

deep.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
89

Hi,

Check this code.

SELECTION-SCREEN BEGIN OF BLOCK 001.

PARAMETERS: P_MRU RADIOBUTTON GROUP SEL DEFAULT 'X' USER-COMMAND AC,

P_PART RADIOBUTTON GROUP SEL.

SELECT-OPTIONS P1 FOR <field> MODIF ID PRT.

SELECT-OPTIONS P2 FOR <field> MODIF ID PRT.

SELECT-OPTIONS G1 FOR <field> MODIF ID MRU.

SELECT-OPTIONS G2 FOR <field> MODIF ID MRU.

SELECTION-SCREEN END OF BLOCK 001.

AT SELECTION-SCREEN OUTPUT.

IF P_MRU = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'PRT'.

SCREEN-INPUT = '0'.

ENDIF.

IF SCREEN-GROUP1 = 'MRU'.

SCREEN-INPUT = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF P_PART = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'MRU'.

SCREEN-INPUT = '0'.

ENDIF.

IF SCREEN-GROUP1 = 'PRT'.

SCREEN-INPUT = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Regards,

Bharat Kalagara.

13 REPLIES 13

kanishakgupta1
Contributor
0 Kudos
89

Plz try this code...



REPORT  ZTEST_CHECK                             .


parameters: p_sale radiobutton group g1 user-command ABC default 'X',
            p_mate radiobutton group g1 .

selection-screen: begin of block b0 with frame.
parameters: p_vbeln like vbak-vbeln modif id ABC.
selection-screen: end of block b0.

selection-screen: begin of block b1 with frame.
parameters :  p_matnr like mara-matnr modif id XYZ.
selection-screen: end of block b1.



at selection-screen output.

if p_sale = 'X'.

loop at screen.
if screen-group1 = 'ABC'.
screen-active = 0.
endif.
modify screen.
endloop.
endif.

if p_mate = 'X'.
loop at screen.
if screen-group1 = 'XYZ'.
screen-active = 0.
endif.
modify screen.
endloop.
endif.

Former Member
0 Kudos
89

hi,

at selection-screen output.

"  NOTE : Modif ID for all the select-options in the block 2 should have the same value for example BL2 
" and all the select-options for block3 should have the same value for example BL3.

if radio1 = 'X'.
loop at screen.
  if screen-group1 = 'Modif ID the select options of Block 3'.
      screen-active = 0.
      modify screen.
  endif.
endloop.
else.
loop at screen.
  if screen-group1 = 'Modif ID the select options of Block 2'.
      screen-active = 0.
      modify screen.
  endif.
endloop.
endif.

Regards,

Siddarth

Former Member
0 Kudos
89

Hi.

Test the following code

TABLES: kna1 , pa0001.


PARAMETERS: rd1 RADIOBUTTON GROUP g1 USER-COMMAND cmd DEFAULT 'X',
            rd2 RADIOBUTTON GROUP g1 .

SELECTION-SCREEN: BEGIN OF BLOCK block1 WITH FRAME.

SELECT-OPTIONS:kunnr FOR kna1-kunnr MODIF ID s1.
SELECT-OPTIONS:name1 FOR kna1-name1 MODIF ID s1.
SELECT-OPTIONS:name2 FOR kna1-name2 MODIF ID s1.

SELECTION-SCREEN: END OF BLOCK block1.


SELECTION-SCREEN: BEGIN OF BLOCK block2 WITH FRAME.

SELECT-OPTIONS:pernr FOR pa0001-pernr MODIF ID s2.
SELECT-OPTIONS:begda FOR pa0001-begda MODIF ID s2.
SELECT-OPTIONS:endda FOR pa0001-endda MODIF ID s2.

SELECTION-SCREEN: END OF BLOCK block2.



AT SELECTION-SCREEN OUTPUT.

  IF rd1 = 'X'.

    LOOP AT SCREEN.
      IF screen-group1 = 'S2'.
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

  IF rd2 = 'X'.
    LOOP AT SCREEN.
      IF screen-group1 = 'S1'.
        screen-active = 0.
      ENDIF.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.

0 Kudos
89

Hi all,

Thanks for all you replies.....The code works well....

But still there is a problem.

In block 2 there is an obligatory field (mandatory), so if i check the second radio button it prompts me to enter a value in that field and doesnt gets changed to block 3.

Note :Block 3 also contains an obligatory field.

(On removing this obligatory field the code works well...)

regards,

deep.

Former Member
0 Kudos
90

Hi,

Check this code.

SELECTION-SCREEN BEGIN OF BLOCK 001.

PARAMETERS: P_MRU RADIOBUTTON GROUP SEL DEFAULT 'X' USER-COMMAND AC,

P_PART RADIOBUTTON GROUP SEL.

SELECT-OPTIONS P1 FOR <field> MODIF ID PRT.

SELECT-OPTIONS P2 FOR <field> MODIF ID PRT.

SELECT-OPTIONS G1 FOR <field> MODIF ID MRU.

SELECT-OPTIONS G2 FOR <field> MODIF ID MRU.

SELECTION-SCREEN END OF BLOCK 001.

AT SELECTION-SCREEN OUTPUT.

IF P_MRU = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'PRT'.

SCREEN-INPUT = '0'.

ENDIF.

IF SCREEN-GROUP1 = 'MRU'.

SCREEN-INPUT = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF P_PART = 'X'.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'MRU'.

SCREEN-INPUT = '0'.

ENDIF.

IF SCREEN-GROUP1 = 'PRT'.

SCREEN-INPUT = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Regards,

Bharat Kalagara.

0 Kudos
89

Hi Bharat ,

Please check my previous comment....

But still there is a problem.
In block 2 there is an obligatory field (mandatory), so if i check the second radio button it prompts me to enter a value in that field and doesnt gets changed to block 3.

0 Kudos
89

have u checked my code.

plz check it.

0 Kudos
89

Hi tahir naqqash ,

Ya i have checked your code too....

It works fine if there is no mandatory field in the selection screen.but i do have a mandatory field in block 2.Help me sort out this problem.

0 Kudos
89
" Hi just change the block 2 as
just write obligatory if u want with any field

SELECTION-SCREEN: BEGIN OF BLOCK block2 WITH FRAME.

SELECT-OPTIONS:pernr FOR pa0001-pernr      OBLIGATORY  MODIF ID s2.
SELECT-OPTIONS:begda FOR pa0001-begda   OBLIGATORY  MODIF ID s2.
SELECT-OPTIONS:endda FOR pa0001-endda   OBLIGATORY  MODIF ID s2.

SELECTION-SCREEN: END OF BLOCK block2.

0 Kudos
89

do one thing when u r looping at screen just assign some value to the mandatory field at once in ur code itself and then later clear it. so that the changing of blocks happen smoothely.

кu03B1ятu03B9к

0 Kudos
89

Hi tahir....

If it is made obligatory there,While selecting radio button 2 , the block 2 doesnt disappear prompting me to enter something in the obligatory fields...

How to surpass this obligatory check.?

0 Kudos
89

provide values to the obligatory field thru ur coding itself.

like s_vbeln = '00000000'.

anyways since u wont be using this block so no effect on ur code's working whatever value u give, and later if u want u mat clear it too.

кu03B1ятu03B9к

0 Kudos
89

Now change it as.

SELECTION-SCREEN: BEGIN OF BLOCK block2 WITH FRAME.

SELECT-OPTIONS:pernr FOR pa0001-pernr DEFAULT '1234'  MODIF ID s2.
SELECT-OPTIONS:begda FOR pa0001-begda  DEFAULT '20081201'  MODIF ID s2.
SELECT-OPTIONS:endda FOR pa0001-endda DEFAULT '20081201'  MODIF ID s2.

SELECTION-SCREEN: END OF BLOCK block2.

if it is not so as u required, then please make more clear what actually u want