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

Set the cursor on table control

Former Member
0 Likes
1,511

Hi All,

I am trying to create a table control.

Creation of table control is fine and i can update and save the records..But i am facing some strange problems.

When i close my program and rerun it, the Cursor will be position on the default field of last run.

How can we position the cursor on table control..Say to a particular row or columns?

Also i am not able to interpret the meaning of

Loop at itab with control control name cursor top_line/current_line.

Does this means that if you use top_line, cursor will be placed at the top line and when you use current_line , it will be placed at current line?

Regards

Miesh

5 REPLIES 5
Read only

Former Member
0 Likes
836

Hi,

Check this link for sample code for Table Control

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=...CodeSamples/TableControlin+ABAP.pdf

http://members.aol.com/_ht_a/skarkada/sap/table_control/table_control.htm

Thanks & Regards,

Judith.

Message was edited by: Judith Jessie Selvi

Read only

Former Member
0 Likes
836

hi Mitesh,

Well you yourself gave answer to your question.

Now if you want to put cursor on particular row you can do that by assinging value postion to the table control line. also refresh any sy-index or sy-tabix field value on internal table.

Or else using the statement given by u will also suffice.

LOOP AT ITAB WITH TC CURSOR TC-CURRENT_LINE.

ENDLOOP.

If anything else do post back.

Raj

Read only

Former Member
0 Likes
836

Hi,

If i try to set the cursor in loop..endloop,

say for eg, i use top_line, cursor will be at the first line.

if i use current_line , cursor will be at which line then?

Every time my PAI event is fired, it wont be set to the specific field i want..

If you try placing the cursor on second field/column. You come out of program, and then when you run the program again, the cursor is on the same field.

Can you also help to explain this, its new to me..

"refresh any sy-index or sy-tabix field value on internal table."

Regards

Mitesh

Read only

0 Likes
836

Hi,

In PAI if you are suing current line inside the loop as below,it will take every line once it is processing.

DATA : i_makt TYPE STANDARD TABLE OF zzz_makt WITH HEADER LINE.

PROCESS AFTER INPUT.

LOOP AT i_makt.

FIELD i_makt-zmatnr MODULE zmatnr .

ENDLOOP.

MODULE zmatnr INPUT.

MODIFY i_makt INDEX t_ctrl-current_line.

IF t_ctrl-current_line GT ln.

READ TABLE i_makt WITH KEY zmatnr = i_makt-zmatnr.

IF sy-subrc NE 0.

  • Inserting record if it does not exist in database

APPEND i_makt.

ELSE.

MESSAGE i005 WITH 'Material Number' i_makt-zmatnr 'already exists'.

ENDIF.

ENDIF.

ENDMODULE. " zmatnr INPUT

Read only

Former Member
0 Likes
836

Try maintaining the "Cursor position" in the screen layout in Attributes tab with the field name that you want the default cursor position to be present.

Regards,

Shri Hari.