2014 Jan 31 12:20 PM
how to create dynamic selection screen with the check boxes depends on table entries?
for example if one table ZDM0919 contains 10 entries then on selection screen we need to have 10 check boxes then user will select
any check box and run the report. If we have 6 table entries then 6 check boxes should be there on selection screen .
2014 Feb 03 6:07 AM
Hi Kachana,
You can make a wrapper report to get the number of checkboxes and declare the checkboxes and then call the main program in it.
REPORT ZTEST1.
tables zfuel_cons.
types :begin of t_code,
line(72),
end of t_code .
data: i_incl type table of t_code,
wa_incl type t_code.
data : i_cons type table of zfuel_cons, wa_cons type zfuel_cons.
data par_cnt(2) type n.
data counter(2) type n.
* include z_dyn_incl if FOUND.
parameters p_x type n NO-DISPLAY.
INITIALIZATION.
select * from zfuel_cons into table i_cons where not eadd = ' '.
par_cnt = 1.
DESCRIBE TABLE i_cons lines counter.
if not i_cons is initial .
loop at i_cons into wa_cons.
clear wa_incl-line.
wa_incl-line = 'parameters: '.
concatenate wa_incl-line 'p_cb' par_cnt into wa_incl-line.
concatenate wa_incl-line 'as checkbox.' into wa_incl-line separated by space.
append wa_incl to i_incl.
par_cnt = par_cnt + 1.
endloop.
* Delete inlude if it already exists.
call function 'RS_DELETE_PROGRAM'
exporting
program = 'Z_DYN_INCL'
suppress_checks = 'X'
suppress_popup = 'X'
with_cua = ' '
with_documentation = ' '
with_dynpro = 'X'
with_includes = ' '
with_textpool = ' '
with_variants = ' '
.
insert REPORT 'Z_DYN_INCL' from i_incl.
commit work.
submit ZTEST2 via SELECTION-SCREEN.
endif.
__________________________________________________
REPORT ZTEST2.
include z_dyn_incl if FOUND.
2014 Jan 31 12:26 PM
Please check with your ABAP team as data is belong to customized table .
Thanks
Labeeb
2014 Feb 03 5:19 AM
Hi Labeeb,
The table is ZDM0919 , it will be maintained by SMDL team, so we can say it is a customized table.
From this table we need to display the checkboxes for field SOURCE entries.
2014 Jan 31 12:28 PM
Hi kachana,
You should try to do this at the "AT SELECTION-SCREEN OUTPUT" Event. In this event, you have the SCREEN internal table where you have all the Screen Fields and you can modify the output options of all the fields and parameters).
LOOP AT SCREEN.
MODIFY SCREEN.
ENDLOOP.
Best regards.
2014 Jan 31 1:03 PM
Got you ,
there will be as many check boxes on selection screen as there are entries in table.
>>>>>>1st way.
so , i prefer , (rather say recommend ), keep a button selection screen with text like <click here for more selection criteria> with some user command linked to it.
when ever that button is pressed,
use popup alv display with one field as check box and another field as description , on return read the table where there are checks and build a range or what ever .... you got what customer has selected..,
and use them in your report ....
>>>>>>2nd way. if you know module pooling
design a screen 100 or what ever number ,
put a table control , fill the table control with the values you want in pbo.
use this screen in standard selection screen as used in below example....
Subscreens on Selection Screens (SAP Library - ABAP Programming (BC-ABA))
or look at sample program
DEMO_SEL_SCREEN_AS_SUBSCREEN
2014 Feb 03 12:30 PM
Hi Kachna,
You have the solutions in the above post.
1) If you know the maximum number of entries that can be in the table
It's fairly simple. Define X(max . no of check box ) in selection screen. Hide the checkboxes which are not required.
Drawback. : you will need to put custom logic to map the checkbox with the corresponding table entries
2) Create a screen Say 9001 With two subscreen area say sub_sel( for selection screen) and sub_chk ( for chex boxex).
create selection screen and embed it to the first subscreen
Create alv with the contents of the above table and a checkbox and embed to to second subscreen.
2014 Feb 03 5:36 AM
2014 Feb 03 6:07 AM
Hi Kachana,
You can make a wrapper report to get the number of checkboxes and declare the checkboxes and then call the main program in it.
REPORT ZTEST1.
tables zfuel_cons.
types :begin of t_code,
line(72),
end of t_code .
data: i_incl type table of t_code,
wa_incl type t_code.
data : i_cons type table of zfuel_cons, wa_cons type zfuel_cons.
data par_cnt(2) type n.
data counter(2) type n.
* include z_dyn_incl if FOUND.
parameters p_x type n NO-DISPLAY.
INITIALIZATION.
select * from zfuel_cons into table i_cons where not eadd = ' '.
par_cnt = 1.
DESCRIBE TABLE i_cons lines counter.
if not i_cons is initial .
loop at i_cons into wa_cons.
clear wa_incl-line.
wa_incl-line = 'parameters: '.
concatenate wa_incl-line 'p_cb' par_cnt into wa_incl-line.
concatenate wa_incl-line 'as checkbox.' into wa_incl-line separated by space.
append wa_incl to i_incl.
par_cnt = par_cnt + 1.
endloop.
* Delete inlude if it already exists.
call function 'RS_DELETE_PROGRAM'
exporting
program = 'Z_DYN_INCL'
suppress_checks = 'X'
suppress_popup = 'X'
with_cua = ' '
with_documentation = ' '
with_dynpro = 'X'
with_includes = ' '
with_textpool = ' '
with_variants = ' '
.
insert REPORT 'Z_DYN_INCL' from i_incl.
commit work.
submit ZTEST2 via SELECTION-SCREEN.
endif.
__________________________________________________
REPORT ZTEST2.
include z_dyn_incl if FOUND.
2014 Feb 03 4:01 PM
only handful of people know , loading reports from internal table.
this way you can do much more things ,
modify even sap program too with out any enhacements.
2014 Feb 03 10:38 AM
Hi,
I would say that you first select the record from ZDM0919 (in initialization). After that, in "at selection-screen output", perform a "loop at screen" to hide the fields that are not relevant according to your selection.
The selection should be build with all the check boxes for a start.
Take care,