02-10-2009 9:46 PM
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
02-11-2009 4:47 AM
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.
02-10-2009 9:48 PM
02-10-2009 10:08 PM
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
02-11-2009 4:47 AM
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.
02-11-2009 2:45 PM