‎2008 Jul 28 8:18 AM
Hi,
I am deleting record in tabcontrol using this statement.
delete itab index ztabcontrol-current_line.
initially 3 records in tabcontrol.
if i select 2 nd and 3 rd row and press delete button,second row is getting deleted,and third row is moved to 2 nd row.
next time for third row values ztabcontrol-current_line is 3 and there is only two records in tabcontrol.
if anybody came across this Situation and got solution ,please help me out.
Regards,
Sathya.
‎2008 Jul 28 8:21 AM
Hi,
I came across the same situation
After deleting the record in tablecontrol you also decrease the index value by 1.
By this it will achieve your requirement.
‎2008 Jul 28 8:21 AM
Satya,
just look at the sample code below:
MODULE user_command_9000 INPUT.
CASE ok_code.
WHEN 'BACK' OR 'UP' OR 'CANCEL'.
LEAVE PROGRAM.
WHEN 'DIS'.
WRITE 'DEV'.
CALL SCREEN 9001 STARTING AT 10 10 ENDING AT 20 20.
WHEN 'DEL'.
GET CURSOR LINE lin_no.
f1 = 1.
WHEN ''.
f = 1.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
here my delete button name in DEL...
now u would have some module in PBO in which u fetching data from data base....
write this in that module...
MODULE get_data OUTPUT.
IF f1 1.
SELECT kunnr name1
INTO CORRESPONDING FIELDS OF TABLE mytab
FROM kna1.
ENDIF.
IF f1 = 1.
IF lin_no IS NOT INITIAL.
DELETE mytab INDEX lin_no.
FREE lin_no.
FREE f1.
ENDIF.
ENDIF.
ENDMODULE. " get_data OUTPUTAmit.
‎2008 Jul 28 8:24 AM
hi,
If you hace created a marker field ( let say with name 'MARK') in your table control , then you can use this statement,
delete itab where itab-mark = 'X'.
‎2008 Jul 28 8:24 AM
Hi,
Use
DELETE <itab> FROM 2 to 3.2 and 3 are the upper index and lower index...
like wise you can delete 1 to 100 rows at one go from your internal table.
Hope this would solve your issue.
Regards
Narin
‎2008 Jul 28 8:29 AM
Hi,
If you are tracing the selected row in the table control .the delete can be achieve by using the following code.
WHEN 'FDEL'.
LOOP AT it_mara .
DELETE it_mara WHERE sel = 'X'.
ENDLOOP.
ENDCASE.
Rewards points if usefull.
Thanks and Regards
Jatender