1

I am trying to run 2 report programs, REPORTS_1 and REPORTS_2. The first program REPORTS_1 should only be executed if the first radio button is selected and all the parameters are filled in(parameter fields are always mandatory?). And the second program REPORTS_2 should only be executed if the second radio button is selected and all the corresponding parameters are filled in. Below is the code. Is this the place and correct way to call SUBMIT?

* Selection screen 1
SELECTION-SCREEN BEGIN OF BLOCK flight_block WITH FRAME TITLE text-002.
    PARAMETERS: carrid TYPE sbook-carrid MODIF ID sc1.
    PARAMETERS: connid TYPE sbook-connid MODIF ID sc1.
    PARAMETERS: fldate TYPE sbook-fldate MODIF ID sc1.
SELECTION-SCREEN END OF BLOCK flight_block.
*Selection screen 2
SELECTION-SCREEN BEGIN OF BLOCK customid_block WITH FRAME TITLE text-003.
    PARAMETERS: customid TYPE sbook-customid MODIF ID sc2.
SELECTION-SCREEN END OF BLOCK customid_block.
AT SELECTION-SCREEN OUTPUT.
* Toggle the selection screens based on radio buttons
 LOOP AT SCREEN.
     IF rad_flt = 'X' AND screen-group1 = 'SC2'.
         PERFORM modify_screen. "Calling subroutine
         SUBMIT Z15081947_MINI_REPORTS_1 AND RETURN. " Issue???
     ELSEIF rad_cus = 'X' AND screen-group1 = 'SC1'.
         PERFORM modify_screen. "Calling subroutine
         SUBMIT Z15081947_MINI_REPORTS_2 AND RETURN. " Issue???
     ENDIF.
 ENDLOOP.
* Subroutines.
FORM modify_screen.
 screen-active = 0.
 MODIFY SCREEN.
ENDFORM.
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48

1 Answers1

3

I don't see the radiobutton declaration. I assume it's something like:

PARAMETERS rad_flt type char01 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND RAD.
PARAMETERS rad_cus type char01 RADIOBUTTON GROUP g1.

Here the USER-COMMAND RAD part triggers a PBO/PAI immediately after a radiobutton change.

About the call of the reports: the event AT SELECTION-SCREEN OUTPUT is not the proper place for a SUMBIT statement, since it will be called at PBO, potentially not allowing the user to display the selection screen at all.

It's a more common practice to only change the screen fields (fields deactivation) in AT SELECTION-SCREEN OUTPUT

AT SELECTION-SCREEN OUTPUT.
* Toggle the selection screens based on radio buttons
   LOOP AT SCREEN.
     IF rad_flt = 'X' AND screen-group1 = 'SC2'.
         PERFORM modify_screen. "Calling subroutine
     ELSEIF rad_cus = 'X' AND screen-group1 = 'SC1'.
         PERFORM modify_screen. "Calling subroutine
     ENDIF.
 ENDLOOP.

and to perform the remaining logic in START-OF-SELECTION part for example:

START-OF-SELECTION.
  CASE 'X'.
  WHEN rad_flt.
    IF carrid IS NOT INITIAL AND
       connid IS NOT INITIAL AND
       fldate IS NOT INITIAL.
      SUBMIT Z15081947_MINI_REPORTS_1 AND RETURN.
    ENDIF.
  WHEN rad_cus.
    IF customid IS NOT INITIAL.
      SUBMIT Z15081947_MINI_REPORTS_2 AND RETURN.
    ENDIF.
  ENDCASE.
manuel_b
  • 1,646
  • 3
  • 20
  • 29
  • 1
    For more information about the **reporting events** and **selection screen events**, refer to the [ABAP documentation - Flow of an executable program](https://help.sap.com/doc/abapdocu_753_index_htm/7.53/en-US/index.htm?file=abenreporting_process.htm). – Sandra Rossi Nov 22 '19 at 13:11