10-11-2007 6:23 AM
Hai all,
I am using a 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' and in the output i have a check box as one of the coloums of the item details .
I want the check box to be displayed only for a few records,based upon some condition of the records in the internal table .
eg: Display checkbox only IF ITAB-SOME FIELD NE SPACE .
How can this be achieved.
if i give the syntax mentioned below,i am able to get checkboxes displayed for all the records which doesnt help me.
wa_stb_fields_tb-CHECKBOX = 'X'.
wa_stb_fields_tb-INPUT = 'X' .
wa_stb_fields_tb-col_pos = 20.
wa_stb_fields_tb-seltext_m = 'Sum'.
Regards,
Dev
10-11-2007 6:30 AM
Hi,
You can display the check box for all the records..But disable them when the condition is not satisfied..
Ex..
LOOP AT ITAB.
IF ITAB-SOME FIELD NE SPACE.
in the check box field pass 0 to disable.
ITAB-CHECKBOX = 0. " Disable.
MODIFY ITAB.
ENDIF.
ENDLOOP.
Thanks
Naren
10-11-2007 6:45 AM
Hai,
It is not working.ITAB doesnt have a anything called checkbox.ITAB has only a coloum eg: SUM(1) TYPE C .so how can i Modify it by giving itab-checkbox = 0.
Only the fieldcatolog has ( wa_stb_fields_tb-CHECKBOX = 0 ) check box .
Please tell me how do i remove or diable the check box for a specific row of an internal table (itab) .
My code.
wa_stb_fields_tb-CHECKBOX = 'X'.
wa_stb_fields_tb-INPUT = 'X'.
wa_stb_fields_tb-col_pos = 20.
wa_stb_fields_tb-seltext_m = 'Selection Sum'.
MODIFY stb_fields_tb FROM wa_stb_fields_tb
TRANSPORTING CHECKBOX
INPUT
seltext_m
WHERE fieldname = 'SUM'.
10-11-2007 6:43 AM
hi dev,
just loop at ur internal table n display records only when the check box is enabled as
LOOP AT ITAB.
IT ITAB-SOME = 'X'.
wa_stb_fields_tb-CHECKBOX = 'X'.
wa_stb_fields_tb-INPUT = 'X' .
wa_stb_fields_tb-col_pos = 20.
wa_stb_fields_tb-seltext_m = 'Sum'.
ELSE.
EXIT.
ENDLOOP.
10-11-2007 6:51 AM
Hi,
STEPS
1) Add a field CHECKBOX to your internal table..
2) In the layout structure pass BOX_FIELDNAME = 'CHECKBOX'..and then pass the layout structure to the ALV function module..
3) Modify the internal table row with CHECKBOX = 0.
Check this sample code..
TYPE-POOLS: slis.
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.
DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
DATA: s_layout TYPE slis_layout_alv.
DATA: BEGIN OF itab OCCURS 0,
vbeln TYPE vbeln,
checkbox TYPE c,
END OF itab.
DATA: v_repid TYPE syrepid.
START-OF-SELECTION.
* Get the data.
SELECT vbeln UP TO 100 ROWS
FROM vbak
INTO CORRESPONDING FIELDS OF TABLE itab.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'No data found'.
LEAVE LIST-PROCESSING.
ENDIF.
v_repid = sy-repid.
* Modify the check box.
LOOP AT itab.
ITAB-checkbox = 0.
MODIFY ITAB.
ENDLOOP.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '2'.
s_fieldcatalog-fieldname = 'VBELN'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-rollname = 'VBELN'.
APPEND s_fieldcatalog TO t_fieldcatalog.
* Set the layout.
s_layout-box_fieldname = 'CHECKBOX'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = s_layout
it_fieldcat = t_fieldcatalog[]
TABLES
t_outtab = itab.
ENDFORM.
Thanks
Naren