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

problem in enabling the selection screen

Former Member
0 Likes
1,923

Hi ,

I have problem in enabling the selection screen.

i have radio button and based on the radio button i need to make the date field as mandatory.

When i tried this with at selection screen on radio button group XXX, itu2019s not triggering.

Could you please help me by resolving the above problem?

Vijay

7 REPLIES 7
Read only

Former Member
0 Likes
930

Hi,

try this,

parameters : p_hr radiobutton group rad1 default 'X' user-command usr.

in the at selection screen output.

you need to modify the screen fields to enable or disable.

eg code:

loop at screen.

if screen-group4 eq '232'.

if p_batch eq 'X'.

screen-active = '1'.

message i007.

else.

screen-active = '0'.

message i008.

endif.

modify screen.

endif.

endloop.

Regards,

Venkatesh

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
930

Hi,

If radiobutton1 is checked then field is not mandatory and if user selects radiobutton2 then make the date field as mandatory for the user.

Use this code:-


PARAMETERS : rad1 RADIOBUTTON GROUP gp1 DEFAULT 'X',
             rad2 RADIOBUTTON GROUP gp1.

PARAMETERS : date LIKE sy-datum.

AT SELECTION-SCREEN.

  IF rad2 = 'X' AND date IS INITIAL.
    MESSAGE 'Error' TYPE 'E'. "error message date field is mandatory
  ENDIF.

END-OF-SELECTION.

  WRITE : / date.

Hope this solves your problem.

Thanks & Regards,

Tarun Gambhir

Edited by: Tarun Gambhir on Feb 10, 2009 6:00 PM

Read only

Former Member
0 Likes
930

Hi,

U just assgin user-command to that radio button

declare like this

parameters:

p_radio as radiobutton group grp user-command UC default 'X',

p_rad1 as radiobutton group grp1.

at selection-screen output.

if p_radio eq 'X'.

loop at screen.

if screen-group1 CS 'GRP1'.

screen-active = 0 .

modify screen.

endif.

endloop.

endif.

Regards

Kiran

Edited by: Kiran Saka on Feb 10, 2009 1:38 PM

Read only

Former Member
0 Likes
930

Hi,

see the sap documentation

... RADIOBUTTON GROUP group [USER-COMMAND fcode]

Effect:

This addition specifies that the input field is displayed as a radio button in the first position on the selection screen, and the output field is displayed next to it on the right. The radio button is selected if the value of para is "X" or "x". Otherwise, it is not selected.

group is used to define the radio button group for the parameter. The name group is entered directly as a character string with a maximum of 4 characters. Within a selection screen, there must be a minimum of two parameters in the same radio button group. There cannot be more than one radio button group with the same name in one program, even if they are defined in different selection screens.

The parameter must be specified with the type c and length 1. Explicit length specification using len is not permitted. If the addition TYPE is used, it can only be followed by the generic type c or a non-generic data type of type

In a radio button group, only one parameter can be defined with the addition DEFAULT, and the specified value must be "X". By default, the first parameter in a radio button group is set to the value "X", and the rest are set to " ".

The addition USER-COMMAND can be used to assign a function code fcode to the first parameter in a radio button group. The function code fcode must be specified directly, and have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects any radio button of the radio button group on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields. If a function code used in the GUI status of the selection screen is specified for fcode, the selection screen processing is affected accordingly.

Note:

It is recommended to define the radio buttons of a radio button group directly underneath each other. If the selection screen also contains other elements, it is recommended to define each radio button group within a block surrounded by a frame.

Regards,

Venkatesh

Read only

Former Member
0 Likes
930

Hi,

Try this code . It works -


AT SELECTION-SCREEN OUTPUT .

  LOOP AT SCREEN .
    IF  p_user NE w_uname .
      IF screen-group1 = 'GRP' .
        screen-active = 0 .
      ENDIF.                           " IF SCREEN-GROUP1 EQ 'GRP' .
      MODIFY SCREEN.
    ENDIF.                             " IF P_USER IS INITIAL .
  ENDLOOP.                             " LOOP AT SCREEN .

Regards

Pinaki

Read only

Former Member
0 Likes
930

Hi,

Write the code for enabling the date field whn u click the radiobutton under 'AT SELECTION-SCREEN OUTPUT'. This will be called everytime the selection screen value is changed.

Regards,

Saba

Read only

Former Member
0 Likes
930

Hi Vijay,

If you want to enable or disable your date field dynamiclly on selction of radiobutton than you have to write your logic in AT SELECTION-SCREEN OUTPUT rather than the pai events and use LOOP SCREEN and MODIFY screen in that.

try it this way:

PARAMETERS:
  rad1 RADIOBUTTON GROUP rad DEFAULT 'X' user-command xyz,
  rad2 RADIOBUTTON GROUP rad.
PARAMETERS:
  date type sy-datum.

At selection-screen output."on radiobutton group rad..
if  rad2 = 'X'.
  loop at screen.
    if screen-name   = 'DATE'.
      screen-input  = 0.
      modify screen.
    endif.
  endloop.
endif.

With luck,

Pritam.