‎2009 Jan 07 1:24 PM
Hi all,
i have a screen with a text field in the first line, then followed by a table control..I can add new values into the table control when i click the '+' button at the bottom( it is created using wizard). my requirement is that, whenever i add a new line,the cursor shud be automatically positioned in the first field of that row. I tried with set cursor field line.... but it is not working , probably because the difference in tablecontrol-current_line and actual index when scrolling happens..So the cursor is set to the text field at the top... How can i make this happen??
Suzie
‎2009 Jan 07 1:51 PM
Should work. If you've got one existing line on screen, you click on the + button to create a new line (which will be line 2), and you then use SET CURSOR FIELD...LINE... to set FIELD to the field name and LINE to 2, the cursor should go there. In fact, I've just tried it on one of my screens and that's what it did. I'm not sure what you mean when you mention scrolling since this should only happen if you've filled up your table control and so clicking on + means that it has to display a new scren.
‎2009 Jan 07 1:51 PM
Should work. If you've got one existing line on screen, you click on the + button to create a new line (which will be line 2), and you then use SET CURSOR FIELD...LINE... to set FIELD to the field name and LINE to 2, the cursor should go there. In fact, I've just tried it on one of my screens and that's what it did. I'm not sure what you mean when you mention scrolling since this should only happen if you've filled up your table control and so clicking on + means that it has to display a new scren.
‎2009 Jan 08 2:49 AM
Sorry for confusing.. ACtually i got the cursor position correctly as long as no scrollong takes place in the table, but wen the entries in the current screen are full, it will have to scroll down and then this will not work.. Please help me correct it..
Suzie
‎2009 Jan 08 3:23 AM
hi,
try this
READ TABLE ITAB INDEX TAB_SCHEDULE-CURRENT_LINE. " ITAB is internal table in table control
DESCRIBE TABLE ITAB LINES LIN1.
IF SY-UCOMM = 'ADD' AND LIN1 = 20 "no of lines.
APPEND INITIAL LINE TO ITAB.
ENDIF.
thanks
‎2009 Jan 08 4:13 AM
Hello Suzie,
At your SY-UCOMM value of that button ,after whose click you want you cursor to be placed on the next rows 1st field you can use:
For Eg:
To Place the cursor at the beginning of a field when selecting a line in list processing.
MOVE 'MODUS' TO F.
MOVE '1234567890' TO MODUS.
DO 10 TIMES.
NEW-LINE. POSITION SY-INDEX WRITE MODUS.
ENDDO.
AT LINE-SELECTION.
SET CURSOR FIELD F LINE SY-LILLI.
or
SET CURSOR FIELD 'MODUS' LINE SY-LILLI.
Both statements place the cursor at the beginning of the field MODUS on this line when the user double-clicks.
Like this you can do for your user command actions.
Hope it helps you.
Tnaks Mansi