07-20-2007 6:21 AM
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
07-20-2007 6:28 AM
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.
07-20-2007 6:28 AM
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.
07-20-2007 6:36 AM
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.
07-20-2007 6:40 AM
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.
07-20-2007 7:03 AM
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.
07-20-2007 7:05 AM
07-20-2007 7:21 AM
07-20-2007 6:34 AM
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>