11-30-2005 4:44 AM
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
11-30-2005 4:58 AM
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.
11-30-2005 4:58 AM
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.
11-30-2005 5:10 AM
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.
11-30-2005 5:19 AM
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