‎2006 Mar 17 9:41 AM
Hi,
I have check-boxes displayed in the output of my normal classical report and the check-boxes for which the values are changed are to be displayed with a "X" mark on the next output screen. But for the values that are not changed, the check-boxes should be GREYED out i.e. the user should not be able to tick mark the check-boxes. In other words, the check boxes should be disabled.
Which property of the check-box should to manipulated to achieve this requirement.
‎2006 Mar 17 10:31 AM
Hi rajesh,
Welcome To SDN.
1. just copy paste in new program
(different kind of checkboxes
-
enabled
-
disabled
-
greyed out
)
report abc.
DATA: MARKFIELD(1) TYPE C VALUE 'X'.
...
WRITE MARKFIELD AS CHECKBOX. "checkbox selected
MARKFIELD = SPACE.
WRITE MARKFIELD AS CHECKBOX. "deselected
markfield = 'X'.
WRITE MARKFIELD AS CHECKBOX INPUT OFF. "deselected, protected
regards,
amit m.
‎2006 Mar 17 10:01 AM
Hi,
Check this sample code.This I got from this forum.Kindly reward points by clicking the star on the left of reply,if it helps.
TYPE-POOLS:SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA:IT_EVENTS TYPE SLIS_T_EVENT.
data: begin of it_chg occurs 0,
index type sy-tabix,
end of it_chg.
DATA: X_EVENTS TYPE SLIS_ALV_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
NAME(10) TYPE C,
ZTERM TYPE C,
END OF ITAB.
PERFORM FILL_TABLE.
loop at itab where zterm = 'A'.
it_chg-index = sy-tabix + 3.
" addition 3 IS FOR FIELD LABELS
append it_chg.
clear it_chg.
endloop.
DATA:L_POS TYPE I VALUE 1.
CLEAR: L_POS.
L_POS = L_POS + 1.
**fieldcatalog
X_FIELDCAT-FIELDNAME = 'NAME'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '10'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-FIELDNAME = 'ZTERM'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '10'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
**events
REFRESH:IT_EVENTS.
CLEAR:X_EVENTS,IT_EVENTS.
X_EVENTS-NAME = SLIS_EV_END_OF_LIST.
X_EVENTS-FORM = 'MODIFY_LIST'.
APPEND X_EVENTS TO IT_EVENTS.
CLEAR X_EVENTS.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FIELDCAT
IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
&----
*& Form FILL_TABLE
&----
text
----
FORM FILL_TABLE.
ITAB-NAME = 'ABC'.
ITAB-ZTERM = 'B'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'TEST'.
ITAB-ZTERM = 'C'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'DILIP'.
ITAB-ZTERM = 'D'.
APPEND ITAB.
clear itab.
ITAB-NAME = '123'.
ITAB-ZTERM = 'E'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'GEN'.
ITAB-ZTERM = 'A'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'ALV'.
ITAB-ZTERM = 'F'.
APPEND ITAB.
clear itab.
ITAB-NAME = 'ALVTEST'.
ITAB-ZTERM = 'A'.
APPEND ITAB.
clear itab.
ENDFORM. "FILL_TABLE
&----
*& Form MODIFY_LIST
&----
text
----
FORM MODIFY_LIST.
data: l_lines type i.
describe table itab lines l_lines.
L_LINES = L_LINES + 3.
"because we have 3 lines extra occupied by lables.
"if we have header,i mean top of page add the no.of lines
"how many ever top of page have + 3 for labels.
DO L_LINES TIMES.
read table it_chg with key INDEX = sy-index.
if sy-subrc = 0.
**This code is for reading the out put line
**and modify accordinlg to our requiremnet.
**don't chnage this.
READ LINE SY-INDEX INDEX SY-LSIND.
IF SY-SUBRC = 0.
MODIFY LINE SY-INDEX INDEX SY-LSIND
FIELD FORMAT ITAB-NAME INPUT.
ENDIF.
ENDIF.
ENDDO.
ENDFORM. "MODIFY_LIST
‎2006 Mar 17 10:31 AM
Hi rajesh,
Welcome To SDN.
1. just copy paste in new program
(different kind of checkboxes
-
enabled
-
disabled
-
greyed out
)
report abc.
DATA: MARKFIELD(1) TYPE C VALUE 'X'.
...
WRITE MARKFIELD AS CHECKBOX. "checkbox selected
MARKFIELD = SPACE.
WRITE MARKFIELD AS CHECKBOX. "deselected
markfield = 'X'.
WRITE MARKFIELD AS CHECKBOX INPUT OFF. "deselected, protected
regards,
amit m.
‎2006 Mar 17 10:47 AM
Hi Rajesh,
I suppose your question was "How to display a checkbox in greyed out manner so that you cannot change it ". Then this is how you do it.
parameters: check as checkbox modif id sc1 default 'X',
check1 as checkbox modif id sc2 ,
check2 as checkbox modif id sc2 default 'X'.
at selection-screen output.
loop at SCREEN.
if SCREEN-GROUP1 = 'SC1'.
SCREEN-INPUT = 0. " for greying out a checkbox
MODIFY SCREEN.
ENDIF.
ENDLOOP.
In the above program,
the first checkbox will be selected and greyed out
second one will not be selected and active
third one will be selected and active ..
This is how you can make a checkbox active or greyed out..
Hope this will help you.
Regards,
Sylendra
‎2006 Mar 17 11:32 AM
hi rajesh ,
just execute the code and let me know if any .
hope this helps.
regards,
vikky.
_________________________________________________________
REPORT ZP5 no standard page heading.
tables mara.
*data: mark1 type c.
data: begin of itab occurs 0,
mark1(1),
matnr like mara-matnr,
werks like marc-werks,
end of itab.
select-options :so_matnr for mara-matnr.
start-of-selection.
select matnr
werks
from marc
into corresponding fields of table itab
up to 10 rows
where matnr in so_matnr
order by matnr .
loop at itab.
write:/ itab-mark1 as checkbox,
itab-matnr,
itab-werks.
endloop.
at line-selection.
clear itab.
do .
read line sy-index field value itab-mark1
itab-matnr.
if sy-subrc <> 0.exit.
endif.
if itab-mark1 eq 'X'.
write:/ itab-mark1 as checkbox input on ,20 itab-matnr,32
itab-werks.
endif.
check itab-mark1 eq space.
write:/ itab-mark1 as checkbox input off ,
20 itab-matnr, 32 itab-werks.
ENDDO.