‎2007 Feb 22 6:38 AM
Hi,
Here My requirement was to display the output records with check boxes.
and if we check the checkboxes and Delete option will be available at application tool bar, if we select delete it has to delete all the values.
My Question: How to display the Check box for Every record in the Output.
and How we will delete the records from output, means if i display 10 records, i checked 3 records, i have to delete only 3 records, howw can i achieve it?
Please provide with sample code.
Thanks in Advance
Regards,
Sreedhar
‎2007 Feb 22 6:41 AM
1. add one more field to ur final itab. of length 1 say chk(1)
2. loop at itab.
write : chk as checkbox.
endloop.
3. loop at itab where chk eq 'X'.
delete itab.
endloop.
‎2007 Feb 22 6:45 AM
Hi Chndra,
Thanks for you reply,
After displaying the ouput only we are checking the check box,
if we check the checkbox at list level, can our internal table holds the value again?
Can u understand mydoubt?
‎2007 Feb 22 6:47 AM
modif ur internal table at the end so that the value of chk will be stored as X when the check box is checked in the internal table
‎2007 Feb 22 6:42 AM
Hi,
SELECTION-SCREEN BEGIN OF BLOCK out WITH FRAME TITLE text-s01.
SELECTION-SCREEN BEGIN OF LINE.
<b>PARAMETERS: p_filchk AS CHECKBOX.</b>
SELECTION-SCREEN COMMENT 4(17) text-s02 FOR FIELD p_filchk.
SELECTION-SCREEN POSITION POS_LOW.
PARAMETERS: p_file LIKE rlgrap-filename.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK out.
Hope this helps.
Reward if helpful.
Regards,
Sipra
‎2007 Feb 22 6:45 AM
Hi,
try like this,
move this value to your internal table
ICON_2 ICON_CHECKBOX '@R7@'." Freigeben
and write an interactive report to delete the check clicked values for deletion
Thanks
Shiva
‎2007 Feb 22 6:47 AM
‎2007 Feb 22 6:48 AM
hi,
Herewith i am sending the sample code for check box wil alv.
REPORT YMS_CHECKBOXALV.
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,
icon TYPE icon-id,
vbeln TYPE vbeln,
kunnr TYPE kunnr,
erdat TYPE erdat,
box TYPE c,
END OF itab.
DATA: v_repid TYPE syrepid.
START-OF-SELECTION.
Get the data.
SELECT vbeln kunnr erdat 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.
Modify the record with red light.
itab-icon = '@0A@'.
MODIFY itab TRANSPORTING icon WHERE NOT vbeln IS initial.
v_repid = sy-repid.
Get the field catalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '1'.
s_fieldcatalog-fieldname = 'ICON'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-seltext_l = 'Status'.
s_fieldcatalog-icon = 'X'.
APPEND s_fieldcatalog TO t_fieldcatalog.
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.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '3'.
s_fieldcatalog-fieldname = 'KUNNR'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-rollname = 'KUNNR'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog.
s_fieldcatalog-col_pos = '4'.
s_fieldcatalog-fieldname = 'ERDAT'.
s_fieldcatalog-tabname = 'ITAB'.
s_fieldcatalog-rollname = 'ERDAT'.
APPEND s_fieldcatalog TO t_fieldcatalog.
Set the layout.
s_layout-box_fieldname = 'BOX'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = s_layout
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = t_fieldcatalog[]
TABLES
t_outtab = itab.
----
FORM SET_PF_STATUS *
----
........ *
----
--> EXTAB *
----
FORM set_pf_status USING extab TYPE slis_t_extab.
SET PF-STATUS 'TEST2'.
ENDFORM.
----
FORM user_command *
----
........ *
----
--> UCOMM *
--> SELFIELD *
----
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
Check the ucomm.
IF ucomm = 'DETAIL'.
LOOP AT itab WHERE box = 'X'.
itab-icon = '@08@'.
MODIFY itab TRANSPORTING icon.
ENDLOOP.
ENDIF.
selfield-refresh = 'X'.
ENDFORM.
Thanks,
Shankar
‎2007 Feb 22 6:53 AM
Hi
I will expplain you to write the code,
1) Write: Field1 as Check box --> it will display the checkbox
so in your internal table take a 1 charecter variable as first field and while displayingn the output you need to write like this
LOOP AT ITAB.
Write:/ ITAB-FIeld1 aas checkbox,
ITAB-FIeld2,
ITAB-FIeld3,
-----------
-----------
ENDLOOP.2) to delete the checked records, you need to write the Interactive report, create a pushbutton in the application tool bar, and assign a ok_code(Lets say DELE) for that one and in the AT LINE SELECTION event, or AT USER COMMAND event you need to handle this one
AT LINE SELECTION.
If SY-UCOMM = 'DELE'.
Delete ITAB where FIELD1 = 'X'. " We are deleting only the checked records, this
" Field one is Check box in the output.
ENDIF.
then Display the remaining records as usuval...
Hope you understand this .. enjoye the coding
Regards
Sudheer