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: 

Dynamic Selection Screen based on database seletion

Former Member
0 Kudos

Hi, Gurus:

I just have simple selection screen with a few radio buttons

However, I would like the radio button show up based on database table criterias:

e.g. if there is no data in table1, the radio button 1 will not showing up.

I have used "SELECT * from table..." and check the return value sy-subrc, if it is not equals 4 (4 means no data in the table), then I put the radio button clause there.

however, it does not work this way.

Thanks in advance

Liang

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Liang,

You can validate your above requirement in at selection-screen event.

Use loop at screen and take help of this sample code.

TABLES :

SFLIGHT .

SELECT-OPTIONS S_CARRID FOR SFLIGHT-CARRID ."MODIF ID SC1 .

AT SELECTION-SCREEN OUTPUT .

LOOP AT SCREEN .

IF SCREEN-NAME CS 'S_CARRID-HIGH'.

SCREEN-ACTIVE = 0 .

MODIFY SCREEN.

ENDIF.

Hope it helps!

Much Regards,

Amuktha.

4 REPLIES 4

Former Member
0 Kudos

Please see the help on LOOP AT SCREEN.

Rob

Former Member
0 Kudos

Hi,

This is a duplicate thread, similar kind of thread is already available .....

with the subject : Dynamic calling of radiobuttons

anyways,

possibly you can think of two ways,

say at the maximum the entry in the database table goes to 20 records and you know that it will not go more than that,

then you can create 20 radiobuttons and using at selection-screen output events hide radiobuttons based on the records present.

say only 4 records are present.

so hide 16 radiobuttons and display only 4 of them.

the other way.

say if there can be n number of records and you dont know the maximum number it can reach then

in the initialization event.

create a report at runtime with the parameter statement as radiobutton .

and then call that report in initialization event itself. this will display the dynamically created radiobutton.

Regards,

Siddarth

Former Member
0 Kudos

Hi Liang,

You can validate your above requirement in at selection-screen event.

Use loop at screen and take help of this sample code.

TABLES :

SFLIGHT .

SELECT-OPTIONS S_CARRID FOR SFLIGHT-CARRID ."MODIF ID SC1 .

AT SELECTION-SCREEN OUTPUT .

LOOP AT SCREEN .

IF SCREEN-NAME CS 'S_CARRID-HIGH'.

SCREEN-ACTIVE = 0 .

MODIFY SCREEN.

ENDIF.

Hope it helps!

Much Regards,

Amuktha.

0 Kudos

Hi, Amuktha:

Thanks, I got it now.

Liang