Hi,
I have a table control and I am able to delete lines via a button I've placed on the screen;
the problem is when I delete a line the cursor automatically goes back to the top of the screen (1st field) not even within the table control.
I've been told to use get_cursor and set_cursor to solve this but not sure exactly how to use it
can anybody assist?
My code is as follows:-
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0203.
MODULE get_data_0203.
MODULE get_cursor. " RP 25.06.09
* This binds the table control and the table memory.
LOOP AT gtc_ipscale INTO zrc_gui_tc_ipscale
WITH CONTROL tc_scale_rate.
* Obtain number of lines on the table control.
MODULE tc_scale_rate_get_lines.
ENDLOOP.
MODULE modify_screen_0203.
MODULE hide_buttons.
*
PROCESS AFTER INPUT.
* Loop at the table rows.
LOOP AT gtc_ipscale.
CHAIN.
* Tranfer the screen field values to the ABAP work area.
FIELD: zrc_gui_tc_ipscale-selected,
zrc_gui_tc_ipscale-cost_group,
zrc_gui_tc_ipscale-scale_id,
zrc_gui_tc_ipscale-scale_name,
zrc_gui_tc_ipscale-ip.
MODULE modify_gtc_ipscale ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE user_command_0203.
module set_cursor. " RP 25.06.09
MODULE set_data_0203.
module GET_CURSOR output. PERFORM get_cursor. " RP 25.06.09 endmodule. " GET_CURSOR OUTPUT
form GET_CURSOR .
data: l_fline type sy-index,
l_curline type sy-index.
l_fline = 1.
l_curline = 3.
CALL FUNCTION 'GET_CURSOR'
IMPORTING
FIRST_LINE = l_fline
CURSOR_LINE = l_curline
* CURSOR_OFFSET =
.
endform.
MODULE set_cursor INPUT. PERFORM set_cursor. " RP 25.06.09 ENDMODULE.
form SET_CURSOR .
data: l_fline type sy-index,
l_curline type sy-index.
l_fline = 1.
l_curline = 3.
CALL FUNCTION 'SET_CURSOR'
EXPORTING
first_line = l_fline
cursor_line = l_curline
* cursor_offset =
* IMPORTING
* EDIT =
.
endform.