‎2006 Aug 21 8:46 AM
Hi all,
i have a selection screen on which there are 6
checkboxes. depending on the combination of check
boxes selected the no of colums in the ALV grid output
should change.
for eg. if check box 3 , check box 5 , and check box 6
are selected then a fieldcatalog should be created which
will have fields corresponding to check box 3, then 5
and then 6 .
if only 5 ,6 are selected columns corresponding to only
them should be shown.
i cant write the code to populate fieldcat for each
of the combination of the 6 chkbox.
is there any other way to do it??
Regards,
Tarang
‎2006 Aug 21 8:51 AM
HI,
You can use <b>'NO_OUT'</b> option to hide columns depending on selection. In this way you have to build only one field catalog.
Regards,
HRA
‎2006 Aug 21 8:58 AM
hi HRA,
but this way also i will have to write
several if statements like.
1. if chk1 = 'X'
2. if chk1 = 'X' and Chk3 = 'X'
3. if chk3 = 'X' and chk 7 = 'X'.
and so on...
so there will be (2 raise to 6 )i.e 64 combinations
any other way
‎2006 Aug 21 8:52 AM
Hello,
U can try like this. When u r populating the field catalog, U check for the checkbox values.
IF P_CHK1 = 'X' and P_CHK2 = 'X' and P_CHK3 = 'X'.
Populate the fieldcatalog values for the particular field.
ENDIF.
If useful reward.
Vasanth
‎2006 Aug 21 8:56 AM
Hi,
Based on your Check box selection , use the Fieldcat option <b>TECH = 'X'</b>.
if check = 'X'.
fieldcat-tech = 'X'.
endif.
TECH = 'X' will not show the column in the output.
Regards
vijay
‎2006 Aug 21 10:20 AM
Hello,
Ya that's true that you can't write statment for all but you can proceed in this way.
Make one internal table,
data: begin of it_col occurs 0,
check(10),
field(10),
end of it_col.
Fill this table as,
it_col-check = 'CHK1'.
it_col-field = 'FLD11'.
append it_col.
it_col-check = 'CHK1'.
it_col-field = 'FLD12'.
append it_col.
it_col-check = 'CHK2'.
it_col-field = 'FLD13'.
append it_col.
it_col-check = 'CHK2'.
it_col-field = 'FLD11'.
append it_col.
Now,
depending upon your selection of checkboxes,
if chk1 = 'X'.
loop at it_col where check = 'CHK1'.
populate your field catalog.
endloop.
endif.
if chk2 = 'X'.
loop at it_col where check = 'CHK2'.
populate your field catalog.
endloop.
endif.
At last you will be having your fields in catalog.
regards,
Naimesg