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

Modifying the selection screen

Former Member
0 Likes
1,127

Hi ,

This is how I have defined my selection screen .


SELECTION-SCREEN BEGIN OF BLOCK pcode1 WITH FRAME TITLE text-s02.

parameters : p_crun type char1 radiobutton group rad2 ,
             p_prun type char1 radiobutton group rad2 default 'X'.

select-options : s_date for sy-datum .
selection-screen skip .
parameters :     p_test type char1 as checkbox .

SELECTION-SCREEN END OF BLOCK pcode1.

My intension is insert a code in the program which should work this way :

When I select p_crun the select option for date filed should disappear from the screen and when I select p_prun the date option should appear so that I can enter my date range .

this is the code I am using and it is not working :


at selection-screen output .

  perform modify_screen .

FORM modify_screen .

  loop at screen .

    if p_crun eq c_x .

      if screen-name eq '*S_DATE*' .
        screen-invisible = '0' .
        screen-active = '0' .
        screen-input = '0' .
      endif .

    endif .

    modify screen .
  endloop .
endform .

Can anyone help me to fix tis problem .

Thanks and Regards ,

Daniel .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,079

Hi,

Please check the modified code..Changes are marked in bold..

SELECTION-SCREEN BEGIN OF BLOCK pcode1 WITH FRAME TITLE text-s02.

parameters : p_crun type char1 radiobutton group rad2 <b>USER-COMMAND USR</b>,

p_prun type char1 radiobutton group rad2 default 'X'.

select-options : s_date for sy-datum <b>MODIF ID G1</b>.

selection-screen skip .

parameters : p_test type char1 as checkbox .

SELECTION-SCREEN END OF BLOCK pcode1.

at selection-screen output .

perform modify_screen .

FORM modify_screen .

loop at screen .

if p_crun eq c_x .

<b>if screen-GROUP1 = 'G1'.

screen-invisible = '1' .

screen-active = '0' .

screen-input = '0' .

endif .

else p_prun eq c_x.

if screen-GROUP1 = 'G1'.

screen-invisible = '0' .

screen-active = '1' .

screen-input = '1' .

endif .</b>

endif .

modify screen .

endloop .

endform .

Thanks,

Naren

10 REPLIES 10
Read only

Former Member
0 Likes
1,079

Hi,

Changes are marked in bold..Instead of using the select-options name..use the modif id..

SELECTION-SCREEN BEGIN OF BLOCK pcode1 WITH FRAME TITLE text-s02.

parameters : p_crun type char1 radiobutton group rad2 <b>USER-COMMAND USR</b>,

p_prun type char1 radiobutton group rad2 default 'X'.

select-options : s_date for sy-datum <b>MODIF ID G1</b>.

selection-screen skip .

parameters : p_test type char1 as checkbox .

SELECTION-SCREEN END OF BLOCK pcode1.

at selection-screen output .

perform modify_screen .

FORM modify_screen .

loop at screen .

if p_crun eq c_x .

if screen<b>-GROUP1 = 'G1'.</b>

screen-invisible = '<b>1</b>' .

screen-active = '0' .

screen-input = '0' .

endif .

else p_prun eq c_x.

<b> if screen<b>-GROUP1 = 'G1'.</b>

screen-invisible = '<b>0</b>' .

screen-active = '1' .

screen-input = '1' .</b>

endif .

endif .

modify screen .

endloop .

endform .

Thanks,

Naren

Read only

0 Likes
1,079

Hi Naren ,

This did not work . I am working in HR ABAP . Is that a constraint ?

Can you please recheck and let me know .

Thanks ,

Daniel .

Read only

0 Likes
1,079

Hi

Try this: it works fine:

SELECTION-SCREEN BEGIN OF BLOCK PCODE1 WITH FRAME TITLE TEXT-S02.

PARAMETERS : P_CRUN TYPE CHAR1 RADIOBUTTON GROUP RAD2 USER-COMMAND AAA,
             P_PRUN TYPE CHAR1 RADIOBUTTON GROUP RAD2 DEFAULT 'X'.

SELECT-OPTIONS : S_DATE FOR SY-DATUM MODIF ID SEL.
SELECTION-SCREEN SKIP .
PARAMETERS :     P_TEST TYPE CHAR1 AS CHECKBOX .

SELECTION-SCREEN END OF BLOCK PCODE1.


AT SELECTION-SCREEN OUTPUT .

  PERFORM MODIFY_SCREEN .

*---------------------------------------------------------------------*
*       FORM modify_screen                                            *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM MODIFY_SCREEN .

  LOOP AT SCREEN .

    IF P_CRUN EQ 'X' .

      IF SCREEN-GROUP1 EQ 'SEL' .
        SCREEN-ACTIVE = '0' .
      ENDIF .

    ENDIF .

    MODIFY SCREEN .
  ENDLOOP .
ENDFORM .

Max

Read only

Former Member
0 Likes
1,080

Hi,

