Application Development 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: 

Set cursor

Former Member
0 Kudos

Hi experts,

I have a problem when setting the cursor position in table control,

Here the table control contains 5 line items (mat-no and ser no). My requirement is when i press enter after enter the ser no from the first line item my cursor position should come to the ser no field of 2nd line item.

if i press enter after entering the ser-no in the second line item my cursor should come to the ser-no field of the 3rd line item and so on.

Here i have used the command

IF OK_CODE = 'CONT'

AND GS_TC_COMP-MATNR IS NOT INITIAL

AND GS_TC_COMP-SERNR IS INITIAL.

SET CURSOR FIELD 'GS_TC_COMP-SERNR' LINE g_tc_comps-current_line.

endif.

Here i got the problem that when i press enter from the field ser-no in the first line item my cursor goes to the last line item in the table control instead od coming to 2nd 3rd and 4th line items...

ok_code = cont (when i press enter)

i hope u understand my requirement.

Give me a solution for this...

Thanks,

Murugan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Change your code as below.

DATA linno TYPE i.

IF OK_CODE = 'CONT'
AND GS_TC_COMP-MATNR IS NOT INITIAL
AND GS_TC_COMP-SERNR IS INITIAL.

GET CURSOR LINE linno.

IF sy-subrc EQ 0.
linno = linno + 1.
ELSE.
linno = 1.
ENDIF.

SET CURSOR FIELD 'GS_TC_COMP-SERNR' LINE linno.

endif.

7 REPLIES 7

Former Member
0 Kudos

Change your code as below.

DATA linno TYPE i.

IF OK_CODE = 'CONT'
AND GS_TC_COMP-MATNR IS NOT INITIAL
AND GS_TC_COMP-SERNR IS INITIAL.

GET CURSOR LINE linno.

IF sy-subrc EQ 0.
linno = linno + 1.
ELSE.
linno = 1.
ENDIF.

SET CURSOR FIELD 'GS_TC_COMP-SERNR' LINE linno.

endif.

0 Kudos

Hi Manoj V Kumar

While using your code, for the first cursor position it works well. Then it set to last cursor line not to the next cursor position. Whats wrong with my code.....

Pls. help me to do.

Thanks.

0 Kudos

Just try to clear the variable linno before the GET CURSOR statement. Even if that also doesnt work, just paste your new code here. I will try to help you out.

0 Kudos

hi Manoj V Kumar ,

Can u give me your mail-id. I will send the detailed requirement and Screen shots.......

Pls help me to solve this issue.

Thanks.

0 Kudos

You can send it to manoj.vijayakumar@gmail.com

0 Kudos

hi Manoj V Kumar ,

i have sent detailed mail to u.

Thanks.

Former Member
0 Kudos

hi

get the screen name of that field not the internal table field name through which you are looping at.

code is:

set cursor field 'name of the field' line table_control_name-current_line.

regards

ravish

<b>reward if useful</b>