‎2008 Nov 05 4:27 AM
Hi all,
I have tab control. Under that tab control i have a table control. Now the recors are displaying on the table control . Now i want to delete, modify and insert the recors on the table contol. Please help me out to achieve this functioanlity.
Ranjan
‎2008 Nov 05 5:07 AM
Hi Priyaranjan ,
1) Add the buttons for adding , deleting the rows of the table .
2) Create the table control with the check box .
3) To delete a record , under the user command code for that button , loop at the respective internal table and delete the record where it is marked 'X' .
4) append an empty line in the loop .
5 ) To modify the entries , first enable the input option for the table control and then loop the table when at user defined command ,
and modify the table .
Guess this should solve your problem.
‎2008 Nov 05 5:11 AM
Hi ,
IF ok_code = 'CB_SAV'. "for save
MODIFY zmara FROM TABLE it_zmara.
ENDIF.
IF ok_code = 'CB_DEL'. "for delete
* setting the flag to make the table control in editable mode after
* deleting te selected line
flag = 'Y'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = 'CONFIRM '
text_question = 'ARE, YOU SURE TO DELETE FROM DB?'
text_button_1 = 'YES'(001)
text_button_2 = 'NO'(002)
display_cancel_button = 'X'
IMPORTING
answer = ok_code_ans.
IF ok_code_ans EQ 1.
*UPDATE THE DB TABLE FROM INTERNAL TABLE.
UPDATE zmara FROM TABLE it_zmara.
* Deleting the selected row from the internal table
DELETE it_zmara WHERE pick = 'X'.
* Deleting the selected row from the database table
DELETE FROM zmara WHERE matnr = it_zmara-matnr.
* MESSAGE s003 WITH 'Deleted Successfully'.
ENDIF.
ENDIF.
Tks, Krishna
‎2008 Nov 05 5:12 AM
Hii,
For inserting ,
u need to write in the user command
case ok_code.
when 'INSERT'. "give the function code of the insert
"button as INSERT
describe table itab line wrk_lines.
wrk_lines = wrk_lines + 1.
sy-tfill = wrk_lines.
when 'DELETE' . "func code for del button is DELETE
delete itab where sel = 'X'.
"u need to give the sel name as itab-sel in the
"layout then only the selected can be easily
"identified.
I hope this serves.
Neeraj
endcase.