i have checkbox column at tablecontrol.
when i click that checkbox in tablecontrol, how can i remove those records from the table.
for eg.
i have 5 records displaying in tablecontrol.
if i click checkbox for 2nd and 3rd record. and click execute button it should list of only 1,4,5 records in my internaltable.
In execute button event how to write a code.
could you pls suggest.
ambichan
Hi,
1) PAI
loop.
..
FIELD Itab-MARK MODULE DEL_itab ON INPUT.
endloop.
2)
MODULE DEL_itab INPUT.
check itab-mark = 'X'.
append itab to del_tab.
ENDMODULE.
3)
MODULE USER_COMMAND INPUT.
...
CASE OK_CODE.
when 'DELE'.
loop at del_tab into wa.
DELETE TABLE itab from wa.
...
regards Andreas
Message was edited by: Andreas Mann
Hi,
Take a look at demo program DEMO_DYNPRO_TABLE_CONTROL_1 to see how a table control works.
To be able to address the correct internal table line against the selected table control lines, you will need the formula:
IF itab-mark = 'X'. tab_idx = tab_ctrl-top_line + tab_ctrl-current_line - 1. DELETE itab INDEX tab_idx. ENDIF.
This code will be called in a module that is called from your PAI section in flow logic, while you are looping at your table control. It will be something like
LOOP WITH CONTROL tab_ctrl. MODULE update_table. ENDLOOP.
If you were to process the code outside the above-mentioned loop, you would then need to issue a statement of GET CURSOR LINE <line> and then use this value instead of <b>tab_ctrl-current_line</b> in the formula to get correct itab index.
Do not forget to issue the statement <b>DESCRIBE TABLE itab LINES tab_ctrl-lines</b> in your PBO to re-adjust table control with new itab entries.
Hope this helps.
Regards
Pretty simple....in your PAI,
Loop at itab where mark = 'X'. delete itab. endloop.
make sure you put this in your PBO.
Refresh control 'itabcon' from screen '100'.
regards,
Rich Heilman
Add a comment