2017 Jan 04 9:42 PM
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.
2017 Jan 04 10:30 PM
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.
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
2017 Jan 04 10:30 PM
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.
2017 Jan 05 2:08 PM
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.
2017 Jan 05 11:08 PM
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").
2017 Jan 05 2:26 PM
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
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |