Skip to Content
-1

Multiple Selection-Screen Issue

Jan 04, 2017 at 09:42 PM

58

avatar image

Hello everyone,

I am creating a program that is prompting the user to either enter inputs, or reference a file that has inputs. When I use the below code, the program creates a begin screen that prompts the user, then correctly navigates to the manual / file input reference. The issue comes when the user inputs the information then clicks execute, the program does not process, but when you click (F3) back, the program processes.

*&---------------------------------------------------------------------*
*& SELECT-OPTIONS & PARAMETER DECLARATION
*&---------------------------------------------------------------------*
parameters: rb1 RADIOBUTTON GROUP ab,
rb2 RADIOBUTTON GROUP ab.

selection-screen begin of screen 100 title TEXT-T03.
parameters: P_BUKRS like PAYR-ZBUKR obligatory,
P_HBKID like PAYR-HBKID obligatory.
select-options P_HKTID for PAYR-HKTID.

selection-screen end of screen 100.

selection-screen begin of screen 200.
parameters: P_FNAME type STRING obligatory.

selection-screen end of screen 200.

at SELECTION-SCREEN.
if rb1 = 'X'.
call SELECTION-SCREEN 100.
perform GET_CHECKS_FOR_YEAR.
perform FIND_KUKEY.
perform FIND_OPEN_CHECKS.
perform UPDATE_OPEN_CHECKS.
else.
call SELECTION-SCREEN 200.
perform READ_UNIX_FILE.
endif.

end-of-selection.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Sandra Rossi Jan 04, 2017 at 10:30 PM
0

Be careful, AT SELECTION-SCREEN is called after input for any of the 3 selection screens (1000, 0100, 0200). You should test the system variable SY-DYNNR (screen number) to decide which code to run.

Share
10 |10000 characters needed characters left characters exceeded
Richard Harper Jan 05, 2017 at 02:26 PM
1

Or, hide the fields dependant on the value of the radio buttons. Then on the at selection screen output event, either activate or deactivate the fields. that is a lot simpler than having to handle sub screens and the like. You then end up with a standard report and making decisions based upon parameters rather than screen numbers.


Rich

Share
10 |10000 characters needed characters left characters exceeded
Andrew Mitchell Jan 05, 2017 at 02:08 PM
0

Thank you, Sandra. I updated to the code below and it looks to work properly now.

*&---------------------------------------------------------------------*
*& SELECT-OPTIONS & PARAMETER DECLARATION
*&---------------------------------------------------------------------*
parameters: rb1 RADIOBUTTON GROUP ab,
rb2 RADIOBUTTON GROUP ab.

selection-screen begin of screen 100 title TEXT-T03.
parameters: P_BUKRS like PAYR-ZBUKR obligatory,
P_HBKID like PAYR-HBKID obligatory.
select-options P_HKTID for PAYR-HKTID.

selection-screen end of screen 100.

selection-screen begin of screen 200.
parameters: P_FNAME type STRING obligatory.

selection-screen end of screen 200.

start-of-selection.

if SY-DYNNR EQ 1000.
if rb1 = 'X'.
call SELECTION-SCREEN 100.
perform GET_CHECKS_FOR_YEAR.
perform FIND_KUKEY.
perform FIND_OPEN_CHECKS.
perform UPDATE_OPEN_CHECKS.
else.
call SELECTION-SCREEN 200.
PERFORM READ_UNIX_FILE.
endif.
endif.

end-of-selection.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

You don't need anymore SY-DYNNR because your code is in event START-OF-SELECTION (SY-DYNNR is to be used only in events AT SELECTION-SCREEN).

Moreover, the event END-OF-SELECTION is not needed as it doesn't contain any code (and it's usually only for the obsolete "logical databases").

0