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: 

At selection screen

Former Member
0 Kudos

hi guys,

In the selection screen, i am having two radio buttons and a text field..

For 1st radio button, i have kept the text field as mandatory and on selection of 2nd radio button i have made the field disabled.

please find the below code used

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-name = 'P_RADIO1' OR screen-name = 'P_textfield'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF p_RADIO2 = 'X'.

LOOP AT SCREEN.

IF screen-name = 'P_textfield'.

screen-input = '0'.

CLEAR p_textfield.

  • SCREEN-OUTPUT = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

END-OF-SELECTION.

Once the radio button is selected and on pressing the enter button it works fine. i want to know whether the similar process should also work without pressing enter button. If so, how it is possible?

Regards

senthil

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Check below sample code:


parameters: p_rd1 radiobutton group rad1 default 'X' user-command but,
            p_rd2 radiobutton group rad1,
            p_text type char128 obligatory.

at selection-screen output.

  loop at screen.
     if screen-name CP '*P_TEXT*'.
        if not p_rd1 is initial.
           screen-active = 1.
           screen-required = 1.
        else.
           screen-active = 0.
           screen-required = 0.
        endif.
        modify screen.
     endif.
  endloop.

Note that by characteristic of Mandatory field, once set we need to give input before further processing can take place. Alternatively you can use error message handling.

Remember the addition USER-COMMAND which triggers the action without using ENTER.

Regards

Eswar

8 REPLIES 8

Former Member
0 Kudos

Hi

AT SELECTION-SCREEN event will be triggerd only when you do some action on the selection screen

so after selection the radiobutton you must click on enter button

or other than enter also it works

Former Member
0 Kudos

Hi,

u can do it when the user cliks on the radio button then next event should be happening.

for that purpose

parameters:

p_rad radiobutton group g1 user-command 'Co'.

Plzz reward points if it helps.

Former Member
0 Kudos

Hi,

This is possible and simple also.

Declare your selection screen as defined below:

selection-screen .......begin of.....

PARAMETERS: p_class RADIOBUTTON GROUP grp1 DEFAULT 'X' USER-COMMAND UC1

selection screen...........end of......

The syntax: USER COMMAND....will do this ABAP trick for the logic.

Once this is done, do the necessary logics in your AT Selection-screen output.

Reg,

JLN

Former Member
0 Kudos

Check below sample code:


parameters: p_rd1 radiobutton group rad1 default 'X' user-command but,
            p_rd2 radiobutton group rad1,
            p_text type char128 obligatory.

at selection-screen output.

  loop at screen.
     if screen-name CP '*P_TEXT*'.
        if not p_rd1 is initial.
           screen-active = 1.
           screen-required = 1.
        else.
           screen-active = 0.
           screen-required = 0.
        endif.
        modify screen.
     endif.
  endloop.

Note that by characteristic of Mandatory field, once set we need to give input before further processing can take place. Alternatively you can use error message handling.

Remember the addition USER-COMMAND which triggers the action without using ENTER.

Regards

Eswar

0 Kudos

hi guys,

Thanx for your answers.

AS you have said it works fine with user command.

When i click the radio button 1 it ask for text field and it s also mandatory, when i click radio button 2 immediately withou filling the mandatory field i just want the mandatory field also to be hidden, but it is asking still to fill the required fiedls..

how this can be achieved...

Thanx for your help

senthil

0 Kudos

Hi,

Give some default values to avoid the error.

Plz reward points if it helps.

0 Kudos

Hi,

If the fields are mandatory ones, then you have no other way but to enter the values in the selection screen.

Your functionality can be achieved only if all the fields on selection screen are optional ones.

Reg,

JLN

0 Kudos

try this code

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

selection-screen begin of line.

selection-screen comment 1(31) text-002 for field R1.

parameter : R1 radiobutton group RAD default 'X' user-command file .

.

selection-screen end of line.

selection-screen begin of line.

selection-screen comment 1(31) text-003 for field par.

parameter : par like rlgrap-filename MODIF ID A.

selection-screen end of line.

selection-screen begin of line.

selection-screen comment 1(31) text-002 for field R1.

parameter : R2 radiobutton group RAD .

.

selection-screen end of line.

selection-screen begin of line.

selection-screen comment 1(31) text-003 for field par1.

parameter : par1 like rlgrap-filename MODIF ID B.

selection-screen end of line.

selection-screen end of block 1.

at selection-screen output.

perform selection.

at selection-screen on value-request for par.

perform request using par.

&----


*& Form SELECTION

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM SELECTION .

loop at screen.

case screen-group1.

  • Presentation Server Radiobutton

when 'A'.

if R1 = space.

screen-invisible = '1'.

screen-input = '0'.

  • p_pres = 'X'.

  • else.

  • screen-invisible = '0'.

  • screen-input = '1'.

endif.

modify screen.

  • Shuttle Radiobutton

when 'B'.

if R2 = space.

screen-invisible = '1'.

screen-input = '0'.

  • else.

  • screen-invisible = '0'.

  • screen-input = '1'.

endif.

modify screen.

endcase.

endloop.

ENDFORM. " SELECTION