‎2008 Feb 06 7:47 AM
Hi all,
I have used an itab at table control and not specified that I want add row/delete row buttons. That is, there are no buttons to delete a row or to add a row.
However I need to delete a row at which the cursor is on.
How can I understand the cursor is on a row?
Thanks.
‎2008 Feb 06 7:59 AM
in your table control structure there is a field called currentline
that indicates line on which u've got ur cursor.
u can add a row by incrementing this field ans viz in deletion
plz reward if helpful
vivek
‎2008 Feb 06 7:59 AM
in your table control structure there is a field called currentline
that indicates line on which u've got ur cursor.
u can add a row by incrementing this field ans viz in deletion
plz reward if helpful
vivek
‎2008 Feb 06 8:01 AM
You can try using the keyword GET CURSOR FIELD. It will get the current field where the cursor is placed and its content.
‎2008 Feb 06 8:20 AM
Hi,
See the below syntaxes.
-
-
syntax:----
-
CONTROLS .
if you only want to determine the row of the table control. SY´-SUBRC allows you to check if the cursor is placed in a row of a table control.
u need to comment the performs of table control fields and write ur own perform statements. And u have to declare the table control fields as separate internal tables.
Go through this urls.
-
-
This method seem to work even when we scroll.
Here " test " is the tableview control.
**********CODE*****************
DATA: CURSORFIELD(20),
GLOB_FIELD(20) VALUE 'global field',
REF_PARAMETER(30) VALUE 'parameter by reference',
VAL_PARAMETER(30) VALUE 'parameter by value',
FIELD_SYMBOL(20) VALUE 'field symbol'.
FIELD-SYMBOLS: .
WRITE: / GLOB_FIELD, / LOC_FIELD,
/ RP, / VP,
/ 'literal', / FIELD_SYMBOL.
ENDFORM.
************END********************
I hope it will give u an idea.
Regards.
‎2008 Feb 06 8:36 AM
you can access the current line of table control with current_line.
if the name of ur table control is tabcon then do like this.
delete itab index tabcon-current_line.
‎2008 Feb 06 12:19 PM
hi,
u can use this
GET CURSOR LINE lin_no.
but where u will write this?
if possible make one button on screen.....
and write like this in module user_command of PAI
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
and write this in the module in which u fetching data from database table into internal table
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 OUTPUT
reward if usefull...