Application Development and Automation 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: 
Read only

Dynamic Selection screen

Former Member
0 Likes
675

Hello,

I need to create a dynamic selection screen based on certain fields selected by the user. The selection fields can be select-options and parameters.

I tries using FM FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG.Iam able to get only selection options working.

Is there way to add the parameter fields too?

example:

Select-option: s_1 for Mara-matnr.

Parameter: p_1 type mara-matrn.

I want to create this dynamically.

4 REPLIES 4
Read only

Former Member
0 Likes
548

Hi,

Use this sample code for dynamic selection screens

Create a selection screen say screen number 500 and call it dynamically.

Sample code

SELECTION-SCREEN BEGIN OF BLOCK sel1 WITH FRAME TITLE tit1.

PARAMETERS: cityfr TYPE spfli-cityfrom,

cityto TYPE spfli-cityto.

SELECTION-SCREEN END OF BLOCK sel1.

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.

SELECTION-SCREEN INCLUDE BLOCKS sel1.

SELECTION-SCREEN BEGIN OF BLOCK sel2

WITH FRAME TITLE tit2.

PARAMETERS: airpfr TYPE spfli-airpfrom,

airpto TYPE spfli-airpto.

SELECTION-SCREEN END OF BLOCK sel2.

SELECTION-SCREEN END OF SCREEN 500.

INITIALIZATION.

tit1 = 'Cities'.

AT SELECTION-SCREEN.

CASE sy-dynnr.

WHEN '0500'.

MESSAGE w888(SABAPDOCU) WITH 'Screen 500'.

WHEN '1000'.

MESSAGE w888(SABAPDOCU) WITH 'Screen 1000'.

ENDCASE.

START-OF-SELECTION.

tit1 = 'Cities for Airports'.

tit2 = 'Airports'.

CALL SELECTION-SCREEN 500 STARTING AT 10 10.

tit1 = 'Cities again'.

CALL SELECTION-SCREEN 1000 STARTING AT 10 10.

Regards

Krishna

Edited by: Krishna Gowrneni on Apr 30, 2009 10:24 PM

Read only

Former Member
0 Likes
548

Check the transaction ABAPDOCU. There is an example program given which meets your requirement

Thanks,

Babu Kilari

Read only

Former Member
0 Likes
548

hi

check out this code:

REPORT demo_call_selection_screen.

SELECTION-SCREEN BEGIN OF BLOCK sel1 WITH FRAME TITLE tit1.

PARAMETERS: cityfr TYPE spfli-cityfrom,

cityto TYPE spfli-cityto.

SELECTION-SCREEN END OF BLOCK sel1.

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.

SELECTION-SCREEN INCLUDE BLOCKS sel1.

SELECTION-SCREEN BEGIN OF BLOCK sel2

WITH FRAME TITLE tit2.

PARAMETERS: airpfr TYPE spfli-airpfrom,

airpto TYPE spfli-airpto.

SELECTION-SCREEN END OF BLOCK sel2.

SELECTION-SCREEN END OF SCREEN 500.

INITIALIZATION.

tit1 = 'Cities'.

AT SELECTION-SCREEN.

CASE sy-dynnr.

WHEN '0500'.

MESSAGE w888(SABAPDOCU) WITH 'Screen 500'.

WHEN '1000'.

MESSAGE w888(SABAPDOCU) WITH 'Screen 1000'.

ENDCASE.

START-OF-SELECTION.

tit1 = 'Cities for Airports'.

tit2 = 'Airports'.

CALL SELECTION-SCREEN 500 STARTING AT 10 10.

tit1 = 'Cities again'.

CALL SELECTION-SCREEN 1000 STARTING AT 10 10.

Read only

Former Member
0 Likes
548

Hi,

You can do this by using the MODIF ID on the selection field level & capture the same in the USER-COMMAND. You can use AT-SELECTION SCREEN OUTPUT event for the same.

Rgds,

Sachin.