Please check the modified code..Changes are marked in bold..

SELECTION-SCREEN BEGIN OF BLOCK pcode1 WITH FRAME TITLE text-s02.

parameters : p_crun type char1 radiobutton group rad2 <b>USER-COMMAND USR</b>,

p_prun type char1 radiobutton group rad2 default 'X'.

select-options : s_date for sy-datum <b>MODIF ID G1</b>.

selection-screen skip .

parameters : p_test type char1 as checkbox .

SELECTION-SCREEN END OF BLOCK pcode1.

at selection-screen output .

perform modify_screen .

FORM modify_screen .

loop at screen .

if p_crun eq c_x .

<b>if screen-GROUP1 = 'G1'.

screen-invisible = '1' .

screen-active = '0' .

screen-input = '0' .

endif .

else p_prun eq c_x.

if screen-GROUP1 = 'G1'.

screen-invisible = '0' .

screen-active = '1' .

screen-input = '1' .

endif .</b>

endif .

modify screen .

endloop .

endform .

Thanks,

Naren

Read only

0 Likes
1,079

Hi Naren ,

Good this worked . But can you please explain me what difference this

<b>USER-COMMAND USR</b> is making .

Thanks ,

Daniel .

Read only

Former Member
0 Likes
1,079

Hi DAniel,

Execute this code ,its working.

data:c_x type c value 'X'.

SELECTION-SCREEN BEGIN OF BLOCK pcode1 WITH FRAME TITLE text-s02.

parameters : p_crun type char1 radiobutton group rad2 ,

p_prun type char1 radiobutton group rad2 default 'X' .

select-options : s_date for sy-datum MODIF ID SC1.

selection-screen skip .

parameters : p_test type char1 as checkbox .

SELECTION-SCREEN END OF BLOCK pcode1.

at selection-screen output .

perform modify_screen .

FORM modify_screen .

loop at screen .

if p_crun eq c_x .

IF SCREEN-GROUP1 = 'SC1'.

screen-invisible = '0' .

screen-active = '0' .

screen-input = '0' .

endif .

endif .

modify screen .

endloop .

endform .

Check the Radiobutton p_crun ,press execute,

reward if helpful,

keerthi

Read only

Former Member
0 Likes
1,079

Hi,

If you specify the USER-COMMAND, when the user presses the radio button it will immediately trigger the AT SELECTION-SCREEN & AT SELECTION-SCREEN OUTPUT..

Please reward points for helpful answers..

Thanks,

Naren

Read only

0 Likes
1,079

Hi

That Nares's saying is right, but you should consider one thing:

The select-options is defined for input/output by default, so u need code only to change this attribute and not the code to restore the default attribute.

So:

loop at screen .
  if p_crun eq c_x .
    if screen-GROUP1 = 'G1'.
      screen-invisible = '1'. "This line is useless 
      screen-active = '0' .   "This line is useless 
      screen-input = '0' .
    endif .
* All the following code is done automatically
  else p_prun eq c_x.          "This line is useless     
    if screen-GROUP1 = 'G1'.   "This line is useless 
      screen-invisible = '0'.  "This line is useless 
      screen-active = '1' .    "This line is useless 
      screen-input = '1' .     "This line is useless 
    endif .
  endif .
  modify screen .
endloop .

<u>So you need only this code</u>:

loop at screen .
  if p_crun eq c_x and screen-GROUP1 = 'G1'.
      screen-input = '0' .
      modify screen.
  endif .
endloop

Max

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,079

Hi Daniel, Simply set the ACTIVE field. If you set the INPUT field, you will see an extra field appear next to the SELECT-OPTION that you do not want. Try this coding.



report zrich_0001.

constants: c_x type c value 'X'.

SELECTION-SCREEN BEGIN OF BLOCK pcode1 WITH FRAME TITLE text-s02.

parameters : p_crun type char1 radiobutton group rad2 user-command chk,
             p_prun type char1 radiobutton group rad2 default 'X'.

select-options : s_date for sy-datum modif id SD .
selection-screen skip .
parameters :     p_test type char1 as checkbox .

SELECTION-SCREEN END OF BLOCK pcode1.



*My intension is insert a code in the program which should work this way
* :
*
*When I select p_crun the select option for date filed should disappear
*from the screen and when I select p_prun the date option should appear
*so that I can enter my date range .
*
*this is the code I am using and it is not working :


at selection-screen output .

  perform modify_screen .

FORM modify_screen .

  loop at screen .

    if p_crun eq c_x
       and screen-group1 eq 'SD' .
        screen-active = '0' .
    endif .

    if p_prun eq c_x
       and screen-group1 eq 'SD' .
        screen-active = '1' .
    endif .

    modify screen .
  endloop .
endform .

Regards,

Rich Heilman

Read only

0 Likes
1,079

Hi ,

Thanks a lot Rich , Max and Naren for your valuable answers and quick response .

I have awarded ponits for all .

Once again thanks a ton .

Regards ,

Daniel .