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

Dynamic update on report's selection-screen: Problem w/OBLIGATORY fields !

Former Member
0 Likes
1,297

Hello,

I have a problem with my selection screen and some radio buttons.

I have tried to switch dynamically a display on my screen based on radiobuttons. When I click on the first radiobutton, there is one specific field and when the second is selected, two others parameters I asked instead of the other one. So everything works well, using a u201Cuser-commandu201D on the radiobutton parameter declaration to allow the switch. Though, since some fields are u201Crequiredu201D (OBLIGATORY), if one is missing a value, I canu2019t make the switch at all, asking me to fill the fields first. Since the switch of radio button doesnu2019t require the fields to be filled, is there a way to somehow u201Cbypassu201D the required fields for the radiobutton change? Hereu2019s what I have tried so far:

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF pa_vac = gc_true.

      IF screen-group1 = 'BL1'.
        screen-active = '1'.
        screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BL2'.
        screen-active = '0'.
        screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BL1' OR screen-group1 = 'BL3'.
        screen-required = '1'.
      ENDIF.


    ELSE.

      IF screen-group1 = 'BL1'.
        screen-active = '0'.
        screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BL2'.
        screen-active = '1'.
      screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BL2' OR screen-group1 = 'BL3'.
        screen-required = '1'.
      ENDIF.

    ENDIF.

  ENDLOOP.

Thank you for your help everyone!

Please use code tags

Edited by: Rob Burbank on Sep 23, 2010 2:17 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
794

Hi PAQUEJO,

As said by Rob & Ravi you should nott use OBLIGATORY to make a field required when dealing with radiobuttons. To get the required functionality. in AT SELECTION-SCREEN event put validations based on function code 'ONLI', for example :


AT SELECTION-SCREEN.

CASE SY-UCOMM.

WHEN 'ONLI'.

"Put your conditions here like say your parameter is P_PARA then

IF P_PARA IS INITIAL.

MESSAGE E000(Z123) WITH 'Please fill field PARA'.

ENDIF.

ENDCASE.

Hope this will help.

Thanks & Regards,

Rock.

Hello,

I have a problem with my selection screen and some radio buttons.

I have tried to switch dynamically a display on my screen based on radiobuttons. When I click on the first radiobutton, there is one specific field and when the second is selected, two others parameters I asked instead of the other one. So everything works well, using a u201Cuser-commandu201D on the radiobutton parameter declaration to allow the switch. Though, since some fields are u201Crequiredu201D (OBLIGATORY), if one is missing a value, I canu2019t make the switch at all, asking me to fill the fields first. Since the switch of radio button doesnu2019t require the fields to be filled, is there a way to somehow u201Cbypassu201D the required fields for the radiobutton change? Hereu2019s what I have tried so far:

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF pa_vac = gc_true.

      IF screen-group1 = 'BL1'.
        screen-active = '1'.
        screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BL2'.
        screen-active = '0'.
        screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BL1' OR screen-group1 = 'BL3'.
        screen-required = '1'.
      ENDIF.


    ELSE.

      IF screen-group1 = 'BL1'.
        screen-active = '0'.
        screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BL2'.
        screen-active = '1'.
      screen-required = '0'.
        MODIFY SCREEN.
      ENDIF.
      IF screen-group1 = 'BL2' OR screen-group1 = 'BL3'.
        screen-required = '1'.
      ENDIF.

    ENDIF.

  ENDLOOP.

Thank you for your help everyone!

Please use code tags

Edited by: Rob Burbank on Sep 23, 2010 2:17 PM

4 REPLIES 4
Read only

Former Member
0 Likes
794

This is a pretty common problem. You'll have to remove the "obligatory" option and do the testing in the program.

Rob

Read only

ravi_lanjewar
Contributor
0 Likes
794

Hi,

Remove obligatory and put your validaton on while execute the sy-ucom = 'ONLI'.

Read only

Former Member
0 Likes
795

Hi PAQUEJO,

As said by Rob & Ravi you should nott use OBLIGATORY to make a field required when dealing with radiobuttons. To get the required functionality. in AT SELECTION-SCREEN event put validations based on function code 'ONLI', for example :


AT SELECTION-SCREEN.

CASE SY-UCOMM.

WHEN 'ONLI'.

"Put your conditions here like say your parameter is P_PARA then

IF P_PARA IS INITIAL.

MESSAGE E000(Z123) WITH 'Please fill field PARA'.

ENDIF.

ENDCASE.

Hope this will help.

Thanks & Regards,

Rock.

Read only

0 Likes
794

Thanks for your answer, very helpful even after years !

Best regards,

Paskalo