Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table control's current_row

Former Member
0 Likes
741

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
712

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

5 REPLIES 5
Read only

Former Member
0 Likes
713

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

Read only

former_member283648
Participant
0 Likes
712

You can try using the keyword GET CURSOR FIELD. It will get the current field where the cursor is placed and its content.

Read only

Former Member
0 Likes
712

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.

www.saptechnical.com

www.sap-img.com

-

-


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.

Read only

Former Member
0 Likes
712

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.

Read only

Former Member
0 Likes
712

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...