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: 

Common SELECTION-SCREEN in reports for reuse

Former Member
0 Kudos

Dear ABAPERS,

I have a number of ABAP reports with similar but complicated customized selection screen (i.e. implemented using SELECTION-SCREEN statement). I would like to "package" the codes for SELECTION-SCREEN in a common routine in an include program, so that all my reports can just use it (instead of all reports duplicating the same selection screen codes). Any changes to the selection screen can be made through the single source.

However, an error :

Within FORM routines and function modules, the SELECTION-SCREEN statement is not allowed.

Is there any other way to accomplish this goal ? Thank you.

Regards

KC

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi KC,

You can't declare Selections in a Form. So Declare all your selections in a Include Program and use that Include in your Main Program. So that there is no need of writing the same code.

Regards,

Sudhakar.

3 REPLIES 3

Former Member
0 Kudos

Hi KC,

You can't declare Selections in a Form. So Declare all your selections in a Include Program and use that Include in your Main Program. So that there is no need of writing the same code.

Regards,

Sudhakar.

Former Member
0 Kudos

Hello Kir,

The only way to be able to re-use a screen, selection-screen or otherwise, is when the screen is a subscreen.

Have one report program where you have got the selection screen defined as follows -

report  ztest.

selection-screen begin of screen 1010 as subscreen.
  parameters : test like t001-mandt.
selection-screen end of screen 1010.

Have a second program with normal screen, which has a subscreen area.


report ztest1.

data : repid type syrepid,
       dynnr type sydynnr.

repid = 'ZTEST'.
dynnr = '1010'.

call screen 100.

Screen 100 has a subscreen area and its flow logic will be something like this -

PROCESS BEFORE OUTPUT.
  call subscreen subscreen_area_name including repid 
                                               dynnr.
PROCESS AFTER INPUT.
  call subscreen sub1.

Now, each time you make a change to the selection-screen's definition in program ZTEST, the change will always be reflected in all the other programs which are using it as their subscreen.

Regards,

Anand Mandalika.

Former Member
0 Kudos

Hi Kir,

1. I had faced same problem.

2. what i did :

a) create two programs (Both Type 1 )

b) In Prog1 Define Selection Screen and INITIALIZATION

C) In Prog2 U can use events. (Prog2 can be Many programs in which u INCLUDE PROG1 at the top)

D) Use Report Statement in Prog1 (And Not in Prog2 : prog2 will have include prog1 at top, and then events)

3. To make it more better.

a) in Prog1 use SELECTION-SCREEN BEGIN OF BLOCK

concept

b) In Prog2 U can define additional parameters/screen elements

to ENHANCE your selection screen (if required)

It works fantastic for me.

Regards,

Amit M.

Message was edited by: Amit Mittal