cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic parameter selection

martin_jonsson
Participant
0 Kudos

Hello All,

Is there any way to choose selection parameters dynamically (not a whole structure as with FM FREE_SELECTIONS_DIALOG), I'd want to represent the input parameters of a Function Module without either to know the FM at design time nor regenerate the selection program each time I run it.

Thanks

Martin

Accepted Solutions (0)

Answers (3)

Answers (3)

andreas_mann3
Active Contributor
0 Kudos

Martin,

what's your intention ?

-> look F1 : SELECT-OPTIONS sel FOR (f).

coud be helpful

Andreas

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

to my knowledge there is no direct dynamic way to create parameters on selection-screens. You must either generate a transient subroutine pool with <b>GENERATE SUBROUTINE POOL</b> and call the generated selection screens with <b>CALL SELECTION-SCREEN</b> from a generated subroutine or you dynamically create a persistent program that you store in the repository with <b>INSERT REPORT</b> and call it with <b>SUBMIT</b>.

A workaround could be, that you create a set of selection screens as subscreens with <b>SELECTION-SCREEN BEGIN OF SCREEN dynnr AS SUBSCREEN</b> and include them on your selection screen with

<b>SELECTION-SCREEN BEGIN OF TABBED BLOCK tblock FOR n LINES.

SELECTION-SCREEN END OF BLOCK tblock.</b>

This is the special case of a Tabstrip without tabtitle.

Example how to include subscreens dynamically from transaction ABAPDOCU (example library):

<b>REPORT demo_sel_screen_with_subscreen.

TABLES sscrfields.

  • SUBSCREEN 1

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.

PARAMETERS: p1(10) TYPE c,

p2(10) TYPE c,

p3(10) TYPE c.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN END OF SCREEN 100.

  • SUBSCREEN 2

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-020.

PARAMETERS: q1(10) TYPE c,

q2(10) TYPE c,

q3(10) TYPE c.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN END OF SCREEN 200.

  • SUBSCREEN 3

SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-030.

PARAMETERS: r1(10) TYPE c,

r2(10) TYPE c,

r3(10) TYPE c.

SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN END OF SCREEN 300.

  • STANDARD SELECTION SCREEN

SELECTION-SCREEN: FUNCTION KEY 1,

FUNCTION KEY 2.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK sub FOR 10 LINES,

END OF BLOCK sub.

INITIALIZATION.

sscrfields-functxt_01 = '@0D@'.

sscrfields-functxt_02 = '@0E@'.

sub-prog = sy-repid.

sub-dynnr = 100.

AT SELECTION-SCREEN.

CASE sy-dynnr.

WHEN 100.

IF sscrfields-ucomm = 'FC01'.

sub-dynnr = 300.

ELSEIF sscrfields-ucomm = 'FC02'.

sub-dynnr = 200.

ENDIF.

WHEN 200.

IF sscrfields-ucomm = 'FC01'.

sub-dynnr = 100.

ELSEIF sscrfields-ucomm = 'FC02'.

sub-dynnr = 300.

ENDIF.

WHEN 300.

IF sscrfields-ucomm = 'FC01'.

sub-dynnr = 200.

ELSEIF sscrfields-ucomm = 'FC02'.

sub-dynnr = 100.

ENDIF.

ENDCASE.</b>

nablan_umar
Active Contributor
0 Kudos

Hi Martin,

You might want to dynamically generate a program and then submit that program. Do help on GENERATE.