‎2008 Jul 28 11:20 AM
In a table control how i can put the cursor on the colomn that i want when i click enter?
For exaple if i put with the mouse the cursor on the 5 column when i click enter i want the cursor on the fist column
thanks
‎2008 Jul 28 11:24 AM
‎2008 Jul 28 11:24 AM
‎2008 Jul 28 11:24 AM
Hi,
you can find this in SAP HELP:
Cursor Position on Table Controls
At PBO you can set the cursor on a specific field of a specific row of a table control.
SET CURSOR FIELD f LINE lin [OFFSET off].
Using the optional addition OFFSET, you can enter the offset of the cursor in the field as described under Setting the Cursor Position .
At PAI you can read the current cursor position.
GET CURSOR FIELD f LINE lin ...
In addition to the information given under Finding Out the Cursor Position , field lin contains information on which row of the table control the cursor is currently on. You can also use
GET CURSOR LINE lin.
. sy-subrc allows you to check if the cursor is placed in a row of a table control.
Best regards
‎2008 Jul 28 11:26 AM
hiiii
i think you should write SET CURSOR for that column ...
when you press ENTER button in that use this statement.
regards
twinkal
‎2008 Jul 28 11:47 AM
Sorry, but i am in a table control and so i haven' t field for use SET CURSOR FIELD , how i can resolve the problem?
Edited by: Pippo Pluto on Jul 28, 2008 12:55 PM
‎2008 Jul 28 12:04 PM
Hi,
Check this Link for Cursor in Table Contro and How to use-
http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac9f35c111d1829f0000e829fbfe/content.htm
Regards,
Sujit
‎2008 Jul 28 12:10 PM
Hi,
Get cursor .. statement would not satisfy your requirement - while hovering the mouse.
You might find some method in relevant class (OO concept).
Regards,
Wajid Hussain P.
‎2008 Jul 28 12:02 PM
hi,
try the below logic
PAI ,
user Command write GET CURSOR FIELD F and
PBO
write SET CURSOR FIELD F
‎2008 Jul 28 12:06 PM
Yes i know but i have't a filed for get cursor field because i have a table control ad if i write set cursor fiels <nametablecontrol>-<Field> i have an error message
‎2008 Jul 28 12:17 PM
Hi,
Yes you have a table Control but in the table control you have to Set the Cursor to a particular field.
Use the Statement-
SET CURSOR FIELD <f> LINE <line>.
In 'f' mention table control field.
Regards,
Sujit
‎2008 Jul 28 12:23 PM
yes but if I write :
set cursor field <nametablecontro>-<Fieldoftablecontrol>.
or set cursor field <Fieldoftablecontrol>.
when i active i have a massage of error
Edited by: Pippo Pluto on Jul 28, 2008 1:25 PM
‎2008 Jul 28 2:53 PM
Hi,
why not starting anew your table control but this time using the table control wizard?.
In this way you will have the whole functionality of the table control available
e.g.
*&---------------------------------------------------------------------*
*& Form FCODE_INSERT_ROW *
*&---------------------------------------------------------------------*
FORM fcode_insert_row
USING p_tc_name TYPE dynfnam
p_table_name .
*&SPWIZARD: BEGIN OF LOCAL DATA----------------------------------------*
DATA l_lines_name LIKE feld-name.
DATA l_selline LIKE sy-stepl.
DATA l_lastline TYPE i.
DATA l_line TYPE i.
DATA l_table_name LIKE feld-name.
FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <lines> TYPE i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO <table>. "not headerline
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.
ASSIGN (l_lines_name) TO <lines>.
*&SPWIZARD: get current line *
GET CURSOR LINE l_selline.
IF sy-subrc <> 0. " append line to table
l_selline = <tc>-lines + 1.
*&SPWIZARD: set top line *
IF l_selline > <lines>.
<tc>-top_line = l_selline - <lines> + 1 .
ELSE.
<tc>-top_line = 1.
ENDIF.
ELSE. " insert line into table
l_selline = <tc>-top_line + l_selline - 1.
l_lastline = <tc>-top_line + <lines> - 1.
ENDIF.
*&SPWIZARD: set new cursor line *
l_line = l_selline - <tc>-top_line + 1.
*&SPWIZARD: insert initial line *
INSERT INITIAL LINE INTO <table> INDEX l_selline.
<tc>-lines = <tc>-lines + 1.
*&SPWIZARD: set cursor *
SET CURSOR LINE l_line.
ENDFORM. " FCODE_INSERT_ROW
Best regards.
Edited by: pablo casamayor on Jul 28, 2008 6:31 PM
‎2008 Jul 29 11:05 AM
‎2008 Jul 29 11:29 AM
Hi,
We can use get and set statement but you have to findout
exact line num by using the example and the below site.
&----
*& Form FCODE_INSERT_ROW *
&----
FORM fcode_insert_row
USING p_tc_name TYPE dynfnam
p_table_name .
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA l_lines_name LIKE feld-name.
DATA l_selline LIKE sy-stepl.
DATA l_lastline TYPE i.
DATA l_line TYPE i.
DATA l_table_name LIKE feld-name.
FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <lines> TYPE i.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO <table>. "not headerline
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.
ASSIGN (l_lines_name) TO <lines>.
*&SPWIZARD: get current line *
GET CURSOR LINE l_selline.
IF sy-subrc 0. " append line to table
l_selline = <tc>-lines + 1.
*&SPWIZARD: set top line *
IF l_selline > <lines>.
<tc>-top_line = l_selline - <lines> + 1 .
ELSE.
<tc>-top_line = 1.
ENDIF.
ELSE. " insert line into table
l_selline = <tc>-top_line + l_selline - 1.
l_lastline = <tc>-top_line + <lines> - 1.
ENDIF.
*&SPWIZARD: set new cursor line *
l_line = l_selline - <tc>-top_line + 1.
*&SPWIZARD: insert initial line *
INSERT INITIAL LINE INTO <table> INDEX l_selline.
<tc>-lines = <tc>-lines + 1.
*&SPWIZARD: set cursor *
SET CURSOR LINE l_line.
ENDFORM. " FCODE_INSERT_ROW
this is the site for table control:
http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac9f35c111d1829f0000e829fbfe/content.htm
Regards,
Naveen.
‎2008 Jul 29 11:30 AM
Hi,
We can use get and set statement but you have to findout
exact line num by using the example and the below site.
&----
*& Form FCODE_INSERT_ROW *
&----
FORM fcode_insert_row
USING p_tc_name TYPE dynfnam
p_table_name .
&SPWIZARD: BEGIN OF LOCAL DATA----
DATA l_lines_name LIKE feld-name.
DATA l_selline LIKE sy-stepl.
DATA l_lastline TYPE i.
DATA l_line TYPE i.
DATA l_table_name LIKE feld-name.
FIELD-SYMBOLS <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <lines> TYPE i.
&SPWIZARD: END OF LOCAL DATA----
ASSIGN (p_tc_name) TO <tc>.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO <table>. "not headerline
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.
ASSIGN (l_lines_name) TO <lines>.
*&SPWIZARD: get current line *
GET CURSOR LINE l_selline.
IF sy-subrc 0. " append line to table
l_selline = <tc>-lines + 1.
*&SPWIZARD: set top line *
IF l_selline > <lines>.
<tc>-top_line = l_selline - <lines> + 1 .
ELSE.
<tc>-top_line = 1.
ENDIF.
ELSE. " insert line into table
l_selline = <tc>-top_line + l_selline - 1.
l_lastline = <tc>-top_line + <lines> - 1.
ENDIF.
*&SPWIZARD: set new cursor line *
l_line = l_selline - <tc>-top_line + 1.
*&SPWIZARD: insert initial line *
INSERT INITIAL LINE INTO <table> INDEX l_selline.
<tc>-lines = <tc>-lines + 1.
*&SPWIZARD: set cursor *
SET CURSOR LINE l_line.
ENDFORM. " FCODE_INSERT_ROW
this is the site for table control:
http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac9f35c111d1829f0000e829fbfe/content.htm
Regards,
Naveen.