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 output not working

Former Member
0 Kudos

Hello

On a sap 4.6  i have a report with two radiobuttons.When selecting the second radiobutton, there should appear some additional fields on the screen.

Parameters: rb1 radiobutton group rb1,

                   rb2 radiobutton group rb1.

I have used the event "at selection-screen on radiobutton group gr1" to catch the change on the radiobuttons. The event is not triggered when changing the selection on the radiobuttons, only when pressing the enter button. How can i trigger this event when changing the selection of the radiobuttons?

Even if i am changing the radiobuttons and pressing enter , my code for showing/hiding fields is processed but the fields do not dissapear anymore.

loop at screen.

    if screen-name eq 'FIELD1'.

      screen-invisible = 0.

      modify screen.

    endif.

endloop.

Sy-subrc = 0 but still, the field does not dissapear. I have tried all possible ways but still nothing.

Help.

Thanks

12 REPLIES 12

alex_campbell
Contributor

I notice that in your parameters statement, the radiobutton group is "RB1", but in your AT SELECTION-SCREEN statement you give the group name as "GR1". In addition, I believe you need to specify a USER-COMMAND in order for the radiobutton to trigger PAI (and thus, trigger the AT SELECTION-SCREEN event.

Also, The SCREEN-NAME will not be "FIELD1". It will be "RB1" and "RB2". But you shouldn't be using the SCREEN-NAME field, because they are generated dynamically in a selection screen. You should be using the MODIF ID keyword on your parameter declaration and the field SCREEN-GROUP1 in the screen loop.

Former Member
0 Kudos

Hi Sebastian,

Search the forum for examples. This has been discussed many times. Also, I think you have to use MODIF ID extension in your parameter declaration. Paste your code if still unable to figure out.

Regards,

Shravan

Former Member
0 Kudos

You can compare your work on this working sample code.

SELECTION-SCREEN BEGIN OF BLOCK selection WITH FRAME TITLE text-003.

PARAMETERS: p_show RADIOBUTTON GROUP rb1 USER-COMMAND aa,
                         p_hide RADIOBUTTON GROUP rb1.

PARAMETERS: p_matnr LIKE mara-matnr MODIF ID bb.

SELECTION-SCREEN END OF BLOCK selection.

AT SELECTION-SCREEN OUTPUT.
   LOOP AT SCREEN.

     IF screen-group1 = 'BB'.
       IF p_show = 'X'.
         screen-active = 1.                                  " 1 = show
       ELSEIF p_hide = 'X'.
         screen-active = 0.                                  " 0 = hide
       ENDIF.
       MODIFY SCREEN.
     ENDIF.
   ENDLOOP.

-Jake

0 Kudos

Hello

The user command helped me in triggering the pai but when using the loop at screen in the "at selection-screen output" and setting the field screen-active on 0 it is still displayed.

at selection-screen output.

loop at screen.

  if screen-group = 'GR1'

     if rb1 is not initial.

       screen-active = 1.

     else.

       screen-active = 0.

     endif.

    modify screen.

endif.

endloop.

screen-active is set to 0 and modify screen is processed, sy-subrc is 0 but still the fields remain visible on the screen.

Any idea?

Thank you

0 Kudos

Keep in mind that in order to trigger the second PBO (to hide the buttons when you've selected RB2), you need to trigger a PAI, so hopefully in your example you haven't removed the USER-COMMAND keyword from the parameter. Jake has already posted code nearly identical to what you require, but here is code where the radiobuttons themselves are hidden. Note that once you select P_HIDE, both radiobuttons dissapear, and you cannot select P_SHOW again!

PARAMETERS: p_show RADIOBUTTON GROUP gr1 MODIF ID gr1 DEFAULT 'X' USER-COMMAND GR1,
            p_hide RADIOBUTTON GROUP gr1 MODIF ID gr1.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-group1 = 'GR1'.
      IF p_show = 'X'.
        screen-active = 1.
      ELSE.
        screen-active = 0.
      ENDIF.
    ENDIF.

    MODIFY SCREEN.
  ENDLOOP.

0 Kudos

The idea is that the user can choose between rb1 and rb2 as many times as he wants and the other fields have to appear/disappear each time.

I know that in sap 6 it works fine but this 6.4 behaves strange.

thank you

0 Kudos

Show us your code. So that we can help you better.

-Jake

former_member519088
Discoverer
0 Kudos

  Try this below code:

SELECTION-SCREEN BEGIN OF block bok1 with frame.

   PARAMETERS: p_matnr TYPE mara-matnr MODIF ID i1,

               p_ernam TYPE mara-ernam MODIF ID i1,

               p_werks TYPE marc-werks MODIF ID i2.

   SELECTION-SCREEN end of BLOCK bok1.

   SELECTION-SCREEN begin of block bok2 with frame.

     PARAMETERS: r_mat RADIOBUTTON GROUP g1 USER-COMMAND u1 DEFAULT 'X',

                 r_pnt RADIOBUTTON GROUP g1 .

     SELECTion-screen end of block bok2.

AT SELECTION-SCREEN OUTPUT.

       loop AT SCREEN.

         if r_pnt = 'X'.

           if screen-group1 = 'I1'.

             screen-active = '0'.

             MODIFY SCREEN.

             endif.

             endif.

           if r_mat ='X'.

             if screen-group1 = 'I2'.

               screen-active ='0'.

               MODIFY SCREEN.

               ENDIF.

               ENDIF.

         endloop.

Former Member
0 Kudos

Hi ,

Follow the below link... i think this will solve your problem...

http://scn.sap.com/message/13323215#13323215

Regards,

Venkat.

0 Kudos

This is very strange, i have copied the code of Naresh and now it is workinv eventhough i was doing the same.

Thank you very much

0 Kudos

One of my computer science professors used to refer to "ghosts in the code", and the only way to get rid of them was to delete and rewrite the problemattic code. It's easy to forget to add or remove small things when you're trying to figure out how to make something work. Those small things can be tough to notice when you've been looking at the same code for awhile, and yet they tend to cause problems.

SAP IS GENIUS!! it work only if you have any 'USER-COMMAND'

"user-command com
PARAMETERS : p_01 RADIOBUTTON GROUP gr01 user-command com DEFAULT 'X' 
            ,p_02 RADIOBUTTON GROUP gr01     
            ,p_03 RADIOBUTTON GROUP gr01 
            .

and this"
AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN."
works